From 0d60cd9ba4a5c18b01b6ef996434953071f0576e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 1 Jul 2024 17:07:02 +0200 Subject: Pass Auth::TLS instance to serve and execute clients --- .../buildtool/execution_api/bazel/bazel_network.test.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test/buildtool/execution_api/bazel/bazel_network.test.cpp') diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index a1c5a986..75821454 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -13,10 +13,12 @@ // limitations under the License. #include +#include #include #include #include "catch2/catch_test_macros.hpp" +#include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" @@ -30,7 +32,12 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1; TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); std::string instance_name{"remote-execution"}; - auto network = BazelNetwork{instance_name, info->host, info->port, {}}; + std::optional auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + auto network = BazelNetwork{ + instance_name, info->host, info->port, auth ? &*auth : nullptr, {}}; std::string content_foo("foo"); std::string content_bar("bar"); @@ -75,7 +82,12 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); std::string instance_name{"remote-execution"}; - auto network = BazelNetwork{instance_name, info->host, info->port, {}}; + std::optional auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + auto network = BazelNetwork{ + instance_name, info->host, info->port, auth ? &*auth : nullptr, {}}; std::string content_foo("foo"); std::string content_bar(kLargeSize, 'x'); // single larger blob -- cgit v1.2.3