Fixing failling tests on CircleCi
MODIFY
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/TraceAnnotationsManagerTest.java
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/TraceAnnotationsManagerTest.java
@@ -3,7 +3,6 @@ package com.datadoghq.trace.agent;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import com.datadoghq.trace.agent.integration.AAgentIntegration;
@@ -15,7 +14,6 @@ public class TraceAnnotationsManagerTest extends AAgentIntegration{
super.beforeTest();
}
- @Ignore("Test is failing in CI but not locally. :-(")
@Test
public void testAnnotations() {
//Test single span in new trace

MODIFY
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/integration/AAgentIntegration.java
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/integration/AAgentIntegration.java
package com.datadoghq.trace.agent.integration;
+import java.lang.reflect.Field;
import org.junit.Before;
import com.datadoghq.trace.DDTracer;
@@ -17,7 +18,10 @@ public class AAgentIntegration {
try{
GlobalTracer.register(tracer);
}catch(Exception e){
- //DO NOTHING IF ALREADY REGISTERED
+ // Force it using reflexion, I'm proud of this solution
+ final Field field = GlobalTracer.class.getDeclaredField("tracer");
+ field.setAccessible(true);
+ field.set(null, tracer);
}
writer.start();
}

MODIFY
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/integration/CassandraIntegrationTest.java
dd-java-agent-ittests/src/test/java/com/datadoghq/trace/agent/integration/CassandraIntegrationTest.java
@@ -22,7 +22,7 @@ public class CassandraIntegrationTest {
@Before
public void start() throws InterruptedException, TTransportException, ConfigurationException, IOException {
- EmbeddedCassandraServerHelper.startEmbeddedCassandra(20000L);
+ EmbeddedCassandraServerHelper.startEmbeddedCassandra(40000L);
}
@After

Fixing failling tests on CircleCi