Skip to content

Commit

Permalink
add additional tests to make sure that telemtry copunts skipped tests…
Browse files Browse the repository at this point in the history
… correctly
  • Loading branch information
anmarchenko committed Aug 28, 2024
1 parent 1da7397 commit c7117c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/datadog/ci/test_optimisation/component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@
expect { subject }
.not_to change { component.skipped_tests_count }
end

it_behaves_like "emits no metric", :inc, Datadog::CI::Ext::Telemetry::METRIC_ITR_SKIPPED
end

context "test is skipped by ITR" do
Expand Down Expand Up @@ -363,6 +365,8 @@
expect { subject }
.not_to change { component.skipped_tests_count }
end

it_behaves_like "emits no metric", :inc, Datadog::CI::Ext::Telemetry::METRIC_ITR_SKIPPED
end
end

Expand Down
9 changes: 9 additions & 0 deletions spec/support/contexts/telemetry_spy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def telemetry_spy_value_suffix(value)
end
end

shared_examples_for "emits no metric" do |metric_type, metric_name|
it "emits no :#{metric_type} metric #{metric_name}" do
subject

metric = telemetry_metric(metric_type, metric_name)
expect(metric).to be_nil
end
end

def telemetry_metric(type, name)
@metrics[type].find { |m| m.name == name }
end
Expand Down

0 comments on commit c7117c1

Please sign in to comment.