Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion dd-java-agent/instrumentation/weaver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ muzzle {
}
}

addTestSuiteForDir('latestDepTest', 'test')
addTestSuiteForDir('latestDepTest', 'latestDepTest')
// weaver 0.8.4 is the earliest supported version before the org migration
addTestSuiteForDir('weaver084Test', 'test')

dependencies {
compileOnly group: 'org.typelevel', name: 'weaver-cats_3', version: '0.9.0'
// Weaver is published for Scala > 2.12
compileOnly group: 'org.scala-lang', name: 'scala-library', version: '2.12.20'

testImplementation project(':dd-java-agent:agent-ci-visibility:civisibility-instrumentation-test-fixtures')

Expand Down
8 changes: 4 additions & 4 deletions dd-java-agent/instrumentation/weaver/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ org.typelevel:cats-kernel_3:2.10.0=compileClasspath,testCompileClasspath,testRun
org.typelevel:cats-kernel_3:2.11.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-mtl_3:1.3.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:scalac-compat-annotation_3:0.1.4=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.10.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.11.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-cats_3:0.10.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats_3:0.11.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-core_3:0.10.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-core_3:0.11.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-core_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-framework_3:0.10.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-framework_3:0.11.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-framework_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.webjars:jquery:3.5.1=latestDepTestRuntimeClasspath,testRuntimeClasspath,weaver084TestRuntimeClasspath
org.xmlresolver:xmlresolver:4.4.3=spotbugs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import datadog.trace.api.DisableTestTrace
import datadog.trace.civisibility.CiVisibilityInstrumentationTest
import datadog.trace.instrumentation.weaver.DatadogWeaverReporter
import datadog.trace.instrumentation.weaver.WeaverIntegrationTestRunner
import datadog.trace.instrumentation.weaver.WeaverUtils
import org.example.TestFailed
import org.example.TestFailedExceptionPure
import org.example.TestFailedPure
import org.example.TestIgnored
import org.example.TestSucceed
import org.example.TestSucceedGlobalResource
import org.example.TestSucceedPure
import org.example.TestSucceedSuiteResource

@DisableTestTrace(reason = "avoid self-tracing")
class WeaverLatestDepTest extends CiVisibilityInstrumentationTest {

def "test #testcaseName"() {
runTests(tests)

assertSpansData(testcaseName)

where:
testcaseName | tests
"test-succeed-pure" | [TestSucceedPure]
"test-failed-pure" | [TestFailedPure]
"test-failed-exception-pure" | [TestFailedExceptionPure]
"test-succeeded" | [TestSucceed]
"test-failed" | [TestFailed]
"test-ignored" | [TestIgnored]
"test-succeed-suite-resource" | [TestSucceedSuiteResource]
"test-succeed-global-resource" | [TestSucceedGlobalResource]
}

def "test capabilities tagging"() {
setup:
runTests([TestSucceed])

expect:
assertCapabilities(WeaverUtils.CAPABILITIES, 4)
}

@Override
String instrumentedLibraryName() {
return "weaver"
}

@Override
String instrumentedLibraryVersion() {
return WeaverUtils.weaverVersion
}

void runTests(List<Class<?>> tests) {
DatadogWeaverReporter.start()
def testNames = tests.collect { it.name }
WeaverIntegrationTestRunner.runTests(testNames)
DatadogWeaverReporter.stop()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
[ {
"content" : {
"duration" : ${content_duration},
"error" : 0,
"meta" : {
"_dd.p.tid" : ${content_meta__dd_p_tid},
"component" : "weaver",
"dummy_ci_tag" : "dummy_ci_tag_value",
"env" : "none",
"library_version" : ${content_meta_library_version},
"span.kind" : "test_suite_end",
"test.codeowners" : "[\"owner1\",\"owner2\"]",
"test.framework" : "weaver",
"test.framework_version" : ${content_meta_test_framework_version},
"test.module" : "weaver",
"test.source.file" : "dummy_source_path",
"test.status" : "fail",
"test.suite" : "org.example.TestFailedExceptionPure",
"test.type" : "test",
"test_session.name" : "session-name"
},
"metrics" : {
"_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count},
"test.source.end" : 19,
"test.source.start" : 11
},
"name" : "weaver.test_suite",
"resource" : "org.example.TestFailedExceptionPure",
"service" : "worker.org.gradle.process.internal.worker.gradleworkermain",
"start" : ${content_start},
"test_module_id" : ${content_test_module_id},
"test_session_id" : ${content_test_session_id},
"test_suite_id" : ${content_test_suite_id}
},
"type" : "test_suite_end",
"version" : 1
}, {
"content" : {
"duration" : ${content_duration_2},
"error" : 1,
"meta" : {
"_dd.profiling.ctx" : "test",
"_dd.tracer_host" : ${content_meta__dd_tracer_host},
"component" : "weaver",
"dummy_ci_tag" : "dummy_ci_tag_value",
"env" : "none",
"error.message" : ${content_meta_error_message},
"error.stack" : ${content_meta_error_stack},
"error.type" : "java.lang.RuntimeException",
"language" : "jvm",
"library_version" : ${content_meta_library_version},
"runtime-id" : ${content_meta_runtime_id},
"span.kind" : "test",
"test.codeowners" : "[\"owner1\",\"owner2\"]",
"test.framework" : "weaver",
"test.framework_version" : ${content_meta_test_framework_version},
"test.module" : "weaver",
"test.name" : "pure exception test",
"test.source.file" : "dummy_source_path",
"test.status" : "fail",
"test.suite" : "org.example.TestFailedExceptionPure",
"test.type" : "test",
"test_session.name" : "session-name"
},
"metrics" : {
"_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2},
"_dd.profiling.enabled" : 0,
"_dd.trace_span_attribute_schema" : 0,
"process_id" : ${content_metrics_process_id}
},
"name" : "weaver.test",
"parent_id" : ${content_parent_id},
"resource" : "org.example.TestFailedExceptionPure.pure exception test",
"service" : "worker.org.gradle.process.internal.worker.gradleworkermain",
"span_id" : ${content_span_id},
"start" : ${content_start_2},
"test_module_id" : ${content_test_module_id},
"test_session_id" : ${content_test_session_id},
"test_suite_id" : ${content_test_suite_id},
"trace_id" : ${content_trace_id}
},
"type" : "test",
"version" : 2
}, {
"content" : {
"duration" : ${content_duration_3},
"error" : 0,
"meta" : {
"_dd.p.tid" : ${content_meta__dd_p_tid_2},
"_dd.profiling.ctx" : "test",
"_dd.tracer_host" : ${content_meta__dd_tracer_host},
"component" : "weaver",
"dummy_ci_tag" : "dummy_ci_tag_value",
"env" : "none",
"language" : "jvm",
"library_version" : ${content_meta_library_version},
"runtime-id" : ${content_meta_runtime_id},
"span.kind" : "test_session_end",
"test.command" : "weaver",
"test.framework" : "weaver",
"test.framework_version" : ${content_meta_test_framework_version},
"test.status" : "fail",
"test.type" : "test",
"test_session.name" : "session-name"
},
"metrics" : {
"_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3},
"_dd.profiling.enabled" : 0,
"_dd.trace_span_attribute_schema" : 0,
"process_id" : ${content_metrics_process_id}
},
"name" : "weaver.test_session",
"resource" : "weaver",
"service" : "worker.org.gradle.process.internal.worker.gradleworkermain",
"start" : ${content_start_3},
"test_session_id" : ${content_test_session_id}
},
"type" : "test_session_end",
"version" : 1
}, {
"content" : {
"duration" : ${content_duration_4},
"error" : 0,
"meta" : {
"_dd.p.tid" : ${content_meta__dd_p_tid_3},
"component" : "weaver",
"dummy_ci_tag" : "dummy_ci_tag_value",
"env" : "none",
"library_version" : ${content_meta_library_version},
"span.kind" : "test_module_end",
"test.framework" : "weaver",
"test.framework_version" : ${content_meta_test_framework_version},
"test.module" : "weaver",
"test.status" : "fail",
"test.type" : "test",
"test_session.name" : "session-name"
},
"metrics" : {
"_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}
},
"name" : "weaver.test_module",
"resource" : "weaver",
"service" : "worker.org.gradle.process.internal.worker.gradleworkermain",
"start" : ${content_start_4},
"test_module_id" : ${content_test_module_id},
"test_session_id" : ${content_test_session_id}
},
"type" : "test_module_end",
"version" : 1
} ]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ ]
Loading