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 --- .../bazel/bazel_execution_client.test.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp') 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 #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/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( ArtifactDigest::Create(content)); - BazelExecutionClient execution_client(info->host, info->port); + std::optional 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( ArtifactDigest::Create(content)); - BazelExecutionClient execution_client(info->host, info->port); + std::optional 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; -- cgit v1.2.3