diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-01 14:56:32 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-04 16:05:08 +0200 |
commit | 9ab21a7f3d7e349b05ceaad5862d7e72a6d7e7b4 (patch) | |
tree | 269b95c86875d9bd4fe16e117aa9ba75b6c60304 /test/buildtool/execution_api/bazel/bazel_api.test.cpp | |
parent | 0cbc8e226b39ec731373b80024e23cc0580c27ac (diff) | |
download | justbuild-9ab21a7f3d7e349b05ceaad5862d7e72a6d7e7b4.tar.gz |
Pass Auth::TLS instance to BazelApi and ServeApi
Diffstat (limited to 'test/buildtool/execution_api/bazel/bazel_api.test.cpp')
-rw-r--r-- | test/buildtool/execution_api/bazel/bazel_api.test.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp index 268edb1e..af457066 100644 --- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp @@ -13,9 +13,11 @@ // limitations under the License. #include <cstdlib> +#include <optional> #include <string> #include "catch2/catch_test_macros.hpp" +#include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "test/buildtool/execution_api/common/api_test.hpp" @@ -25,8 +27,15 @@ namespace { auto const kApiFactory = []() { static auto const& server = RemoteExecutionConfig::RemoteAddress(); - return IExecutionApi::Ptr{ - new BazelApi{"remote-execution", server->host, server->port, {}}}; + std::optional<Auth::TLS> auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + return IExecutionApi::Ptr{new BazelApi{"remote-execution", + server->host, + server->port, + auth ? &*auth : nullptr, + {}}}; }; } // namespace |