diff options
Diffstat (limited to 'test')
11 files changed, 45 insertions, 37 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_ac_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_ac_client.test.cpp index 0d44849b..ca0c0568 100644 --- a/test/buildtool/execution_api/bazel/bazel_ac_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_ac_client.test.cpp @@ -43,7 +43,7 @@ TEST_CASE("Bazel internals: AC Client", "[!hide][execution_api]") { std::string instance_name{"remote-execution"}; std::string content("test"); - auto test_digest = ArtifactDigest::Create(content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(content); auto action_id = CreateAction(instance_name, {"echo", "-n", content}, diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp index c44cf33c..1081c952 100644 --- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp @@ -30,7 +30,7 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") { SECTION("Valid digest and blob") { // digest of "test" - auto digest = ArtifactDigest::Create(content); + auto digest = ArtifactDigest::Create<ObjectType::File>(content); // Valid blob BazelBlob blob{digest, content}; diff --git a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp index d5e00ad8..d136e818 100755 --- a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp @@ -25,8 +25,8 @@ TEST_CASE("Bazel internals: Execution Client", "[execution_api]") { std::string instance_name{"remote-execution"}; std::string content("test"); - auto test_digest = - static_cast<bazel_re::Digest>(ArtifactDigest::Create(content)); + auto test_digest = static_cast<bazel_re::Digest>( + ArtifactDigest::Create<ObjectType::File>(content)); BazelExecutionClient execution_client(info->host, info->port); @@ -93,8 +93,8 @@ TEST_CASE("Bazel internals: Execution Client using env variables", std::string instance_name{"remote-execution"}; std::string content("contents of env variable"); - auto test_digest = - static_cast<bazel_re::Digest>(ArtifactDigest::Create(content)); + auto test_digest = static_cast<bazel_re::Digest>( + ArtifactDigest::Create<ObjectType::File>(content)); BazelExecutionClient execution_client(info->host, info->port); diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index 6d58d463..ccfcd695 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -30,9 +30,12 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { std::string content_bar("bar"); std::string content_baz(kLargeSize, 'x'); // single larger blob - 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}; // Search blobs via digest REQUIRE(network.UploadBlobs(BlobContainer{{foo, bar, baz}})); @@ -71,8 +74,10 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { 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}; + BazelBlob foo{ArtifactDigest::Create<ObjectType::File>(content_foo), + content_foo}; + BazelBlob bar{ArtifactDigest::Create<ObjectType::File>(content_bar), + content_bar}; // Upload blobs REQUIRE(network.UploadBlobs(BlobContainer{{foo, bar}})); 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}, diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 08aa3bd2..fdc13643 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -103,7 +103,7 @@ using ExecProps = std::map<std::string, std::string>; ExecProps const& props, bool is_hermetic = false) { std::string test_content("test"); - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); std::string output_path{"output_file"}; @@ -180,7 +180,7 @@ using ExecProps = std::map<std::string, std::string>; ExecProps const& props, bool is_hermetic = false) { std::string test_content("test"); - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); auto input_artifact_opt = ArtifactFactory::FromDescription(ArtifactFactory::DescribeKnownArtifact( @@ -264,7 +264,7 @@ using ExecProps = std::map<std::string, std::string>; ApiFactory const& api_factory, ExecProps const& props) { std::string test_content("test"); - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); std::string output_path{"output_file"}; diff --git a/test/buildtool/execution_api/local/local_ac.test.cpp b/test/buildtool/execution_api/local/local_ac.test.cpp index 2e5e1819..eaee5a7c 100644 --- a/test/buildtool/execution_api/local/local_ac.test.cpp +++ b/test/buildtool/execution_api/local/local_ac.test.cpp @@ -30,7 +30,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, LocalCAS cas{}; LocalAC ac{&cas}; - auto action_id = ArtifactDigest::Create("action"); + auto action_id = ArtifactDigest::Create<ObjectType::File>("action"); CHECK(not ac.CachedResult(action_id)); CHECK(RunDummyExecution(&ac, action_id, "result")); @@ -44,8 +44,8 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, LocalCAS cas{}; LocalAC ac{&cas}; - auto action_id1 = ArtifactDigest::Create("action1"); - auto action_id2 = ArtifactDigest::Create("action2"); + auto action_id1 = ArtifactDigest::Create<ObjectType::File>("action1"); + auto action_id2 = ArtifactDigest::Create<ObjectType::File>("action2"); CHECK(not ac.CachedResult(action_id1)); CHECK(not ac.CachedResult(action_id2)); @@ -73,8 +73,8 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, LocalCAS cas{}; LocalAC ac{&cas}; - auto action_id1 = ArtifactDigest::Create("action1"); - auto action_id2 = ArtifactDigest::Create("action2"); + auto action_id1 = ArtifactDigest::Create<ObjectType::File>("action1"); + auto action_id2 = ArtifactDigest::Create<ObjectType::File>("action2"); CHECK(not ac.CachedResult(action_id1)); CHECK(not ac.CachedResult(action_id2)); @@ -102,7 +102,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, LocalCAS cas{}; LocalAC ac{&cas}; - auto action_id = ArtifactDigest::Create("same action"); + auto action_id = ArtifactDigest::Create<ObjectType::File>("same action"); CHECK(not ac.CachedResult(action_id)); std::string result_content1{}; diff --git a/test/buildtool/execution_api/local/local_cas.test.cpp b/test/buildtool/execution_api/local/local_cas.test.cpp index 182456d4..14a86628 100644 --- a/test/buildtool/execution_api/local/local_cas.test.cpp +++ b/test/buildtool/execution_api/local/local_cas.test.cpp @@ -22,7 +22,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "LocalCAS", "[execution_api]") { std::string test_content{"test"}; - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); SECTION("CAS for files") { LocalCAS<ObjectType::File> cas{}; diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp index 5e69dde0..14dad898 100755 --- a/test/buildtool/execution_api/local/local_execution.test.cpp +++ b/test/buildtool/execution_api/local/local_execution.test.cpp @@ -132,7 +132,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, auto api = LocalApi{}; std::string test_content("test"); - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); std::string output_path{"output_file"}; std::vector<std::string> const cmdline = { @@ -187,7 +187,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, auto api = LocalApi{}; std::string test_content("test"); - auto test_digest = ArtifactDigest::Create(test_content); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content); REQUIRE(api.Upload(BlobContainer{{BazelBlob{test_digest, test_content}}}, false)); diff --git a/test/buildtool/execution_api/local/local_storage.test.cpp b/test/buildtool/execution_api/local/local_storage.test.cpp index 63b2cc4b..b85fc24d 100644 --- a/test/buildtool/execution_api/local/local_storage.test.cpp +++ b/test/buildtool/execution_api/local/local_storage.test.cpp @@ -24,7 +24,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, std::string test_bytes("test"); LocalStorage storage{}; - auto test_digest = ArtifactDigest::Create(test_bytes); + auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_bytes); // check blob not in storage CHECK(not storage.BlobPath(test_digest, true)); diff --git a/test/utils/remote_execution/bazel_action_creator.hpp b/test/utils/remote_execution/bazel_action_creator.hpp index 6abc9e32..f6ed773a 100644 --- a/test/utils/remote_execution/bazel_action_creator.hpp +++ b/test/utils/remote_execution/bazel_action_creator.hpp @@ -58,12 +58,12 @@ }); auto cmd_data = cmd.SerializeAsString(); - auto cmd_id = ArtifactDigest::Create(cmd_data); + auto cmd_id = ArtifactDigest::Create<ObjectType::File>(cmd_data); blobs.emplace_back(cmd_id, cmd_data); bazel_re::Directory empty_dir; auto dir_data = empty_dir.SerializeAsString(); - auto dir_id = ArtifactDigest::Create(dir_data); + auto dir_id = ArtifactDigest::Create<ObjectType::File>(dir_data); blobs.emplace_back(dir_id, dir_data); bazel_re::Action action; @@ -74,7 +74,7 @@ gsl::owner<bazel_re::Digest*>{new bazel_re::Digest{dir_id}}); auto action_data = action.SerializeAsString(); - auto action_id = ArtifactDigest::Create(action_data); + auto action_id = ArtifactDigest::Create<ObjectType::File>(action_data); blobs.emplace_back(action_id, action_data); BazelCasClient cas_client(info->host, info->port); |