summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api/bazel/bazel_network.test.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-08 15:07:36 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:01:13 +0200
commitf94b4663dc61a2987912faa3f1cd71378db0ad33 (patch)
tree24da5b6ff3868130d273f88417fed933c79e86a4 /test/buildtool/execution_api/bazel/bazel_network.test.cpp
parentde112e6af5267a78f9b48a8b049e3c86ee95376e (diff)
downloadjustbuild-f94b4663dc61a2987912faa3f1cd71378db0ad33.tar.gz
Pass HashFunction to BazelNetwork
Diffstat (limited to 'test/buildtool/execution_api/bazel/bazel_network.test.cpp')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp54
1 files changed, 32 insertions, 22 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index ff05eefb..7dfd0ffa 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -45,29 +45,34 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
RetryConfig retry_config{}; // default retry config
+ HashFunction const hash_function{Compatibility::IsCompatible()
+ ? HashFunction::JustHash::Compatible
+ : HashFunction::JustHash::Native};
+
auto network = BazelNetwork{instance_name,
remote_config->remote_address->host,
remote_config->remote_address->port,
&*auth_config,
&retry_config,
- {}};
+ {},
+ hash_function};
std::string content_foo("foo");
std::string content_bar("bar");
std::string content_baz(kLargeSize, 'x'); // single larger blob
- BazelBlob foo{ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), content_foo),
- content_foo,
- /*is_exec=*/false};
- BazelBlob bar{ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), content_bar),
- content_bar,
- /*is_exec=*/false};
- BazelBlob baz{ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), content_baz),
- content_baz,
- /*is_exec=*/false};
+ BazelBlob foo{
+ ArtifactDigest::Create<ObjectType::File>(hash_function, content_foo),
+ content_foo,
+ /*is_exec=*/false};
+ BazelBlob bar{
+ ArtifactDigest::Create<ObjectType::File>(hash_function, content_bar),
+ content_bar,
+ /*is_exec=*/false};
+ BazelBlob baz{
+ ArtifactDigest::Create<ObjectType::File>(hash_function, content_baz),
+ content_baz,
+ /*is_exec=*/false};
// Search blobs via digest
REQUIRE(network.UploadBlobs(BazelBlobContainer{{foo, bar, baz}}));
@@ -107,24 +112,29 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
RetryConfig retry_config{}; // default retry config
+ HashFunction const hash_function{Compatibility::IsCompatible()
+ ? HashFunction::JustHash::Compatible
+ : HashFunction::JustHash::Native};
+
auto network = BazelNetwork{instance_name,
remote_config->remote_address->host,
remote_config->remote_address->port,
&*auth_config,
&retry_config,
- {}};
+ {},
+ hash_function};
std::string content_foo("foo");
std::string content_bar(kLargeSize, 'x'); // single larger blob
- BazelBlob foo{ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), content_foo),
- content_foo,
- /*is_exec=*/false};
- BazelBlob bar{ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), content_bar),
- content_bar,
- /*is_exec=*/false};
+ BazelBlob foo{
+ ArtifactDigest::Create<ObjectType::File>(hash_function, content_foo),
+ content_foo,
+ /*is_exec=*/false};
+ BazelBlob bar{
+ ArtifactDigest::Create<ObjectType::File>(hash_function, content_bar),
+ content_bar,
+ /*is_exec=*/false};
// Upload blobs
REQUIRE(network.UploadBlobs(BazelBlobContainer{{foo, bar}}));