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 --- .../execution_api/bazel/bytestream_client.test.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test/buildtool/execution_api/bazel/bytestream_client.test.cpp') diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index fea6edea..b1c49947 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -13,9 +13,11 @@ // limitations under the License. #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/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/common/execution_common.hpp" @@ -27,7 +29,12 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1; TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto stream = ByteStreamClient{info->host, info->port}; + std::optional auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + auto stream = + ByteStreamClient{info->host, info->port, auth ? &*auth : nullptr}; auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); SECTION("Upload small blob") { @@ -105,7 +112,12 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto stream = ByteStreamClient{info->host, info->port}; + std::optional auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + auto stream = + ByteStreamClient{info->host, info->port, auth ? &*auth : nullptr}; auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); SECTION("Upload small blobs") { -- cgit v1.2.3