diff --git a/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecoratorTest.groovy b/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecoratorTest.groovy index fcbba105a5a..7c453155330 100644 --- a/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecoratorTest.groovy +++ b/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecoratorTest.groovy @@ -422,7 +422,8 @@ class HttpServerDecoratorTest extends ServerDecoratorTest { def ig = new InstrumentationGateway() def ss = ig.getSubscriptionService(RequestContextSlot.APPSEC) def cbpAppSec = ig.getCallbackProvider(RequestContextSlot.APPSEC) - def callbacks = new IGCallBacks(reqData) + def data = reqData ? new Object() : null + def callbacks = new IGCallBacks(data) if (reqStarted) { ss.registerCallback(EVENTS.requestStarted(), callbacks) } @@ -434,7 +435,7 @@ class HttpServerDecoratorTest extends ServerDecoratorTest { } Map headers = ["foo": "bar", "some": "thing", "another": "value"] def reqCtxt = Mock(RequestContext) { - getData(RequestContextSlot.APPSEC) >> reqData + getData(RequestContextSlot.APPSEC) >> data } def mSpan = Mock(AgentSpan) { getRequestContext() >> reqCtxt @@ -461,13 +462,13 @@ class HttpServerDecoratorTest extends ServerDecoratorTest { where: // spotless:off - reqStarted | reqData | reqHeader | reqHeaderDone | reqStartedCount | reqHeaderCount | reqHeaderDoneCount - false | null | false | false | 0 | 0 | 0 - false | new Object() | false | false | 0 | 0 | 0 - true | null | false | false | 1 | 0 | 0 - true | new Object() | false | false | 1 | 0 | 0 - true | new Object() | true | false | 1 | 3 | 0 - true | new Object() | true | true | 1 | 3 | 1 + reqStarted | reqData | reqHeader | reqHeaderDone | reqStartedCount | reqHeaderCount | reqHeaderDoneCount + false | false | false | false | 0 | 0 | 0 + false | true | false | false | 0 | 0 | 0 + true | false | false | false | 1 | 0 | 0 + true | true | false | false | 1 | 0 | 0 + true | true | true | false | 1 | 3 | 0 + true | true | true | true | 1 | 3 | 1 // spotless:on } diff --git a/dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/util/IteratorsTest.groovy b/dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/util/IteratorsTest.groovy index d5510a39ebb..9b3c0006071 100644 --- a/dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/util/IteratorsTest.groovy +++ b/dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/util/IteratorsTest.groovy @@ -60,7 +60,7 @@ class IteratorsTest extends Specification { ['hello', 'World', '!'] | ['hello', 'World', '!'] } - void 'joined iterator'() { + void 'joined iterator #iterationIndex'() { when: final iterator = Iterators.join(iterators as Iterator[]) diff --git a/dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/tooling/csi/BaseCallSiteTest.groovy b/dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/tooling/csi/BaseCallSiteTest.groovy index e28d0d43ae1..8c69fc0bd21 100644 --- a/dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/tooling/csi/BaseCallSiteTest.groovy +++ b/dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/tooling/csi/BaseCallSiteTest.groovy @@ -184,5 +184,10 @@ class BaseCallSiteTest extends DDSpecification { String type String method String descriptor + + @Override + String toString() { + return descriptor + } } } diff --git a/dd-trace-core/src/test/groovy/datadog/trace/common/metrics/SerializingMetricWriterTest.groovy b/dd-trace-core/src/test/groovy/datadog/trace/common/metrics/SerializingMetricWriterTest.groovy index 1ba3c8b761c..5b6ce8bee3d 100644 --- a/dd-trace-core/src/test/groovy/datadog/trace/common/metrics/SerializingMetricWriterTest.groovy +++ b/dd-trace-core/src/test/groovy/datadog/trace/common/metrics/SerializingMetricWriterTest.groovy @@ -14,7 +14,7 @@ import static java.util.concurrent.TimeUnit.SECONDS class SerializingMetricWriterTest extends DDSpecification { - def "should produce correct message" () { + def "should produce correct message #iterationIndex" () { setup: long startTime = MILLISECONDS.toNanos(System.currentTimeMillis()) long duration = SECONDS.toNanos(10) diff --git a/dd-trace-core/src/test/groovy/datadog/trace/common/sampling/RuleBasedSamplingTest.groovy b/dd-trace-core/src/test/groovy/datadog/trace/common/sampling/RuleBasedSamplingTest.groovy index a8539edcc8d..c56e7ddfedb 100644 --- a/dd-trace-core/src/test/groovy/datadog/trace/common/sampling/RuleBasedSamplingTest.groovy +++ b/dd-trace-core/src/test/groovy/datadog/trace/common/sampling/RuleBasedSamplingTest.groovy @@ -328,9 +328,9 @@ class RuleBasedSamplingTest extends DDCoreSpecification { "*" | "anything..." | true "*" | null | false "*" | new StringBuilder("foo") | true - "*" | new Object() {} | true - "**" | new Object() {} | true - "?" | new Object() {} | false + "*" | object() | true + "**" | object() | true + "?" | object() | false "*" | "foo" | true "**" | "foo" | true "**" | true | true @@ -485,4 +485,13 @@ class RuleBasedSamplingTest extends DDCoreSpecification { static bigDecimal(str) { return new BigDecimal(str) } + + static object() { + return new Object() { + @Override + String toString() { + return 'object' + } + } + } } diff --git a/dd-trace-core/src/test/groovy/datadog/trace/common/writer/SerializationTest.groovy b/dd-trace-core/src/test/groovy/datadog/trace/common/writer/SerializationTest.groovy index 3ede3f626b1..ba273ca3e16 100644 --- a/dd-trace-core/src/test/groovy/datadog/trace/common/writer/SerializationTest.groovy +++ b/dd-trace-core/src/test/groovy/datadog/trace/common/writer/SerializationTest.groovy @@ -5,19 +5,13 @@ import com.fasterxml.jackson.databind.ObjectMapper import datadog.trace.test.util.DDSpecification import org.msgpack.core.MessagePack import org.msgpack.jackson.dataformat.MessagePackFactory -import spock.lang.Shared import static java.util.Collections.singletonMap class SerializationTest extends DDSpecification { - @Shared - def jsonMapper = new ObjectMapper() - @Shared - def mpMapper = new ObjectMapper(new MessagePackFactory()) - - def "test json mapper serialization"() { setup: + def mapper = new ObjectMapper() def map = ["key1": "val1"] def serializedMap = mapper.writeValueAsBytes(map) def serializedList = "[${new String(serializedMap)}]".getBytes() @@ -28,13 +22,13 @@ class SerializationTest extends DDSpecification { then: result == [map] new String(serializedList) == '[{"key1":"val1"}]' - - where: - mapper = jsonMapper } def "test msgpack mapper serialization"() { setup: + def mapper = new ObjectMapper(new MessagePackFactory()) + // GStrings get odd results in the serializer. + def input = (1..1).collect { singletonMap("key$it".toString(), "val$it".toString()) } def serializedMaps = input.collect { mapper.writeValueAsBytes(it) } @@ -51,11 +45,5 @@ class SerializationTest extends DDSpecification { then: result == input - - where: - mapper = mpMapper - - // GStrings get odd results in the serializer. - input = (1..1).collect { singletonMap("key$it".toString(), "val$it".toString()) } } } diff --git a/dd-trace-core/src/test/groovy/datadog/trace/core/histogram/HistogramsTest.groovy b/dd-trace-core/src/test/groovy/datadog/trace/core/histogram/HistogramsTest.groovy index 5461dc69d6c..70a275964d7 100644 --- a/dd-trace-core/src/test/groovy/datadog/trace/core/histogram/HistogramsTest.groovy +++ b/dd-trace-core/src/test/groovy/datadog/trace/core/histogram/HistogramsTest.groovy @@ -36,7 +36,7 @@ class HistogramsTest extends DDSpecification { @Shared Double[] quantiles = [0.5D, 0.75D, 0.9D, 0.95D, 0.99D] - def "test quantiles have 1% relative error"() { + def "test quantiles have 1% relative error #iterationIndex"() { setup: def histogram diff --git a/internal-api/src/test/groovy/datadog/trace/api/FunctionsTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/FunctionsTest.groovy index 87cef1ebb7b..c15545b2ce7 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/FunctionsTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/FunctionsTest.groovy @@ -11,7 +11,7 @@ import java.util.function.Function class FunctionsTest extends DDSpecification { - def "test common string functions"() { + def "test common string functions #iterationIndex"() { when: CharSequence output = fn.apply(input) then: @@ -46,14 +46,14 @@ class FunctionsTest extends DDSpecification { "value" | "value.test" } - def "test join strings"() { + def "test join strings #iterationIndex"() { when: CharSequence output = fn.apply(left, right) then: String.valueOf(output) == expected where: fn | left | right | expected - Functions.PrefixJoin.of("~", Function.identity()) | "x" | "y" | "x~y" + Functions.PrefixJoin.of("~", Function.identity()) | "x" | "y" | "x~y" Functions.PrefixJoin.of("~") | "x" | "y" | "x~y" Functions.SuffixJoin.of("~", Function.identity()) | "x" | "y" | "x~y" Functions.SuffixJoin.of("~") | "x" | "y" | "x~y" diff --git a/internal-api/src/test/groovy/datadog/trace/api/cache/QualifiedClassNameCacheTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/cache/QualifiedClassNameCacheTest.groovy index 35b5f95cc17..f9376c4d720 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/cache/QualifiedClassNameCacheTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/cache/QualifiedClassNameCacheTest.groovy @@ -7,7 +7,7 @@ import java.util.function.Function class QualifiedClassNameCacheTest extends DDSpecification { - def "test cached string operations"() { + def "test cached string operations #iterationIndex"() { when: QualifiedClassNameCache cache = new QualifiedClassNameCache(new Function, String>() { @Override diff --git a/internal-api/src/test/groovy/datadog/trace/api/iast/telemetry/IastMetricTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/iast/telemetry/IastMetricTest.groovy index 9220f205a71..ab7376c2e31 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/iast/telemetry/IastMetricTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/iast/telemetry/IastMetricTest.groovy @@ -9,7 +9,7 @@ import static datadog.trace.api.iast.telemetry.IastMetric.TRACE_METRIC_PREFIX class IastMetricTest extends Specification { - void 'test iast metrics attributes'() { + void 'test iast metrics attributes #metric.name()'() { given: final verbosity = Config.get().getIastTelemetryVerbosity() @@ -29,7 +29,7 @@ class IastMetricTest extends Specification { metric << (IastMetric.values() as List) } - void 'test unwrapping of tags'() { + void 'test unwrapping of tags #iterationIndex'() { when: final result = metricTag.unwrap(tag) @@ -46,7 +46,7 @@ class IastMetricTest extends Specification { IastMetric.Tag.SOURCE_TYPE | SourceTypes.REQUEST_PARAMETER_VALUE | null } - void 'test metric tags'() { + void 'test metric tags #metric.name()'() { when: final telemetryTags = [] final spanTags = [] diff --git a/telemetry/src/test/groovy/datadog/telemetry/metric/MetricPeriodicActionTest.groovy b/telemetry/src/test/groovy/datadog/telemetry/metric/MetricPeriodicActionTest.groovy index e1bf4d978bf..d9e757b00e8 100644 --- a/telemetry/src/test/groovy/datadog/telemetry/metric/MetricPeriodicActionTest.groovy +++ b/telemetry/src/test/groovy/datadog/telemetry/metric/MetricPeriodicActionTest.groovy @@ -12,7 +12,7 @@ import spock.lang.Specification class MetricPeriodicActionTest extends Specification { - void 'test that common metrics are joined before being sent to telemetry'() { + void 'test that common metrics are joined before being sent to telemetry #iterationIndex'() { given: final service = Mock(TelemetryService) final MetricCollector metricCollector = Mock(MetricCollector) @@ -43,7 +43,7 @@ class MetricPeriodicActionTest extends Specification { [col(counter: 2L, tags: ['a:b', 'c:d']), col(counter: 6L, tags: ['a:b', 'c:d'])] | [tel(points: [[_, 2L], [_, 6L]], tags: ['a:b', 'c:d'])] } - void 'test that common distribution series are joined before being sent to telemetry'() { + void 'test that common distribution series are joined before being sent to telemetry #iterationIndex'() { given: final service = Mock(TelemetryService) final MetricCollector metricCollector = Mock(MetricCollector)