Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Commit

Permalink
Create span before each ES test
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay committed Oct 10, 2017
1 parent 1b0040c commit a3e65fa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ public class BaseETest {
private static final String COLLECTOR_SERVICE_NAME = "jaeger-collector";
private static final String ZIPKIN_SERVICE_NAME = "zipkin";

private OkHttpClient okHttpClient = new OkHttpClient.Builder()
protected OkHttpClient okHttpClient = new OkHttpClient.Builder()
.build();

@Named(QUERY_SERVICE_NAME)
@PortForward
@ArquillianResource
private URL queryUrl;
protected URL queryUrl;

@Port(14268)
@Named(COLLECTOR_SERVICE_NAME)
@PortForward
@ArquillianResource
private URL collectorUrl;
protected URL collectorUrl;

@Port(9411)
@Named(ZIPKIN_SERVICE_NAME)
@PortForward
@ArquillianResource
private URL zipkinUrl;
protected URL zipkinUrl;

@Test
public void testUiResponds() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,46 @@
*/
package io.jaegertracing.kubernetes;

import com.uber.jaeger.Tracer;
import io.jaegertracing.kubernetes.deployment.BaseETest;
import java.io.IOException;
import org.junit.Ignore;
import java.util.UUID;
import okhttp3.Request;
import okhttp3.Response;
import org.junit.Before;

import static org.awaitility.Awaitility.await;

/**
* @author Pavol Loffay
*/
public class ProductionETest extends BaseETest {

/**
* We need to initialize ES storage, before we proceed to tests for two reasons:
* 1. sometimes first span is not stored
* 2. jaeger-query returns 500 is ES storage is empty (without indices)
*/
@Before
public void before() {
String serviceName = UUID.randomUUID().toString().replace("-", "");
Tracer tracer = createJaegerTracer(serviceName);
String operationName = UUID.randomUUID().toString().replace("-", "");
tracer.buildSpan(operationName).startManual().finish();
tracer.close();

Request request = new Request.Builder()
.url(queryUrl + "api/traces?service=" + serviceName)
.get()
.build();

await().until(() -> {
Response response = okHttpClient.newCall(request).execute();
String body = response.body().string();
return body.contains(operationName);
});
}

public void testDependencyLinks() throws IOException, InterruptedException {
}
}

0 comments on commit a3e65fa

Please sign in to comment.