Skip to content

Commit

Permalink
rename TestRun.test_full_name to TestRun.skippable_test_id
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Apr 22, 2024
1 parent e31a740 commit b26de0f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/ci/itr/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def stop_coverage(test)
def mark_if_skippable(test)
return if !enabled? || !skipping_tests?

skippable_test_id = Utils::TestRun.test_full_name(test.name, test.test_suite_name, test.parameters)
skippable_test_id = Utils::TestRun.skippable_test_id(test.name, test.test_suite_name, test.parameters)
if @skippable_tests.include?(skippable_test_id)
test.set_tag(Ext::Test::TAG_ITR_SKIPPED_BY_ITR, "true")

Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/ci/itr/skippable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def tests
next unless test_data["type"] == Ext::Test::ITR_TEST_SKIPPING_MODE

attrs = test_data["attributes"] || {}
res << Utils::TestRun.test_full_name(attrs["name"], attrs["suite"], attrs["parameters"])
res << Utils::TestRun.skippable_test_id(attrs["name"], attrs["suite"], attrs["parameters"])
end

res
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/ci/utils/test_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.command
@command = "#{$0} #{ARGV.join(" ")}"
end

def self.test_full_name(test_name, suite, parameters = nil)
def self.skippable_test_id(test_name, suite, parameters = nil)
"#{suite}.#{test_name}.#{parameters}"
end

Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/ci/utils/test_run.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Datadog

def self.command: () -> String

def self.test_full_name: (String test_name, String? test_suite, ?String? parameters) -> String
def self.skippable_test_id: (String test_name, String? test_suite, ?String? parameters) -> String

def self.test_parameters: (?arguments: Hash[untyped, untyped], ?metadata: Hash[untyped, untyped]) -> String
end
Expand Down
28 changes: 28 additions & 0 deletions spec/datadog/ci/utils/test_run_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,32 @@

it { is_expected.to eq("#{$0} #{ARGV.join(" ")}") }
end

describe ".skippable_test_id" do
subject { described_class.skippable_test_id(test_name, suite, parameters) }

let(:test_name) { "test_name" }
let(:suite) { "suite" }
let(:parameters) { "parameters" }

it { is_expected.to eq("suite.test_name.parameters") }
end

describe ".test_parameters" do
subject { described_class.test_parameters(arguments: arguments, metadata: metadata) }

let(:arguments) { {} }
let(:metadata) { {} }

it "returns a JSON string" do
is_expected.to eq(
JSON.generate(
{
arguments: arguments,
metadata: metadata
}
)
)
end
end
end

0 comments on commit b26de0f

Please sign in to comment.