Skip to content

Commit

Permalink
rename use_test_level_visibility option to force_test_level_visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jan 22, 2024
1 parent 866e57c commit de5e205
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions lib/datadog/ci/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def activate_ci!(settings)
elsif can_use_evp_proxy?(settings, agent_settings)
test_visibility_transport = build_evp_proxy_transport(settings, agent_settings)
else
settings.ci.use_test_level_visibility = true
settings.ci.force_test_level_visibility = true
end

# Deactivate telemetry
Expand Down Expand Up @@ -72,7 +72,7 @@ def activate_ci!(settings)
settings.tracing.test_mode.writer_options = writer_options

@ci_recorder = TestVisibility::Recorder.new(
test_suite_level_visibility_enabled: !settings.ci.use_test_level_visibility
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility
)
end

Expand Down Expand Up @@ -119,7 +119,7 @@ def build_evp_proxy_transport(settings, agent_settings)
end

def serializers_factory(settings)
if settings.ci.use_test_level_visibility
if settings.ci.force_test_level_visibility
Datadog::CI::TestVisibility::Serializers::Factories::TestLevel
else
Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel
Expand Down
6 changes: 3 additions & 3 deletions lib/datadog/ci/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def self.add_settings!(base)
o.env CI::Ext::Settings::ENV_AGENTLESS_URL
end

option :use_test_level_visibility do |o|
option :force_test_level_visibility do |o|
o.type :bool
o.env CI::Ext::Settings::ENV_USE_TEST_LEVEL_VISIBILITY
o.env CI::Ext::Settings::ENV_FORCE_TEST_LEVEL_VISIBILITY
o.default false
end

Expand All @@ -49,7 +49,7 @@ def self.add_settings!(base)
Datadog::Core.log_deprecation do
"The experimental_test_suite_level_visibility_enabled setting has no effect and will be removed in 1.0. " \
"Test suite level visibility is now enabled by default. " \
"If you want to disable test suite level visibility set configuration.ci.use_test_level_visibility = true."
"If you want to disable test suite level visibility set configuration.ci.force_test_level_visibility = true."
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/ci/ext/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Settings
ENV_AGENTLESS_MODE_ENABLED = "DD_CIVISIBILITY_AGENTLESS_ENABLED"
ENV_AGENTLESS_URL = "DD_CIVISIBILITY_AGENTLESS_URL"
ENV_EXPERIMENTAL_TEST_SUITE_LEVEL_VISIBILITY_ENABLED = "DD_CIVISIBILITY_EXPERIMENTAL_TEST_SUITE_LEVEL_VISIBILITY_ENABLED"
ENV_USE_TEST_LEVEL_VISIBILITY = "DD_CIVISIBILITY_USE_TEST_LEVEL_VISIBILITY"
ENV_FORCE_TEST_LEVEL_VISIBILITY = "DD_CIVISIBILITY_FORCE_TEST_LEVEL_VISIBILITY"

