diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-20 12:15:26 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-21 14:46:30 +0100 |
commit | e8c157aed3fed0472d14b205c6b1dc78c393a430 (patch) | |
tree | 6ff7466196947ffe6d29ad773289c4b1f3551b9c /test/buildtool/execution_api | |
parent | 986b6e25526e38f21a6b3f11beefbb9679a200ab (diff) | |
download | justbuild-e8c157aed3fed0472d14b205c6b1dc78c393a430.tar.gz |
ByteStreamClient: Use ArtifactBlob in Write
Diffstat (limited to 'test/buildtool/execution_api')
-rw-r--r-- | test/buildtool/execution_api/bazel/TARGETS | 2 | ||||
-rw-r--r-- | test/buildtool/execution_api/bazel/bytestream_client.test.cpp | 27 |
2 files changed, 13 insertions, 16 deletions
diff --git a/test/buildtool/execution_api/bazel/TARGETS b/test/buildtool/execution_api/bazel/TARGETS index 7b1a139e..edbaf311 100644 --- a/test/buildtool/execution_api/bazel/TARGETS +++ b/test/buildtool/execution_api/bazel/TARGETS @@ -54,8 +54,10 @@ , ["@", "grpc", "", "grpc"] , ["@", "gsl", "", "gsl"] , ["@", "src", "src/buildtool/common", "artifact_digest_factory"] + , ["@", "src", "src/buildtool/common", "common"] , ["@", "src", "src/buildtool/common/remote", "remote_common"] , ["@", "src", "src/buildtool/crypto", "hash_function"] + , ["@", "src", "src/buildtool/execution_api/common", "artifact_blob"] , ["@", "src", "src/buildtool/execution_api/common", "bytestream_utils"] , ["@", "src", "src/buildtool/execution_api/common", "common"] , ["@", "src", "src/buildtool/execution_api/common", "ids"] diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index 07d85671..96a95701 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -22,11 +22,12 @@ #include "catch2/catch_test_macros.hpp" #include "gsl/gsl" +#include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/crypto/hash_function.hpp" +#include "src/buildtool/execution_api/common/artifact_blob.hpp" #include "src/buildtool/execution_api/common/bytestream_utils.hpp" -#include "src/buildtool/execution_api/common/ids.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "test/utils/hermeticity/test_hash_function_type.hpp" @@ -44,7 +45,6 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { auto stream = ByteStreamClient{remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config}; - auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; @@ -56,16 +56,13 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>( hash_function, content); - CHECK(stream.Write( - ByteStreamUtils::WriteRequest{instance_name, uuid, digest}, - content)); + ArtifactBlob const blob{digest, content, /*is_exec=*/false}; + CHECK(stream.Write(instance_name, blob)); - SECTION("Download small blob") { - auto const data = stream.Read( - ByteStreamUtils::ReadRequest{instance_name, digest}); + auto const data = + stream.Read(ByteStreamUtils::ReadRequest{instance_name, digest}); - CHECK(data == content); - } + CHECK(data == content); } SECTION("Small blob with wrong digest") { @@ -76,10 +73,9 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { // Valid digest, but for a different string auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>( hash_function, other_content); + ArtifactBlob const blob{digest, content, /*is_exec=*/false}; - CHECK(not stream.Write( - ByteStreamUtils::WriteRequest{instance_name, uuid, digest}, - content)); + CHECK(not stream.Write(instance_name, blob)); } SECTION("Upload large blob") { @@ -95,10 +91,9 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { // digest of "instance_nameinstance_nameinstance_..." auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>( hash_function, content); + ArtifactBlob const blob{digest, content, /*is_exec=*/false}; - CHECK(stream.Write( - ByteStreamUtils::WriteRequest{instance_name, uuid, digest}, - content)); + CHECK(stream.Write(instance_name, blob)); SECTION("Download large blob") { auto const data = stream.Read( |