Skip to content

Commit

Permalink
configure test visibility transport with correct serializers factory …
Browse files Browse the repository at this point in the history
…based on settings
  • Loading branch information
anmarchenko committed Nov 23, 2023
1 parent a0c4ecd commit 16e6c10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions lib/datadog/ci/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require_relative "../ext/transport"
require_relative "../test_visibility/flush"
require_relative "../test_visibility/transport"
require_relative "../test_visibility/serializers/factories/test_level"
require_relative "../test_visibility/serializers/factories/test_suite_level"
require_relative "../transport/api/builder"
require_relative "../recorder"

Expand Down Expand Up @@ -87,6 +89,7 @@ def build_agentless_transport(settings)

Datadog::CI::TestVisibility::Transport.new(
api: Transport::Api::Builder.build_ci_test_cycle_api(settings),
serializers_factory: serializers_factory(settings),
dd_env: settings.env
)
end
Expand All @@ -97,9 +100,18 @@ def build_evp_proxy_transport(settings, agent_settings)

Datadog::CI::TestVisibility::Transport.new(
api: Transport::Api::Builder.build_evp_proxy_api(agent_settings),
serializers_factory: serializers_factory(settings),
dd_env: settings.env
)
end

def serializers_factory(settings)
if settings.ci.experimental_test_suite_level_visibility_enabled
Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel
else
Datadog::CI::TestVisibility::Serializers::Factories::TestLevel
end
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions sig/datadog/ci/configuration/components.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Datadog
def build_agentless_transport: (untyped settings) -> Datadog::CI::TestVisibility::Transport?
def build_evp_proxy_transport: (untyped settings, untyped agent_settings) -> Datadog::CI::TestVisibility::Transport
def can_use_evp_proxy?: (untyped settings, untyped agent_settings) -> bool
def serializers_factory: (untyped settings) -> (singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel) | singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel))
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions sig/datadog/ci/test_visibility/transport.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ module Datadog
class Transport
DEFAULT_MAX_PAYLOAD_SIZE: Integer

attr_reader serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel)
attr_reader serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel) | singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel)
attr_reader dd_env: String?
attr_reader api: Datadog::CI::Transport::Api::Base
attr_reader max_payload_size: Integer

@dd_env: String?
@serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel)
@serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel) | singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel)
@max_payload_size: Integer

def initialize: (
api: Datadog::CI::Transport::Api::Base,
?dd_env: ::String?,
?serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel),
?serializers_factory: singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestLevel) | singleton(Datadog::CI::TestVisibility::Serializers::Factories::TestSuiteLevel),
?max_payload_size: Integer
) -> void

Expand Down

0 comments on commit 16e6c10

Please sign in to comment.