From fc0c842eb2e938c7de405e365ff320eb28e04bc7 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Fri, 21 Feb 2025 12:52:19 +0100 Subject: Pass TmpDir to BazelNetwork and BazelCasClient --- .../execution_api/bazel/bazel_network.test.cpp | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'test/buildtool/execution_api/bazel/bazel_network.test.cpp') diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index b902473b..6b8f7940 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -36,8 +36,9 @@ #include "src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" +#include "src/buildtool/storage/config.hpp" #include "src/utils/cpp/expected.hpp" -#include "test/utils/hermeticity/test_hash_function_type.hpp" +#include "test/utils/hermeticity/test_storage_config.hpp" #include "test/utils/remote_execution/test_auth_config.hpp" #include "test/utils/remote_execution/test_remote_config.hpp" @@ -46,6 +47,8 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1; TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { std::string instance_name{"remote-execution"}; + auto const storage_config = TestStorageConfig::Create(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); @@ -55,15 +58,17 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { RetryConfig retry_config{}; // default retry config - HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; + HashFunction const hash_function = storage_config.Get().hash_function; - auto network = BazelNetwork{instance_name, - remote_config->remote_address->host, - remote_config->remote_address->port, - &*auth_config, - &retry_config, - {}, - hash_function}; + auto network = + BazelNetwork{instance_name, + remote_config->remote_address->host, + remote_config->remote_address->port, + &*auth_config, + &retry_config, + {}, + hash_function, + storage_config.Get().CreateTypedTmpDir("test_space")}; std::string content_foo("foo"); std::string content_bar("bar"); @@ -107,7 +112,8 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { } TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { - HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; + auto const storage_config = TestStorageConfig::Create(); + HashFunction const hash_function = storage_config.Get().hash_function; if (not ProtocolTraits::IsNative(hash_function.GetType())) { // only supported in native mode return; @@ -124,13 +130,15 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { RetryConfig retry_config{}; // default retry config - auto network = BazelNetwork{instance_name, - remote_config->remote_address->host, - remote_config->remote_address->port, - &*auth_config, - &retry_config, - {}, - hash_function}; + auto network = + BazelNetwork{instance_name, + remote_config->remote_address->host, + remote_config->remote_address->port, + &*auth_config, + &retry_config, + {}, + hash_function, + storage_config.Get().CreateTypedTmpDir("test_space")}; std::string content_foo("foo"); std::string content_bar(kLargeSize, 'x'); // single larger blob -- cgit v1.2.3