summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api
diff options
context:
space:
mode:
Diffstat (limited to 'test/buildtool/execution_api')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index b67013a0..28bfcdc2 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -43,3 +43,43 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
CHECK(blobs[3].data == content_bar);
CHECK(blobs[4].data == content_foo);
}
+
+TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
+ if (Compatibility::IsCompatible()) {
+ // only supported in native mode
+ return;
+ }
+
+ auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::string instance_name{"remote-execution"};
+ auto network = BazelNetwork{instance_name, info->host, info->port, {}};
+
+ std::string content_foo("foo");
+ std::string content_bar(kLargeSize, 'x'); // single larger blob
+
+ BazelBlob foo{ArtifactDigest::Create(content_foo), content_foo};
+ BazelBlob bar{ArtifactDigest::Create(content_bar), content_bar};
+
+ // Upload blobs
+ REQUIRE(network.UploadBlobs(BlobContainer{{foo, bar}}));
+
+ // Set size to unknown
+ foo.digest.set_size_bytes(0);
+ bar.digest.set_size_bytes(0);
+
+ // Read blobs
+ auto reader = network.ReadBlobs({foo.digest, bar.digest});
+ std::vector<BazelBlob> blobs{};
+ while (true) {
+ auto next = reader.Next();
+ if (next.empty()) {
+ break;
+ }
+ blobs.insert(blobs.end(), next.begin(), next.end());
+ }
+
+ // Check order maintained
+ REQUIRE(blobs.size() == 2);
+ CHECK(blobs[0].data == content_foo);
+ CHECK(blobs[1].data == content_bar);
+}