-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Spock ITR instrumentation to skip spec setup methods if all fe…
…atures in a spec are skipped (#6782)
- Loading branch information
1 parent
04f98d5
commit 37358b9
Showing
15 changed files
with
1,077 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...unit-5.3/spock-junit-5/src/test/groovy/org/example/TestParameterizedSetupSpecSpock.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.example | ||
|
||
import datadog.trace.bootstrap.instrumentation.api.AgentScope | ||
import datadog.trace.bootstrap.instrumentation.api.AgentSpan | ||
import datadog.trace.bootstrap.instrumentation.api.AgentTracer | ||
import datadog.trace.bootstrap.instrumentation.api.ScopeSource | ||
import spock.lang.Specification | ||
|
||
class TestParameterizedSetupSpecSpock extends Specification { | ||
|
||
def setupSpec() { | ||
AgentTracer.TracerAPI agentTracer = AgentTracer.get() | ||
AgentSpan span = agentTracer.buildSpan("spock-manual", "spec-setup").start() | ||
try (AgentScope scope = agentTracer.activateSpan(span, ScopeSource.MANUAL)) { | ||
// manually trace spec setup to check whether ITR skips it or not | ||
} | ||
span.finish() | ||
} | ||
|
||
def "test add #a and #b"() { | ||
expect: | ||
a + b == c | ||
|
||
where: | ||
a | b | c | ||
1 | 2 | 3 | ||
4 | 4 | 8 | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...tion/junit-5.3/spock-junit-5/src/test/groovy/org/example/TestSucceedSetupSpecSpock.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.example | ||
|
||
import datadog.trace.bootstrap.instrumentation.api.AgentScope | ||
import datadog.trace.bootstrap.instrumentation.api.AgentSpan | ||
import datadog.trace.bootstrap.instrumentation.api.AgentTracer | ||
import datadog.trace.bootstrap.instrumentation.api.ScopeSource | ||
import spock.lang.Specification | ||
|
||
class TestSucceedSetupSpecSpock extends Specification { | ||
|
||
def setupSpec() { | ||
AgentTracer.TracerAPI agentTracer = AgentTracer.get() | ||
AgentSpan span = agentTracer.buildSpan("spock-manual", "spec-setup").start() | ||
try (AgentScope scope = agentTracer.activateSpan(span, ScopeSource.MANUAL)) { | ||
// manually trace spec setup to check whether ITR skips it or not | ||
} | ||
span.finish() | ||
} | ||
|
||
def "test success"() { | ||
expect: | ||
1 == 1 | ||
} | ||
|
||
def "test another success"() { | ||
expect: | ||
1 == 1 | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...k-junit-5/src/test/resources/test-itr-not-skipping-parameterized-spec-setup/coverages.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[ ] |
Oops, something went wrong.