Skip to content

Commit

Permalink
add ITR::Runner class
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Feb 29, 2024
1 parent 45d5d79 commit 1169f66
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/datadog/ci/itr/runner.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module Datadog
module CI
module ITR
# Intelligent test runner implementation
# Integrates with backend to provide test impact analysis data and
# skip tests that are not impacted by the changes
class Runner
def initialize(
enabled: false
)
@enabled = enabled
end

def enabled?
@enabled
end

def configure
return unless enabled?

Datadog.logger.debug("Sending ITR settings request...")
end
end
end
end
end
15 changes: 15 additions & 0 deletions sig/datadog/ci/itr/runner.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Datadog
module CI
module ITR
class Runner
@enabled: bool

def initialize: (?enabled: bool) -> void

def enabled?: () -> bool

def configure: () -> void
end
end
end
end
28 changes: 28 additions & 0 deletions spec/datadog/ci/itr/runner_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

require_relative "../../../../lib/datadog/ci/itr/runner"

RSpec.describe Datadog::CI::ITR::Runner do
let(:itr_enabled) { true }
subject(:runner) { described_class.new(enabled: itr_enabled) }

describe "#configure" do
context "itr enabled" do
before do
expect(Datadog.logger).to receive(:debug).with("Sending ITR settings request...")
end

it { runner.configure }
end

context "itr disabled" do
let(:itr_enabled) { false }

before do
expect(Datadog.logger).to_not receive(:debug).with("Sending ITR settings request...")
end

it { runner.configure }
end
end
end
4 changes: 4 additions & 0 deletions spec/datadog/ci/test_visibility/recorder_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# frozen_string_literal: true

require_relative "../../../../lib/datadog/ci/test_visibility/recorder"

RSpec.describe Datadog::CI::TestVisibility::Recorder do
shared_examples_for "trace with ciapp-test origin" do
let(:trace_under_test) { subject }
Expand Down

0 comments on commit 1169f66

Please sign in to comment.