From eeec189f0a9ead02f616c70a9ea4f42527ae5754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 19 Mar 2024 11:51:01 +0100 Subject: [PATCH] [ci-visibility] Rename early flake detection retry tag (#4161) --- integration-tests/ci-visibility.spec.js | 14 +++++++------- integration-tests/cucumber/cucumber.spec.js | 4 ++-- integration-tests/cypress/cypress.spec.js | 4 ++-- packages/datadog-plugin-cucumber/src/index.js | 4 ++-- .../datadog-plugin-cypress/src/cypress-plugin.js | 4 ++-- packages/datadog-plugin-jest/src/index.js | 4 ++-- packages/datadog-plugin-mocha/src/index.js | 4 ++-- packages/dd-trace/src/plugins/util/test.js | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/integration-tests/ci-visibility.spec.js b/integration-tests/ci-visibility.spec.js index 15fdb903536..d765d92029c 100644 --- a/integration-tests/ci-visibility.spec.js +++ b/integration-tests/ci-visibility.spec.js @@ -27,7 +27,7 @@ const { TEST_ITR_FORCED_RUN, TEST_SOURCE_FILE, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED, TEST_NAME, JEST_DISPLAY_NAME @@ -688,7 +688,7 @@ testFrameworks.forEach(({ newTests.forEach(test => { assert.propertyVal(test.meta, TEST_IS_NEW, 'true') }) - const retriedTests = newTests.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true') + const retriedTests = newTests.filter(test => test.meta[TEST_IS_RETRY] === 'true') // all but one has been retried assert.equal( newTests.length - 1, @@ -777,12 +777,12 @@ testFrameworks.forEach(({ // all but one have been retried assert.equal( testsForFirstParameter.length - 1, - testsForFirstParameter.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true').length + testsForFirstParameter.filter(test => test.meta[TEST_IS_RETRY] === 'true').length ) assert.equal( testsForSecondParameter.length - 1, - testsForSecondParameter.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true').length + testsForSecondParameter.filter(test => test.meta[TEST_IS_RETRY] === 'true').length ) }) @@ -903,7 +903,7 @@ testFrameworks.forEach(({ const tests = events.filter(event => event.type === 'test').map(event => event.content) - const retriedTests = tests.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true') + const retriedTests = tests.filter(test => test.meta[TEST_IS_RETRY] === 'true') // all but one has been retried assert.equal( tests.length - 1, @@ -979,14 +979,14 @@ testFrameworks.forEach(({ test => test.meta[TEST_NAME] === 'ci visibility skip will not be retried' ) assert.equal(newSkippedTests.length, 1) - assert.notProperty(newSkippedTests[0].meta, TEST_EARLY_FLAKE_IS_RETRY) + assert.notProperty(newSkippedTests[0].meta, TEST_IS_RETRY) if (name === 'jest') { const newTodoTests = tests.filter( test => test.meta[TEST_NAME] === 'ci visibility todo will not be retried' ) assert.equal(newTodoTests.length, 1) - assert.notProperty(newTodoTests[0].meta, TEST_EARLY_FLAKE_IS_RETRY) + assert.notProperty(newTodoTests[0].meta, TEST_IS_RETRY) } }) diff --git a/integration-tests/cucumber/cucumber.spec.js b/integration-tests/cucumber/cucumber.spec.js index 3c06fd404cc..897ef7e18f9 100644 --- a/integration-tests/cucumber/cucumber.spec.js +++ b/integration-tests/cucumber/cucumber.spec.js @@ -29,7 +29,7 @@ const { TEST_SOURCE_FILE, TEST_EARLY_FLAKE_IS_ENABLED, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_NAME } = require('../../packages/dd-trace/src/plugins/util/test') @@ -818,7 +818,7 @@ versions.forEach(version => { newTests.forEach(test => { assert.propertyVal(test.meta, TEST_IS_NEW, 'true') }) - const retriedTests = newTests.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true') + const retriedTests = newTests.filter(test => test.meta[TEST_IS_RETRY] === 'true') // all but one has been retried assert.equal( newTests.length - 1, diff --git a/integration-tests/cypress/cypress.spec.js b/integration-tests/cypress/cypress.spec.js index 4a0c993a219..1a94c6f8185 100644 --- a/integration-tests/cypress/cypress.spec.js +++ b/integration-tests/cypress/cypress.spec.js @@ -29,7 +29,7 @@ const { TEST_ITR_FORCED_RUN, TEST_SOURCE_FILE, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED } = require('../../packages/dd-trace/src/plugins/util/test') const { ERROR_MESSAGE } = require('../../packages/dd-trace/src/constants') @@ -939,7 +939,7 @@ moduleType.forEach(({ const newTests = tests.filter(test => test.meta[TEST_IS_NEW] === 'true') assert.equal(newTests.length, NUM_RETRIES_EFD + 1) - const retriedTests = tests.filter(test => test.meta[TEST_EARLY_FLAKE_IS_RETRY] === 'true') + const retriedTests = tests.filter(test => test.meta[TEST_IS_RETRY] === 'true') assert.equal(retriedTests.length, NUM_RETRIES_EFD) newTests.forEach(newTest => { diff --git a/packages/datadog-plugin-cucumber/src/index.js b/packages/datadog-plugin-cucumber/src/index.js index 516820ae1aa..d7d74c5161c 100644 --- a/packages/datadog-plugin-cucumber/src/index.js +++ b/packages/datadog-plugin-cucumber/src/index.js @@ -18,7 +18,7 @@ const { TEST_SOURCE_FILE, TEST_EARLY_FLAKE_IS_ENABLED, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY + TEST_IS_RETRY } = require('../../dd-trace/src/plugins/util/test') const { RESOURCE_NAME } = require('../../../ext/tags') const { COMPONENT, ERROR_MESSAGE } = require('../../dd-trace/src/constants') @@ -181,7 +181,7 @@ class CucumberPlugin extends CiPlugin { if (isNew) { span.setTag(TEST_IS_NEW, 'true') if (isEfdRetry) { - span.setTag(TEST_EARLY_FLAKE_IS_RETRY, 'true') + span.setTag(TEST_IS_RETRY, 'true') } } diff --git a/packages/datadog-plugin-cypress/src/cypress-plugin.js b/packages/datadog-plugin-cypress/src/cypress-plugin.js index 204670ec46a..f6ef2ad1c5e 100644 --- a/packages/datadog-plugin-cypress/src/cypress-plugin.js +++ b/packages/datadog-plugin-cypress/src/cypress-plugin.js @@ -27,7 +27,7 @@ const { ITR_CORRELATION_ID, TEST_SOURCE_FILE, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED } = require('../../dd-trace/src/plugins/util/test') const { isMarkedAsUnskippable } = require('../../datadog-plugin-jest/src/util') @@ -592,7 +592,7 @@ class CypressPlugin { if (isNew) { this.activeTestSpan.setTag(TEST_IS_NEW, 'true') if (isEfdRetry) { - this.activeTestSpan.setTag(TEST_EARLY_FLAKE_IS_RETRY, 'true') + this.activeTestSpan.setTag(TEST_IS_RETRY, 'true') } } const finishedTest = { diff --git a/packages/datadog-plugin-jest/src/index.js b/packages/datadog-plugin-jest/src/index.js index 8e1422ede51..df5c940f60e 100644 --- a/packages/datadog-plugin-jest/src/index.js +++ b/packages/datadog-plugin-jest/src/index.js @@ -17,7 +17,7 @@ const { ITR_CORRELATION_ID, TEST_SOURCE_FILE, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED, JEST_DISPLAY_NAME } = require('../../dd-trace/src/plugins/util/test') @@ -339,7 +339,7 @@ class JestPlugin extends CiPlugin { if (isNew) { extraTags[TEST_IS_NEW] = 'true' if (isEfdRetry) { - extraTags[TEST_EARLY_FLAKE_IS_RETRY] = 'true' + extraTags[TEST_IS_RETRY] = 'true' } } diff --git a/packages/datadog-plugin-mocha/src/index.js b/packages/datadog-plugin-mocha/src/index.js index 1e445745947..5c2e98c08bb 100644 --- a/packages/datadog-plugin-mocha/src/index.js +++ b/packages/datadog-plugin-mocha/src/index.js @@ -19,7 +19,7 @@ const { TEST_SOURCE_FILE, removeEfdStringFromTestName, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED } = require('../../dd-trace/src/plugins/util/test') const { COMPONENT } = require('../../dd-trace/src/constants') @@ -270,7 +270,7 @@ class MochaPlugin extends CiPlugin { if (isNew) { extraTags[TEST_IS_NEW] = 'true' if (isEfdRetry) { - extraTags[TEST_EARLY_FLAKE_IS_RETRY] = 'true' + extraTags[TEST_IS_RETRY] = 'true' } } diff --git a/packages/dd-trace/src/plugins/util/test.js b/packages/dd-trace/src/plugins/util/test.js index cc2f3237898..7f74e6444b7 100644 --- a/packages/dd-trace/src/plugins/util/test.js +++ b/packages/dd-trace/src/plugins/util/test.js @@ -52,7 +52,7 @@ const TEST_SKIPPED_BY_ITR = 'test.skipped_by_itr' const TEST_CONFIGURATION_BROWSER_NAME = 'test.configuration.browser_name' // Early flake detection const TEST_IS_NEW = 'test.is_new' -const TEST_EARLY_FLAKE_IS_RETRY = 'test.early_flake.is_retry' +const TEST_IS_RETRY = 'test.is_retry' const TEST_EARLY_FLAKE_IS_ENABLED = 'test.early_flake.is_enabled' const CI_APP_ORIGIN = 'ciapp-test' @@ -101,7 +101,7 @@ module.exports = { TEST_SKIPPED_BY_ITR, TEST_CONFIGURATION_BROWSER_NAME, TEST_IS_NEW, - TEST_EARLY_FLAKE_IS_RETRY, + TEST_IS_RETRY, TEST_EARLY_FLAKE_IS_ENABLED, getTestEnvironmentMetadata, getTestParametersString,