10000 Implement attempt to fix v3 and v4 and bump capability version (#8824) · DataDog/dd-trace-java@4ab4ee3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ab4ee3

Browse files
Implement attempt to fix v3 and v4 and bump capability version (#8824)
1 parent 872388f commit 4ab4ee3

File tree

56 files changed

+99
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+99
-62
lines changed

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/config/ConfigurationApiImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ public Map<TestSetting, Map<String, Collection<TestFQN>>> getTestManagementTests
344344
new TestManagementDto(
345345
tracerEnvironment.getRepositoryUrl(),
346346
tracerEnvironment.getCommitMessage(),
347-
tracerEnvironment.getConfigurations().getTestBundle())));
347+
tracerEnvironment.getConfigurations().getTestBundle(),
348+
tracerEnvironment.getSha())));
348349
String json = testManagementRequestAdapter.toJson(request);
349350
RequestBody requestBody = RequestBody.create(JSON, json);
350351
TestManagementTestsDto testManagementTestsDto =
@@ -542,11 +543,14 @@ private static final class TestManagementDto {
542543
private final String commitMessage;
543544

544545
private final String module;
546+
private final String sha;
545547

546-
private TestManagementDto(String repositoryUrl, String commitMessage, String module) {
548+
private TestManagementDto(
549+
String repositoryUrl, String commitMessage, String module, String sha) {
547550
this.repositoryUrl = repositoryUrl;
548551
this.commitMessage = commitMessage;
549552
this.module = module;
553+
this.sha = sha;
550554
}
551555
}
552556

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,12 @@ public void onTestFinish(
262262

263263
if (testExecutionHistory.hasFailedAllRetries()) {
264264
test.setTag(Tags.TEST_HAS_FAILED_ALL_RETRIES, true);
265-
} else if (testExecutionHistory.hasSucceededAllRetries()
266-
&& testModule.isAttemptToFix(thisTest)) {
267-
test.setTag(Tags.TEST_TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED, true);
265+
}
266+
267+
if (testExecutionHistory.wasLastExecution() && testModule.isAttemptToFix(thisTest)) {
268+
test.setTag(
269+
Tags.TEST_TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED,
270+
testExecutionHistory.hasSucceededAllRetries());
268271
}
269272
}
270273

dd-java-agent/agent-ci-visibility/src/test/resources/datadog/trace/civisibility/config/test-management-tests-request.ftl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"id" : "${uid}",
55
"attributes": {
66
"repository_url" : "${tracerEnvironment.repositoryUrl}",
7-
"commit_message" : "${tracerEnvironment.commitMessage}"
7+
"commit_message" : "${tracerEnvironment.commitMessage}",
8+
"sha" : "${tracerEnvironment.sha}"
89
}
910
}
1011
}

dd-java-agent/agent-ci-visibility/src/testFixtures/groovy/datadog/trace/civisibility/CiVisibilitySmokeTest.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import datadog.trace.api.civisibility.config.TestFQN
44
import spock.lang.Specification
55

66
abstract class CiVisibilitySmokeTest extends Specification {
7+
static final List<String> SMOKE_IGNORED_TAGS = ["content.meta.['_dd.integration']"]
78

89
protected verifyEventsAndCoverages(String projectName, String toolchain, String toolchainVersion, List<Map<String, Object>> events, List<Map<String, Object>> coverages) {
910
def additionalReplacements = ["content.meta.['test.toolchain']": "$toolchain:$toolchainVersion"]
1011

1112
if (System.getenv().get("GENERATE_TEST_FIXTURES") != null) {
1213
def baseTemplatesPath = CiVisibilitySmokeTest.classLoader.getResource(projectName).toURI().schemeSpecificPart.replace('build/resources/test', 'src/test/resources')
13-
CiVisibilityTestUtils.generateTemplates(baseTemplatesPath, events, coverages, additionalReplacements)
14+
CiVisibilityTestUtils.generateTemplates(baseTemplatesPath, events, coverages, additionalReplacements, SMOKE_IGNORED_TAGS)
1415
} else {
15-
CiVisibilityTestUtils.assertData(projectName, events, coverages, additionalReplacements,["content.meta.['_dd.integration']"])
16+
CiVisibilityTestUtils.assertData(projectName, events, coverages, additionalReplacements, SMOKE_IGNORED_TAGS)
1617
}
1718
}
1819

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-attempt-to-fix-disabled-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254
"test.retry_reason" : "attempt_to_fix",
255255
"test.status" : "fail",
256256
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
257+
"test.test_management.attempt_to_fix_passed" : "false",
257258
"test.test_management.is_attempt_to_fix" : "true",
258259
"test.test_management.is_test_disabled" : "true",
259260
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-attempt-to-fix-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
"test.retry_reason" : "attempt_to_fix",
251251
"test.status" : "fail",
252252
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
253+
"test.test_management.attempt_to_fix_passed" : "false",
253254
"test.test_management.is_attempt_to_fix" : "true",
254255
"test.traits" : "{\"category\":[\"foo\"]}",
255256
"test.type" : "test",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-attempt-to-fix-quarantined-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254
"test.retry_reason" : "attempt_to_fix",
255255
"test.status" : "fail",
256256
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
257+
"test.test_management.attempt_to_fix_passed" : "false",
257258
"test.test_management.is_attempt_to_fix" : "true",
258259
"test.test_management.is_quarantined" : "true",
259260
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-attempt-to-fix-disabled-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@
336336
"test.source.file" : "dummy_source_path",
337337
"test.status" : "fail",
338338
"test.suite" : "org.example.TestFailedMUnit",
339+
"test.test_management.attempt_to_fix_passed" : "false",
339340
"test.test_management.is_attempt_to_fix" : "true",
340341
"test.test_management.is_test_disabled" : "true",
341342
"test.traits" : "{\"category\":[\"myTag\"]}",

dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-attempt-to-fix-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@
332332
"test.source.file" : "dummy_source_path",
333333
"test.status" : "fail",
334334
"test.suite" : "org.example.TestFailedMUnit",
335+
"test.test_management.attempt_to_fix_passed" : "false",
335336
"test.test_management.is_attempt_to_fix" : "true",
336337
"test.traits" : "{\"category\":[\"myTag\"]}",
337338
"test.type" : "test",

dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-attempt-to-fix-quarantined-failed/events.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@
336336
"test.source.file" : "dummy_source_path",
337337
"test.status" : "fail",
338338
"test.suite" : "org.example.TestFailedMUnit",
339+
"test.test_management.attempt_to_fix_passed" : "false",
339340
"test.test_management.is_attempt_to_fix" : "true",
340341
"test.test_management.is_quarantined" : "true",
341342
"test.traits" : "{\"category\":[\"myTag\"]}",

0 commit comments

Comments
 (0)
0