summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-17 10:17:56 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-18 09:45:19 +0200
commitaf36ec3931067d40f0552a8d5610cc9d35f91bbc (patch)
tree5ff07155050438176ad3f1431d991c37d9c5f5eb /test
parent2669a27e7322772ff366662ccc5e9f02cedf70bd (diff)
downloadjustbuild-af36ec3931067d40f0552a8d5610cc9d35f91bbc.tar.gz
Remove ByteStreamClient::{Read, Write}Many
...since they were used only in tests.
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/execution_api/bazel/TARGETS1
-rw-r--r--test/buildtool/execution_api/bazel/bytestream_client.test.cpp124
2 files changed, 2 insertions, 123 deletions
diff --git a/test/buildtool/execution_api/bazel/TARGETS b/test/buildtool/execution_api/bazel/TARGETS
index 02b55b78..ee76b1b8 100644
--- a/test/buildtool/execution_api/bazel/TARGETS
+++ b/test/buildtool/execution_api/bazel/TARGETS
@@ -50,7 +50,6 @@
, ["utils", "test_auth_config"]
, ["utils", "test_remote_config"]
, ["@", "src", "src/buildtool/common", "bazel_digest_factory"]
- , ["@", "src", "src/buildtool/execution_api/bazel_msg", "bazel_msg"]
, ["@", "src", "src/buildtool/execution_api/remote", "bazel_network"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
, ["@", "src", "src/buildtool/file_system", "object_type"]
diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
index c8b7cac6..03b70ae4 100644
--- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
@@ -22,7 +22,6 @@
#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/bazel_digest_factory.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
-#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/file_system/object_type.hpp"
@@ -30,8 +29,6 @@
#include "test/utils/remote_execution/test_auth_config.hpp"
#include "test/utils/remote_execution/test_remote_config.hpp"
-constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1;
-
TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
auto auth_config = TestAuthConfig::ReadFromEnvironment();
REQUIRE(auth_config);
@@ -90,6 +87,8 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
}
SECTION("Upload large blob") {
+ static constexpr std::size_t kLargeSize =
+ GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1;
std::string instance_name{"remote-execution"};
std::string content(kLargeSize, '\0');
@@ -136,122 +135,3 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
}
}
}
-
-TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") {
- auto auth_config = TestAuthConfig::ReadFromEnvironment();
- REQUIRE(auth_config);
-
- auto remote_config = TestRemoteConfig::ReadFromEnvironment();
- REQUIRE(remote_config);
- REQUIRE(remote_config->remote_address);
-
- 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()};
-
- SECTION("Upload small blobs") {
- std::string instance_name{"remote-execution"};
-
- BazelBlob foo{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, "foo"),
- "foo",
- /*is_exec=*/false};
- BazelBlob bar{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, "bar"),
- "bar",
- /*is_exec=*/false};
- BazelBlob baz{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, "baz"),
- "baz",
- /*is_exec=*/false};
-
- CHECK(stream.WriteMany<BazelBlob>(
- {foo, bar, baz},
- [&instance_name, &uuid](auto const& blob) {
- return fmt::format("{}/uploads/{}/blobs/{}/{}",
- instance_name,
- uuid,
- blob.digest.hash(),
- blob.digest.size_bytes());
- },
- [](auto const& blob) { return *blob.data; }));
-
- SECTION("Download small blobs") {
- std::vector<std::string> contents{};
- stream.ReadMany<bazel_re::Digest>(
- {foo.digest, bar.digest, baz.digest},
- [&instance_name](auto const& digest) -> std::string {
- return fmt::format("{}/blobs/{}/{}",
- instance_name,
- digest.hash(),
- digest.size_bytes());
- },
- [&contents](auto data) {
- contents.emplace_back(std::move(data));
- });
- REQUIRE(contents.size() == 3);
- CHECK(contents[0] == *foo.data);
- CHECK(contents[1] == *bar.data);
- CHECK(contents[2] == *baz.data);
- }
- }
-
- SECTION("Upload large blobs") {
- std::string instance_name{"remote-execution"};
-
- std::string content_foo(kLargeSize, '\0');
- std::string content_bar(kLargeSize, '\0');
- std::string content_baz(kLargeSize, '\0');
- for (std::size_t i{}; i < content_foo.size(); ++i) {
- content_foo[i] = instance_name[(i + 0) % instance_name.size()];
- content_bar[i] = instance_name[(i + 1) % instance_name.size()];
- content_baz[i] = instance_name[(i + 2) % instance_name.size()];
- }
-
- BazelBlob foo{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, content_foo),
- content_foo,
- /*is_exec=*/false};
- BazelBlob bar{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, content_bar),
- content_bar,
- /*is_exec=*/false};
- BazelBlob baz{BazelDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, content_baz),
- content_baz,
- /*is_exec=*/false};
-
- CHECK(stream.WriteMany<BazelBlob>(
- {foo, bar, baz},
- [&instance_name, &uuid](auto const& blob) {
- return fmt::format("{}/uploads/{}/blobs/{}/{}",
- instance_name,
- uuid,
- blob.digest.hash(),
- blob.digest.size_bytes());
- },
- [](auto const& blob) { return *blob.data; }));
-
- SECTION("Download large blobs") {
- std::vector<std::string> contents{};
- stream.ReadMany<bazel_re::Digest>(
- {foo.digest, bar.digest, baz.digest},
- [&instance_name](auto const& digest) -> std::string {
- return fmt::format("{}/blobs/{}/{}",
- instance_name,
- digest.hash(),
- digest.size_bytes());
- },
- [&contents](auto data) {
- contents.emplace_back(std::move(data));
- });
- REQUIRE(contents.size() == 3);
- CHECK(contents[0] == *foo.data);
- CHECK(contents[1] == *bar.data);
- CHECK(contents[2] == *baz.data);
- }
- }
-}