diff options
author | Sascha Roloff <sascha.roloff@huawei.com> | 2022-10-13 11:39:13 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-10-14 12:46:42 +0200 |
commit | f7e4ebf0e2913ff1b987e40baab5c0c809e6c0de (patch) | |
tree | 09ae121b46743a7eb682d9ba1361a59566c558bc /test/buildtool/execution_api/bazel/bytestream_client.test.cpp | |
parent | 4d53961509015534fa10a59f4b86a20ae8a66017 (diff) | |
download | justbuild-f7e4ebf0e2913ff1b987e40baab5c0c809e6c0de.tar.gz |
Remove default value of ArtifactDigest::Create template parameter
This enforces the explicit specification, which object type, either file or
tree, should be used to create an artifact digest. This also avoids subtile
errors at locations as in the previous commit, where files as well as trees are
supposed to be handled, but digest creation mistakenly defaults to file object
type.
Diffstat (limited to 'test/buildtool/execution_api/bazel/bytestream_client.test.cpp')
-rw-r--r-- | test/buildtool/execution_api/bazel/bytestream_client.test.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index 3c2c9ca8..22d41437 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -32,8 +32,8 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { std::string content("foobar"); // digest of "foobar" - auto digest = - static_cast<bazel_re::Digest>(ArtifactDigest::Create(content)); + auto digest = static_cast<bazel_re::Digest>( + ArtifactDigest::Create<ObjectType::File>(content)); CHECK(stream.Write(fmt::format("{}/uploads/{}/blobs/{}/{}", instance_name, @@ -61,8 +61,8 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { } // digest of "instance_nameinstance_nameinstance_..." - auto digest = - static_cast<bazel_re::Digest>(ArtifactDigest::Create(content)); + auto digest = static_cast<bazel_re::Digest>( + ArtifactDigest::Create<ObjectType::File>(content)); CHECK(stream.Write(fmt::format("{}/uploads/{}/blobs/{}/{}", instance_name, @@ -108,9 +108,9 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") { SECTION("Upload small blobs") { std::string instance_name{"remote-execution"}; - BazelBlob foo{ArtifactDigest::Create("foo"), "foo"}; - BazelBlob bar{ArtifactDigest::Create("bar"), "bar"}; - BazelBlob baz{ArtifactDigest::Create("baz"), "baz"}; + BazelBlob foo{ArtifactDigest::Create<ObjectType::File>("foo"), "foo"}; + BazelBlob bar{ArtifactDigest::Create<ObjectType::File>("bar"), "bar"}; + BazelBlob baz{ArtifactDigest::Create<ObjectType::File>("baz"), "baz"}; CHECK(stream.WriteMany<BazelBlob>( {foo, bar, baz}, @@ -155,9 +155,12 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") { content_baz[i] = instance_name[(i + 2) % instance_name.size()]; } - BazelBlob foo{ArtifactDigest::Create(content_foo), content_foo}; - BazelBlob bar{ArtifactDigest::Create(content_bar), content_bar}; - BazelBlob baz{ArtifactDigest::Create(content_baz), content_baz}; + BazelBlob foo{ArtifactDigest::Create<ObjectType::File>(content_foo), + content_foo}; + BazelBlob bar{ArtifactDigest::Create<ObjectType::File>(content_bar), + content_bar}; + BazelBlob baz{ArtifactDigest::Create<ObjectType::File>(content_baz), + content_baz}; CHECK(stream.WriteMany<BazelBlob>( {foo, bar, baz}, |