adding tests
This commit is contained in:
parent
78b2faf03b
commit
d46099cbd9
|
@ -55,6 +55,7 @@ dependencies {
|
||||||
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.4.2'
|
||||||
testCompile group: 'io.opentracing', name: 'opentracing-mock', version: '0.30.0'
|
testCompile group: 'io.opentracing', name: 'opentracing-mock', version: '0.30.0'
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.6.2'
|
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.6.2'
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.datadoghq.trace.agent.integration;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
||||||
|
|
||||||
|
import com.datadoghq.trace.DDSpan;
|
||||||
|
import com.datadoghq.trace.DDTracer;
|
||||||
|
import com.mongodb.event.CommandStartedEvent;
|
||||||
|
import org.bson.BsonDocument;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class MongoHelperTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
|
||||||
|
final CommandStartedEvent cmd =
|
||||||
|
new CommandStartedEvent(1, null, "databasename", "query", new BsonDocument());
|
||||||
|
|
||||||
|
final DDSpan span = new DDTracer().buildSpan("foo").startManual();
|
||||||
|
new MongoHelper(null).decorate(span, cmd);
|
||||||
|
|
||||||
|
assertThat(span.context().getSpanType()).isEqualTo("mongodb");
|
||||||
|
assertThat(span.context().getResourceName())
|
||||||
|
.isEqualTo(span.context().getTags().get("db.statement"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue