From b079c6f93f567e9e464fffd8fe2624d6760fc4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20Fern=C3=A1ndez=20de=20Alba?= Date: Mon, 23 Sep 2024 10:32:26 +0200 Subject: [PATCH] =?UTF-8?q?[test=20visibility]=C2=A0Remove=20beta=20flag?= =?UTF-8?q?=20from=20manual=20test=20API=20(#4705)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Romain Komorn <136473744+romainkomorndatadog@users.noreply.github.com> --- .../ci-visibility/test-api-manual/test.fake.js | 2 +- integration-tests/test-api-manual.spec.js | 9 ++++++--- packages/dd-trace/src/config.js | 8 ++++---- packages/dd-trace/test/config.spec.js | 10 +++++----- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/integration-tests/ci-visibility/test-api-manual/test.fake.js b/integration-tests/ci-visibility/test-api-manual/test.fake.js index 11f35dd8e87..a3256bc6f42 100644 --- a/integration-tests/ci-visibility/test-api-manual/test.fake.js +++ b/integration-tests/ci-visibility/test-api-manual/test.fake.js @@ -31,7 +31,7 @@ describe('can run tests', () => { }) test('integration test', () => { // Just for testing purposes, so we don't create a custom span - if (!process.env.DD_CIVISIBILITY_MANUAL_API_ENABLED) { + if (process.env.DD_CIVISIBILITY_MANUAL_API_ENABLED === 'false') { return Promise.resolve() } const testSpan = tracer.scope().active() diff --git a/integration-tests/test-api-manual.spec.js b/integration-tests/test-api-manual.spec.js index 8335745e2a6..419c7c736c5 100644 --- a/integration-tests/test-api-manual.spec.js +++ b/integration-tests/test-api-manual.spec.js @@ -73,7 +73,7 @@ describe('test-api-manual', () => { '--require ./ci-visibility/test-api-manual/test.fake.js ./ci-visibility/test-api-manual/run-fake-test-framework', { cwd, - env: { ...getCiVisAgentlessConfig(receiver.port), DD_CIVISIBILITY_MANUAL_API_ENABLED: '1' }, + env: getCiVisAgentlessConfig(receiver.port), stdio: 'pipe' } ) @@ -82,7 +82,7 @@ describe('test-api-manual', () => { }) }) - it('does not report test spans if DD_CIVISIBILITY_MANUAL_API_ENABLED is not set', (done) => { + it('does not report test spans if DD_CIVISIBILITY_MANUAL_API_ENABLED is set to false', (done) => { receiver.assertPayloadReceived(() => { const error = new Error('should not report spans') done(error) @@ -93,7 +93,10 @@ describe('test-api-manual', () => { '--require ./ci-visibility/test-api-manual/test.fake.js ./ci-visibility/test-api-manual/run-fake-test-framework', { cwd, - env: getCiVisAgentlessConfig(receiver.port), + env: { + ...getCiVisAgentlessConfig(receiver.port), + DD_CIVISIBILITY_MANUAL_API_ENABLED: 'false' + }, stdio: 'pipe' } ) diff --git a/packages/dd-trace/src/config.js b/packages/dd-trace/src/config.js index e664dcb99b2..dc5bb524d1a 100644 --- a/packages/dd-trace/src/config.js +++ b/packages/dd-trace/src/config.js @@ -1003,10 +1003,10 @@ class Config { } _isCiVisibilityManualApiEnabled () { - return isTrue(coalesce( + return coalesce( process.env.DD_CIVISIBILITY_MANUAL_API_ENABLED, - false - )) + true + ) } _isTraceStatsComputationEnabled () { @@ -1050,7 +1050,7 @@ class Config { coalesce(DD_CIVISIBILITY_FLAKY_RETRY_ENABLED, true)) this._setValue(calc, 'flakyTestRetriesCount', coalesce(maybeInt(DD_CIVISIBILITY_FLAKY_RETRY_COUNT), 5)) this._setBoolean(calc, 'isIntelligentTestRunnerEnabled', isTrue(this._isCiVisibilityItrEnabled())) - this._setBoolean(calc, 'isManualApiEnabled', this._isCiVisibilityManualApiEnabled()) + this._setBoolean(calc, 'isManualApiEnabled', !isFalse(this._isCiVisibilityManualApiEnabled())) this._setString(calc, 'ciVisibilityTestSessionName', DD_TEST_SESSION_NAME) } this._setString(calc, 'dogstatsd.hostname', this._getHostname()) diff --git a/packages/dd-trace/test/config.spec.js b/packages/dd-trace/test/config.spec.js index 2b0aefbd1b7..ca4d8b142d3 100644 --- a/packages/dd-trace/test/config.spec.js +++ b/packages/dd-trace/test/config.spec.js @@ -1835,14 +1835,14 @@ describe('Config', () => { const config = new Config(options) expect(config).to.have.property('isIntelligentTestRunnerEnabled', false) }) - it('should disable manual testing API by default', () => { + it('should enable manual testing API by default', () => { const config = new Config(options) - expect(config).to.have.property('isManualApiEnabled', false) + expect(config).to.have.property('isManualApiEnabled', true) }) - it('should enable manual testing API if DD_CIVISIBILITY_MANUAL_API_ENABLED is passed', () => { - process.env.DD_CIVISIBILITY_MANUAL_API_ENABLED = 'true' + it('should disable manual testing API if DD_CIVISIBILITY_MANUAL_API_ENABLED is set to false', () => { + process.env.DD_CIVISIBILITY_MANUAL_API_ENABLED = 'false' const config = new Config(options) - expect(config).to.have.property('isManualApiEnabled', true) + expect(config).to.have.property('isManualApiEnabled', false) }) it('should disable memcached command tagging by default', () => { const config = new Config(options)