diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-01 17:07:02 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-04 16:05:08 +0200 |
commit | 0d60cd9ba4a5c18b01b6ef996434953071f0576e (patch) | |
tree | e2d96536db33b8e36cfc417e548d0f60b2d1ed28 /test/buildtool/execution_api/bazel/bytestream_client.test.cpp | |
parent | 217e31bf00c3437658033bd0829f31929f10a103 (diff) | |
download | justbuild-0d60cd9ba4a5c18b01b6ef996434953071f0576e.tar.gz |
Pass Auth::TLS instance to serve and execute clients
Diffstat (limited to 'test/buildtool/execution_api/bazel/bytestream_client.test.cpp')
-rw-r--r-- | test/buildtool/execution_api/bazel/bytestream_client.test.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
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 <cstddef> +#include <optional> #include <string> #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::TLS> 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::TLS> 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") { |