Skip to content

Commit

Permalink
rename ApiClient to RemoteSettingsApi
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Mar 5, 2024
1 parent c52453e commit 04be43d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
5 changes: 3 additions & 2 deletions lib/datadog/ci/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require_relative "../test_visibility/serializers/factories/test_suite_level"
require_relative "../test_visibility/transport"
require_relative "../transport/api/builder"
require_relative "../transport/remote_settings_api"

module Datadog
module CI
Expand Down Expand Up @@ -74,7 +75,7 @@ def activate_ci!(settings)
enabled: settings.ci.enabled && settings.ci.itr_enabled
)

api_client = Transport::ApiClient.new(
remote_settings_api = Transport::RemoteSettingsApi.new(
api: test_visibility_api,
dd_env: settings.env
)
Expand All @@ -83,7 +84,7 @@ def activate_ci!(settings)
@ci_recorder = TestVisibility::Recorder.new(
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility,
itr: itr,
api_client: api_client
remote_settings_api: remote_settings_api
)
end

Expand Down
7 changes: 3 additions & 4 deletions lib/datadog/ci/test_visibility/recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require_relative "../ext/app_types"
require_relative "../ext/test"
require_relative "../ext/environment"
require_relative "../transport/api_client"
require_relative "../utils/git"

require_relative "../span"
Expand All @@ -30,7 +29,7 @@ class Recorder
attr_reader :environment_tags, :test_suite_level_visibility_enabled

def initialize(
itr:, api_client:, test_suite_level_visibility_enabled: false,
itr:, remote_settings_api:, test_suite_level_visibility_enabled: false,
codeowners: Codeowners::Parser.new(Utils::Git.root).parse
)
@test_suite_level_visibility_enabled = test_suite_level_visibility_enabled
Expand All @@ -42,7 +41,7 @@ def initialize(
@codeowners = codeowners

@itr = itr
@api_client = api_client
@remote_settings_api = remote_settings_api
end

def start_test_session(service: nil, tags: {})
Expand Down Expand Up @@ -194,7 +193,7 @@ def configure_library(test_session)
# this will change when EFD is implemented
return unless itr_enabled?

remote_configuration = @api_client.fetch_library_settings(test_session)
remote_configuration = @remote_settings_api.fetch_library_settings(test_session)
@itr.configure(remote_configuration.payload)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ module CI
module Transport
# Datadog API client
# Calls settings endpoint to fetch library settings for given service and env
#
# TODO: Rename ApiClient to SettingsApiClient
class ApiClient
class RemoteSettingsApi
class Response
def initialize(http_response)
@http_response = http_response
Expand Down
4 changes: 2 additions & 2 deletions sig/datadog/ci/test_visibility/recorder.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module Datadog
@local_context: Datadog::CI::TestVisibility::Context::Local
@global_context: Datadog::CI::TestVisibility::Context::Global
@itr: Datadog::CI::ITR::Runner
@api_client: Datadog::CI::Transport::ApiClient
@remote_settings_api: Datadog::CI::Transport::RemoteSettingsApi
@codeowners: Datadog::CI::Codeowners::Matcher

attr_reader environment_tags: Hash[String, String]
attr_reader test_suite_level_visibility_enabled: bool

def initialize: (?test_suite_level_visibility_enabled: bool, ?codeowners: Datadog::CI::Codeowners::Matcher, itr: Datadog::CI::ITR::Runner, api_client: Datadog::CI::Transport::ApiClient) -> void
def initialize: (?test_suite_level_visibility_enabled: bool, ?codeowners: Datadog::CI::Codeowners::Matcher, itr: Datadog::CI::ITR::Runner, remote_settings_api: Datadog::CI::Transport::RemoteSettingsApi) -> void

def trace_test: (String span_name, String test_suite_name, ?service: String?, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Test span) -> untyped } -> untyped

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Datadog
module CI
module Transport
class ApiClient
class RemoteSettingsApi
class Response
@http_response: Datadog::Core::Transport::HTTP::Adapters::Net::Response?
@json: Hash[String, untyped]?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "../../../../lib/datadog/ci/transport/api_client"
require_relative "../../../../lib/datadog/ci/transport/remote_settings_api"

RSpec.describe Datadog::CI::Transport::ApiClient do
RSpec.describe Datadog::CI::Transport::RemoteSettingsApi do
let(:api) { spy("api") }
let(:dd_env) { "ci" }

Expand Down

0 comments on commit 04be43d

Please sign in to comment.