summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_engine/executor
diff options
context:
space:
mode:
Diffstat (limited to 'test/buildtool/execution_engine/executor')
-rw-r--r--test/buildtool/execution_engine/executor/TARGETS2
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp31
2 files changed, 15 insertions, 18 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS
index bb7c43da..c0dcc56f 100644
--- a/test/buildtool/execution_engine/executor/TARGETS
+++ b/test/buildtool/execution_engine/executor/TARGETS
@@ -9,7 +9,6 @@
, ["@", "src", "src/buildtool/common", "action_description"]
, ["@", "src", "src/buildtool/common", "artifact_blob"]
, ["@", "src", "src/buildtool/common", "artifact_description"]
- , ["@", "src", "src/buildtool/common", "artifact_digest_factory"]
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/common", "config"]
, ["@", "src", "src/buildtool/common", "tree"]
@@ -24,6 +23,7 @@
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/file_system", "object_type"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
+ , ["@", "src", "src/utils/cpp", "expected"]
, ["utils", "test_api_bundle"]
, ["utils", "test_hash_function_type"]
, ["utils", "test_remote_config"]
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index 20b4a091..6a8f409e 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -36,7 +36,6 @@
#include "src/buildtool/common/artifact_blob.hpp"
#include "src/buildtool/common/artifact_description.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
-#include "src/buildtool/common/artifact_digest_factory.hpp"
#include "src/buildtool/common/remote/retry_config.hpp"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
@@ -51,6 +50,7 @@
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/progress_reporting/progress.hpp"
+#include "src/utils/cpp/expected.hpp"
#include "test/utils/executor/test_api_bundle.hpp"
#include "test/utils/hermeticity/test_hash_function_type.hpp"
#include "test/utils/remote_execution/test_remote_config.hpp"
@@ -70,12 +70,10 @@ static inline void RunBlobUpload(RepositoryConfig* repo_config,
auto api = factory();
HashFunction const hash_function{TestHashType::ReadFromEnvironment()};
- std::string const blob = "test";
- CHECK(api->Upload(
- {ArtifactBlob{ArtifactDigestFactory::HashDataAs<ObjectType::File>(
- hash_function, blob),
- blob,
- /*is_exec=*/false}}));
+ auto const blob =
+ ArtifactBlob::FromMemory(hash_function, ObjectType::File, "test");
+ REQUIRE(blob.has_value());
+ CHECK(api->Upload({*blob}));
}
[[nodiscard]] static inline auto GetTestDir() -> std::filesystem::path {
@@ -424,23 +422,22 @@ static inline void TestUploadAndDownloadTrees(
HashFunction const hash_function{TestHashType::ReadFromEnvironment()};
- auto foo = std::string{"foo"};
- auto bar = std::string{"bar"};
- auto const foo_digest =
- ArtifactDigestFactory::HashDataAs<ObjectType::File>(hash_function, foo);
- auto const bar_digest =
- ArtifactDigestFactory::HashDataAs<ObjectType::File>(hash_function, bar);
+ auto const foo =
+ ArtifactBlob::FromMemory(hash_function, ObjectType::File, "foo");
+ REQUIRE(foo.has_value());
+ auto const bar =
+ ArtifactBlob::FromMemory(hash_function, ObjectType::File, "bar");
+ REQUIRE(bar.has_value());
// upload blobs
auto api = factory();
- REQUIRE(api->Upload({ArtifactBlob{foo_digest, foo, /*is_exec=*/false},
- ArtifactBlob{bar_digest, bar, /*is_exec=*/false}}));
+ REQUIRE(api->Upload({*foo, *bar}));
// define known artifacts
auto foo_desc =
- ArtifactDescription::CreateKnown(foo_digest, ObjectType::File);
+ ArtifactDescription::CreateKnown(foo->GetDigest(), ObjectType::File);
auto bar_desc =
- ArtifactDescription::CreateKnown(bar_digest, ObjectType::Symlink);
+ ArtifactDescription::CreateKnown(bar->GetDigest(), ObjectType::Symlink);
DependencyGraph g{};
auto foo_id = g.AddArtifact(foo_desc);