summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api/bazel/bazel_network.test.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-01 17:07:02 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-04 16:05:08 +0200
commit0d60cd9ba4a5c18b01b6ef996434953071f0576e (patch)
treee2d96536db33b8e36cfc417e548d0f60b2d1ed28 /test/buildtool/execution_api/bazel/bazel_network.test.cpp
parent217e31bf00c3437658033bd0829f31929f10a103 (diff)
downloadjustbuild-0d60cd9ba4a5c18b01b6ef996434953071f0576e.tar.gz
Pass Auth::TLS instance to serve and execute clients
Diffstat (limited to 'test/buildtool/execution_api/bazel/bazel_network.test.cpp')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index a1c5a986..75821454 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -13,10 +13,12 @@
// limitations under the License.
#include <cstddef>
+#include <optional>
#include <string>
#include <vector>
#include "catch2/catch_test_macros.hpp"
+#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
@@ -30,7 +32,12 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1;
TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
std::string instance_name{"remote-execution"};
- auto network = BazelNetwork{instance_name, info->host, info->port, {}};
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+ auto network = BazelNetwork{
+ instance_name, info->host, info->port, auth ? &*auth : nullptr, {}};
std::string content_foo("foo");
std::string content_bar("bar");
@@ -75,7 +82,12 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
std::string instance_name{"remote-execution"};
- auto network = BazelNetwork{instance_name, info->host, info->port, {}};
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+ auto network = BazelNetwork{
+ instance_name, info->host, info->port, auth ? &*auth : nullptr, {}};
std::string content_foo("foo");
std::string content_bar(kLargeSize, 'x'); // single larger blob