Skip to content

Commit

Permalink
spec for Api::Builder.build_evp_proxy_api
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Oct 17, 2023
1 parent c4322bc commit 3093c0c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions spec/datadog/ci/transport/api/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,30 @@
end
end
end

describe ".build_evp_proxy_api" do
subject { described_class.build_evp_proxy_api(agent_settings) }

let(:agent_settings) do
Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings.new(
adapter: nil,
ssl: false,
hostname: "localhost",
port: 5555,
uds_path: nil,
timeout_seconds: 42,
deprecated_for_removal_transport_configuration_proc: nil
)
end

it "creates EVPProxy" do
expect(Datadog::CI::Transport::Api::EVPProxy).to receive(:new).with(
host: "localhost",
port: 5555,
ssl: false,
timeout: 42
)
subject
end
end
end
4 changes: 2 additions & 2 deletions spec/datadog/ci/transport/api/evp_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
context "without container id" do
let(:container_id) { nil }

it "produces correct headers and forwards request to HTTP layer" do
it "produces correct headers and forwards request to HTTP layer prepending path with evp_proxy" do
expect(http).to receive(:request).with(
path: "/evp_proxy/v2/path",
payload: "payload",
Expand All @@ -58,7 +58,7 @@
context "with container id" do
let(:container_id) { "container-id" }

it "produces correct headers and forwards request to HTTP layer" do
it "adds an additional Datadog-Container-ID header" do
expect(http).to receive(:request).with(
path: "/evp_proxy/v2/path",
payload: "payload",
Expand Down

0 comments on commit 3093c0c

Please sign in to comment.