# Source: https://docs.datadoghq.com/getting_started/site/
DD_SITE_ALLOWLIST = [
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/ci/ext/settings.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Datadog
ENV_AGENTLESS_MODE_ENABLED: String
ENV_AGENTLESS_URL: String
ENV_EXPERIMENTAL_TEST_SUITE_LEVEL_VISIBILITY_ENABLED: String
ENV_USE_TEST_LEVEL_VISIBILITY: String
ENV_FORCE_TEST_LEVEL_VISIBILITY: String

DD_SITE_ALLOWLIST: Array[String]
end
Expand Down
14 changes: 7 additions & 7 deletions spec/datadog/ci/configuration/components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
.and_return(agentless_enabled)

allow(settings.ci)
.to receive(:use_test_level_visibility)
.and_return(use_test_level_visibility)
.to receive(:force_test_level_visibility)
.and_return(force_test_level_visibility)

allow(settings.ci)
.to receive(:agentless_url)
Expand Down Expand Up @@ -85,7 +85,7 @@
.to receive(:enabled=)

allow(settings.ci)
.to receive(:use_test_level_visibility=)
.to receive(:force_test_level_visibility=)

allow(Datadog.logger)
.to receive(:warn)
Expand All @@ -103,7 +103,7 @@
let(:agentless_url) { nil }
let(:dd_site) { nil }
let(:agentless_enabled) { false }
let(:use_test_level_visibility) { false }
let(:force_test_level_visibility) { false }
let(:evp_proxy_supported) { false }

context "is enabled" do
Expand All @@ -113,7 +113,7 @@
expect(Datadog::CI::Ext::Environment).to have_received(:tags).with(ENV)
end

context "when #use_test_level_visibility" do
context "when #force_test_level_visibility" do
context "is false" do
it "creates a CI recorder with test_suite_level_visibility_enabled=true" do
expect(components.ci_recorder).to be_kind_of(Datadog::CI::TestVisibility::Recorder)
Expand All @@ -122,7 +122,7 @@
end

context "is true" do
let(:use_test_level_visibility) { true }
let(:force_test_level_visibility) { true }

it "creates a CI recorder with test_suite_level_visibility_enabled=false" do
expect(components.ci_recorder).to be_kind_of(Datadog::CI::TestVisibility::Recorder)
Expand Down Expand Up @@ -164,7 +164,7 @@
.with(settings.ci.trace_flush || kind_of(Datadog::CI::TestVisibility::Flush::Partial))

expect(settings.ci)
.to have_received(:use_test_level_visibility=)
.to have_received(:force_test_level_visibility=)
.with(true)

expect(settings.tracing.test_mode).to have_received(:writer_options=) do |options|
Expand Down
16 changes: 8 additions & 8 deletions spec/datadog/ci/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,17 @@ def patcher
end
end

describe "#use_test_level_visibility" do
subject(:use_test_level_visibility) do
settings.ci.use_test_level_visibility
describe "#force_test_level_visibility" do
subject(:force_test_level_visibility) do
settings.ci.force_test_level_visibility
end

it { is_expected.to be false }

context "when #{Datadog::CI::Ext::Settings::ENV_USE_TEST_LEVEL_VISIBILITY}" do
context "when #{Datadog::CI::Ext::Settings::ENV_FORCE_TEST_LEVEL_VISIBILITY}" do
around do |example|
ClimateControl.modify(
Datadog::CI::Ext::Settings::ENV_USE_TEST_LEVEL_VISIBILITY => enable
Datadog::CI::Ext::Settings::ENV_FORCE_TEST_LEVEL_VISIBILITY => enable
) do
example.run
end
Expand All @@ -208,10 +208,10 @@ def patcher
end
end

describe "#use_test_level_visibility=" do
describe "#force_test_level_visibility=" do
it "updates the #enabled setting" do
expect { settings.ci.use_test_level_visibility = true }
.to change { settings.ci.use_test_level_visibility }
expect { settings.ci.force_test_level_visibility = true }
.to change { settings.ci.force_test_level_visibility }
.from(false)
.to(true)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/ci/test_visibility/recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
let(:tags) { {"test.framework" => "my-framework", "my.tag" => "my_value"} }

include_context "CI mode activated" do
let(:use_test_level_visibility) { true }
let(:force_test_level_visibility) { true }
end

describe "#trace_test_session" do
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/ci_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@

context "when test suite level visibility is disabled" do
include_context "CI mode activated" do
let(:use_test_level_visibility) { true }
let(:force_test_level_visibility) { true }
let(:ci_enabled) { true }
end

Expand Down
4 changes: 2 additions & 2 deletions spec/support/ci_mode_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:integration_options) { {} }

let(:ci_enabled) { true }
let(:use_test_level_visibility) { false }
let(:force_test_level_visibility) { false }

let(:recorder) { Datadog.send(:components).ci_recorder }

Expand All @@ -17,7 +17,7 @@

Datadog.configure do |c|
c.ci.enabled = ci_enabled
c.ci.use_test_level_visibility = use_test_level_visibility
c.ci.force_test_level_visibility = force_test_level_visibility
unless integration_name == :no_instrument
c.ci.instrument integration_name, integration_options
end
Expand Down

0 comments on commit de5e205

Please sign in to comment.