Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
amarziali committed May 6, 2025
commit 9582748d99e9d034fda4ff049ecbba9c49bf1bd8
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ package datadog.trace.civisibility.decorator
import datadog.trace.api.DDTags
import datadog.trace.api.sampling.PrioritySampling
import datadog.trace.bootstrap.instrumentation.api.AgentSpan
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
import datadog.trace.bootstrap.instrumentation.api.Tags
import spock.lang.Specification

class TestDecoratorImplTest extends Specification {

def span = Mock(AgentSpan)
def context = Mock(AgentSpanContext)


def "test afterStart"() {
setup:
def decorator = new TestDecoratorImpl("test-component", "session-name", "test-command", ["ci-tag-1": "value", "ci-tag-2": "another value"])

when:
decorator.afterStart(span)

then:
1 * span.setTag(Tags.TEST_SESSION_NAME, "session-name")
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context().setInstrumentationComponentName("test-component")
1 * span.context() >> context
1 * context.setInstrumentationComponentName("test-component")
1 * span.setTag(Tags.TEST_TYPE, decorator.testType())
1 * span.setSamplingPriority(PrioritySampling.SAMPLER_KEEP)
1 * span.setTag(DDTags.ORIGIN_KEY, decorator.origin())
Expand All @@ -45,6 +48,8 @@ class TestDecoratorImplTest extends Specification {
decorator.afterStart(span)

then:
1 * span.context() >> context
1 * context.setInstrumentationComponentName("test-component")
1 * span.setTag(Tags.TEST_SESSION_NAME, expectedSessionName)

where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ public Span startManual() {
@Override
public Span start() {
final AgentSpan agentSpan = delegate.start();
agentSpan.context().setInstrumentationComponentName("opentracing");
return converter.toSpan(agentSpan);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class OpenTracingAPITest extends DDSpecification {
operationName "someOperation"
resourceName "someOperation"
tags {
"$DDTags.INTEGRATION_COMPONENT" "opentracing"
defaultTags()
}
}
Expand All @@ -74,7 +75,7 @@ class OpenTracingAPITest extends DDSpecification {
def "span with builder"() {
when:
Span testSpan = tracer.buildSpan("someOperation")
.withTag(Tags.COMPONENT, "test-component")
.withTag(Tags.COMPONENT, "opentracing")
.withTag("someBoolean", true)
.withTag("someNumber", 1)
.withTag(DDTags.SERVICE_NAME, "someService")
Expand All @@ -100,7 +101,8 @@ class OpenTracingAPITest extends DDSpecification {
operationName "someOperation"
resourceName "someOperation"
tags {
"$datadog.trace.bootstrap.instrumentation.api.Tags.COMPONENT" "test-component"
"$datadog.trace.bootstrap.instrumentation.api.Tags.COMPONENT" "opentracing"
"$DDTags.INTEGRATION_COMPONENT" "opentracing"
"someBoolean" true
"someNumber" 1
defaultTags()
Expand All @@ -122,7 +124,7 @@ class OpenTracingAPITest extends DDSpecification {

when:
testSpan.setTag(DDTags.SERVICE_NAME, "someService")
testSpan.setTag(Tags.COMPONENT, "test-component")
testSpan.setTag(Tags.COMPONENT, "opentracing")
testSpan.setTag("someBoolean", true)
testSpan.setTag("someNumber", 1)
testSpan.setOperationName("someOtherOperation")
Expand All @@ -141,7 +143,8 @@ class OpenTracingAPITest extends DDSpecification {
operationName("someOtherOperation")
resourceName "someOtherOperation"
tags {
"$datadog.trace.bootstrap.instrumentation.api.Tags.COMPONENT" "test-component"
"$datadog.trace.bootstrap.instrumentation.api.Tags.COMPONENT" "opentracing"
"$DDTags.INTEGRATION_COMPONENT" "opentracing"
"someBoolean" true
"someNumber" 1
defaultTags()
Expand Down Expand Up @@ -205,6 +208,7 @@ class OpenTracingAPITest extends DDSpecification {
operationName "someOperation"
resourceName "someOperation"
tags {
"$DDTags.INTEGRATION_COMPONENT" "opentracing"
defaultTags()
}
}
Expand All @@ -214,6 +218,7 @@ class OpenTracingAPITest extends DDSpecification {
resourceName "someOperation2"
childOf(span(0))
tags {
"$DDTags.INTEGRATION_COMPONENT" null
defaultTags()
}
}
Expand Down Expand Up @@ -258,6 +263,7 @@ class OpenTracingAPITest extends DDSpecification {
operationName "someOperation"
resourceName "someOperation"
tags {
"$DDTags.INTEGRATION_COMPONENT" "opentracing"
defaultTags()
}
}
Expand Down