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/bazel_execution_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/bazel_execution_client.test.cpp')
-rwxr-xr-x | test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp index 0848ad32..50869542 100755 --- a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#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/remote/bazel/bazel_execution_client.hpp" #include "src/buildtool/execution_api/remote/config.hpp" @@ -30,7 +32,13 @@ TEST_CASE("Bazel internals: Execution Client", "[execution_api]") { auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(content)); - BazelExecutionClient execution_client(info->host, info->port); + std::optional<Auth::TLS> auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + + BazelExecutionClient execution_client( + info->host, info->port, auth ? &*auth : nullptr); ExecutionConfiguration config; config.skip_cache_lookup = false; @@ -98,7 +106,13 @@ TEST_CASE("Bazel internals: Execution Client using env variables", auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(content)); - BazelExecutionClient execution_client(info->host, info->port); + std::optional<Auth::TLS> auth = {}; + if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { + auth = Auth::TLS::Instance(); + } + + BazelExecutionClient execution_client( + info->host, info->port, auth ? &*auth : nullptr); ExecutionConfiguration config; config.skip_cache_lookup = false; |