summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-27 14:51:52 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-27 16:47:05 +0200
commitb46b207b1903f3a0ab4ff2d36db5a7c2964f5629 (patch)
tree154624a7e7677a6960a5aadcb304f519a0d7dffe /test/buildtool/execution_api/bazel/bytestream_client.test.cpp
parent72561e6318425bd927169fe61112b07433e4e9f8 (diff)
downloadjustbuild-b46b207b1903f3a0ab4ff2d36db5a7c2964f5629.tar.gz
bytestream API: verify that invalid digests are rejected
Diffstat (limited to 'test/buildtool/execution_api/bazel/bytestream_client.test.cpp')
-rw-r--r--test/buildtool/execution_api/bazel/bytestream_client.test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
index fba05118..10fe0c83 100644
--- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
@@ -74,6 +74,24 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
}
}
+ SECTION("Small blob with wrong digest") {
+ std::string instance_name{"remote-execution"};
+ std::string content("foobar");
+ std::string other_content("This is a differnt string");
+
+ // Valid digest, but for a different string
+ auto digest = static_cast<bazel_re::Digest>(
+ ArtifactDigest::Create<ObjectType::File>(hash_function,
+ other_content));
+
+ CHECK(not stream.Write(fmt::format("{}/uploads/{}/blobs/{}/{}",
+ instance_name,
+ uuid,
+ digest.hash(),
+ digest.size_bytes()),
+ content));
+ }
+
SECTION("Upload large blob") {
std::string instance_name{"remote-execution"};