Skip to content

Commit

Permalink
Merge pull request #87 from DataDog/anmarchenko/do_not_validate_envir…
Browse files Browse the repository at this point in the history
…onment_when_ci_disabled

do not collect environment tags when CI is not enabled
  • Loading branch information
anmarchenko authored Dec 11, 2023
2 parents a6e08e2 + 0802d17 commit d41ab75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/datadog/ci/test_visibility/recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def initialize(enabled: true, test_suite_level_visibility_enabled: false)
@enabled = enabled
@test_suite_level_visibility_enabled = enabled && test_suite_level_visibility_enabled

@environment_tags = Ext::Environment.tags(ENV).freeze
@environment_tags = @enabled ? Ext::Environment.tags(ENV).freeze : {}
@local_context = Context::Local.new
@global_context = Context::Global.new
end
Expand Down
15 changes: 15 additions & 0 deletions spec/datadog/ci/test_visibility/recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@
let(:ci_enabled) { false }
end

describe "#initialize" do
subject do
described_class.new(
enabled: ci_enabled,
test_suite_level_visibility_enabled: experimental_test_suite_level_visibility_enabled
)
end

it "doesn't collect environment tags" do
expect(Datadog::CI::Ext::Environment).not_to receive(:tags)

subject
end
end

describe "#trace_test" do
context "when given a block" do
let(:spy_under_test) { spy("spy") }
Expand Down

0 comments on commit d41ab75

Please sign in to comment.