summaryrefslogtreecommitdiff
path: root/test/buildtool/storage
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-02 10:50:48 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-09 13:07:13 +0200
commit7eafe5779703275d455558120efc754c2dcc3c01 (patch)
treee31168069ef2460f187652157fe3c03be698d9a8 /test/buildtool/storage
parent50bcabb0717dae7c8411db59115c41b7cc636cb3 (diff)
downloadjustbuild-7eafe5779703275d455558120efc754c2dcc3c01.tar.gz
Replace ArtifactDigest::Create
...with ArtifactDigestFactory::HashDataAs
Diffstat (limited to 'test/buildtool/storage')
-rw-r--r--test/buildtool/storage/TARGETS1
-rw-r--r--test/buildtool/storage/local_ac.test.cpp13
-rw-r--r--test/buildtool/storage/local_cas.test.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/test/buildtool/storage/TARGETS b/test/buildtool/storage/TARGETS
index b5d88715..5eeafa9a 100644
--- a/test/buildtool/storage/TARGETS
+++ b/test/buildtool/storage/TARGETS
@@ -36,6 +36,7 @@
, ["", "catch-main"]
, ["@", "src", "src/buildtool/common", "bazel_types"]
, ["@", "src", "src/buildtool/common", "common"]
+ , ["@", "src", "src/buildtool/common", "artifact_digest_factory"]
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/file_system", "object_type"]
, ["@", "src", "src/buildtool/storage", "storage"]
diff --git a/test/buildtool/storage/local_ac.test.cpp b/test/buildtool/storage/local_ac.test.cpp
index 9923108d..543a09b5 100644
--- a/test/buildtool/storage/local_ac.test.cpp
+++ b/test/buildtool/storage/local_ac.test.cpp
@@ -17,6 +17,7 @@
#include "catch2/catch_test_macros.hpp"
#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
+#include "src/buildtool/common/artifact_digest_factory.hpp"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/object_type.hpp"
@@ -36,7 +37,7 @@ TEST_CASE("LocalAC: Single action, single result", "[storage]") {
auto const& ac = storage.ActionCache();
auto const& cas = storage.CAS();
- auto action_id = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "action");
CHECK(not ac.CachedResult(action_id));
CHECK(RunDummyExecution(&ac, &cas, action_id, "result"));
@@ -51,9 +52,9 @@ TEST_CASE("LocalAC: Two different actions, two different results",
auto const& ac = storage.ActionCache();
auto const& cas = storage.CAS();
- auto action_id1 = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id1 = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "action1");
- auto action_id2 = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id2 = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "action2");
CHECK(not ac.CachedResult(action_id1));
CHECK(not ac.CachedResult(action_id2));
@@ -82,9 +83,9 @@ TEST_CASE("LocalAC: Two different actions, same two results", "[storage]") {
auto const& ac = storage.ActionCache();
auto const& cas = storage.CAS();
- auto action_id1 = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id1 = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "action1");
- auto action_id2 = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id2 = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "action2");
CHECK(not ac.CachedResult(action_id1));
CHECK(not ac.CachedResult(action_id2));
@@ -113,7 +114,7 @@ TEST_CASE("LocalAC: Same two actions, two different results", "[storage]") {
auto const& ac = storage.ActionCache();
auto const& cas = storage.CAS();
- auto action_id = ArtifactDigest::Create<ObjectType::File>(
+ auto action_id = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, "same action");
CHECK(not ac.CachedResult(action_id));
diff --git a/test/buildtool/storage/local_cas.test.cpp b/test/buildtool/storage/local_cas.test.cpp
index 44371fea..c7b7f720 100644
--- a/test/buildtool/storage/local_cas.test.cpp
+++ b/test/buildtool/storage/local_cas.test.cpp
@@ -32,7 +32,7 @@ TEST_CASE("LocalCAS: Add blob to storage from bytes", "[storage]") {
std::string test_bytes("test");
- auto test_digest = ArtifactDigest::Create<ObjectType::File>(
+ auto test_digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
storage_config.Get().hash_function, test_bytes);
// check blob not in storage