From f7e4ebf0e2913ff1b987e40baab5c0c809e6c0de Mon Sep 17 00:00:00 2001 From: Sascha Roloff Date: Thu, 13 Oct 2022 11:39:13 +0200 Subject: 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. --- .../execution_api/bazel/bytestream_client.test.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'test/buildtool/execution_api/bazel/bytestream_client.test.cpp') 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(ArtifactDigest::Create(content)); + auto digest = static_cast( + ArtifactDigest::Create(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(ArtifactDigest::Create(content)); + auto digest = static_cast( + ArtifactDigest::Create(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("foo"), "foo"}; + BazelBlob bar{ArtifactDigest::Create("bar"), "bar"}; + BazelBlob baz{ArtifactDigest::Create("baz"), "baz"}; CHECK(stream.WriteMany( {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(content_foo), + content_foo}; + BazelBlob bar{ArtifactDigest::Create(content_bar), + content_bar}; + BazelBlob baz{ArtifactDigest::Create(content_baz), + content_baz}; CHECK(stream.WriteMany( {foo, bar, baz}, -- cgit v1.2.3