Skip to content

Commit

Permalink
add itr_skippable_tests.response_tests metric
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jul 29, 2024
1 parent 668b820 commit b67a64f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/datadog/ci/test_optimisation/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
require "datadog/core/utils/forking"

require_relative "../ext/test"
require_relative "../ext/telemetry"
require_relative "../ext/transport"

require_relative "../git/local_repository"

require_relative "../utils/parsing"
require_relative "../utils/telemetry"

require_relative "coverage/event"
require_relative "skippable"
Expand Down Expand Up @@ -239,6 +241,8 @@ def fetch_skippable_tests(test_session:, git_tree_upload_worker:)
Datadog.logger.debug { "Fetched skippable tests: \n #{@skippable_tests}" }
Datadog.logger.debug { "Found #{@skippable_tests.count} skippable tests." }
Datadog.logger.debug { "ITR correlation ID: #{@correlation_id}" }

Utils::Telemetry.inc(Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS, @skippable_tests.count)
end

def code_coverage_mode
Expand Down
3 changes: 3 additions & 0 deletions lib/datadog/ci/test_optimisation/skippable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

require "json"

require_relative "../ext/telemetry"
require_relative "../ext/transport"
require_relative "../ext/test"
require_relative "../transport/telemetry"
require_relative "../utils/test_run"
require_relative "../utils/telemetry"

module Datadog
module CI
Expand Down
6 changes: 4 additions & 2 deletions spec/datadog/ci/test_optimisation/component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
fetch_skippable_tests: instance_double(
Datadog::CI::TestOptimisation::Skippable::Response,
correlation_id: "42",
tests: Set.new(["suite.test."])
tests: Set.new(["suite.test.", "suite.test2."])
)
)
end
Expand All @@ -79,10 +79,12 @@
expect(component.skipping_tests?).to be true

expect(component.correlation_id).to eq("42")
expect(component.skippable_tests).to eq(Set.new(["suite.test."]))
expect(component.skippable_tests).to eq(Set.new(["suite.test.", "suite.test2."]))

expect(git_worker).to have_received(:wait_until_done)
end

it_behaves_like "emits telemetry metric", :inc, "itr_skippable_tests.response_tests", 2
end

context "when remote configuration call returned correct response with strings instead of bools" do
Expand Down

0 comments on commit b67a64f

Please sign in to comment.