summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api
diff options
context:
space:
mode:
Diffstat (limited to 'test/buildtool/execution_api')
-rw-r--r--test/buildtool/execution_api/execution_service/TARGETS2
-rw-r--r--test/buildtool/execution_api/execution_service/cas_server.test.cpp11
-rw-r--r--test/buildtool/execution_api/local/TARGETS4
-rw-r--r--test/buildtool/execution_api/local/local_api.test.cpp95
-rw-r--r--test/buildtool/execution_api/local/local_execution.test.cpp52
5 files changed, 81 insertions, 83 deletions
diff --git a/test/buildtool/execution_api/execution_service/TARGETS b/test/buildtool/execution_api/execution_service/TARGETS
index c14db85c..754615d5 100644
--- a/test/buildtool/execution_api/execution_service/TARGETS
+++ b/test/buildtool/execution_api/execution_service/TARGETS
@@ -5,7 +5,7 @@
, "private-deps":
[ ["", "catch-main"]
, ["@", "catch2", "", "catch2"]
- , ["utils", "local_hermeticity"]
+ , ["utils", "test_storage_config"]
, [ "@"
, "src"
, "src/buildtool/execution_api/execution_service"
diff --git a/test/buildtool/execution_api/execution_service/cas_server.test.cpp b/test/buildtool/execution_api/execution_service/cas_server.test.cpp
index 5b6e50b5..a7791cd5 100644
--- a/test/buildtool/execution_api/execution_service/cas_server.test.cpp
+++ b/test/buildtool/execution_api/execution_service/cas_server.test.cpp
@@ -22,7 +22,7 @@
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
-#include "test/utils/hermeticity/local.hpp"
+#include "test/utils/hermeticity/test_storage_config.hpp"
namespace {
[[nodiscard]] auto Upload(
@@ -41,12 +41,11 @@ namespace {
}
} // namespace
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "CAS Service: upload incomplete tree",
- "[execution_service]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("CAS Service: upload incomplete tree", "[execution_service]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
- auto cas_server = CASServiceImpl{&StorageConfig::Instance(), &storage};
+ auto cas_server = CASServiceImpl{&storage_config.Get(), &storage};
auto instance_name = std::string{"remote-execution"};
// Create an empty tree.
diff --git a/test/buildtool/execution_api/local/TARGETS b/test/buildtool/execution_api/local/TARGETS
index 282166a2..eb23c99a 100644
--- a/test/buildtool/execution_api/local/TARGETS
+++ b/test/buildtool/execution_api/local/TARGETS
@@ -12,7 +12,7 @@
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/logging", "log_level"]
, ["@", "src", "src/buildtool/logging", "logging"]
- , ["utils", "local_hermeticity"]
+ , ["utils", "test_storage_config"]
, ["@", "src", "src/buildtool/storage", "storage"]
, ["@", "src", "src/buildtool/storage", "config"]
]
@@ -27,7 +27,7 @@
, ["", "catch-main"]
, ["@", "src", "src/buildtool/execution_api/local", "local"]
, ["buildtool/execution_api/common", "api_test"]
- , ["utils", "local_hermeticity"]
+ , ["utils", "test_storage_config"]
, ["@", "src", "src/buildtool/storage", "storage"]
, ["@", "src", "src/buildtool/storage", "config"]
]
diff --git a/test/buildtool/execution_api/local/local_api.test.cpp b/test/buildtool/execution_api/local/local_api.test.cpp
index de875a2c..a2fee207 100644
--- a/test/buildtool/execution_api/local/local_api.test.cpp
+++ b/test/buildtool/execution_api/local/local_api.test.cpp
@@ -20,92 +20,91 @@
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "test/buildtool/execution_api/common/api_test.hpp"
-#include "test/utils/hermeticity/local.hpp"
+#include "test/utils/hermeticity/test_storage_config.hpp"
namespace {
class FactoryApi final {
public:
explicit FactoryApi(
- gsl::not_null<Storage const*> const& storage,
- gsl::not_null<StorageConfig const*> const& storage_config) noexcept
- : storage_{*storage}, storage_config_{*storage_config} {}
+ gsl::not_null<StorageConfig const*> const& storage_config,
+ gsl::not_null<Storage const*> const& storage) noexcept
+ : storage_config_{*storage_config}, storage_{*storage} {}
[[nodiscard]] auto operator()() const -> IExecutionApi::Ptr {
- return IExecutionApi::Ptr{
- new LocalApi{&StorageConfig::Instance(), &storage_}};
+ return IExecutionApi::Ptr{new LocalApi{&storage_config_, &storage_}};
}
private:
- Storage const& storage_;
StorageConfig const& storage_config_;
+ Storage const& storage_;
};
} // namespace
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: No input, no output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: No input, no output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestNoInputNoOutput(api_factory, {}, /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: No input, create output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: No input, create output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestNoInputCreateOutput(api_factory, {}, /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: One input copied to output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: One input copied to output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestOneInputCopiedToOutput(api_factory, {}, /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: Non-zero exit code, create output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: Non-zero exit code, create output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestNonZeroExitCodeCreateOutput(api_factory, {});
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: Retrieve two identical trees to path",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: Retrieve two identical trees to path", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestRetrieveTwoIdenticalTreesToPath(
api_factory, {}, "two_trees", /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: Retrieve file and symlink with same content to "
- "path",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: Retrieve file and symlink with same content to path",
+ "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestRetrieveFileAndSymlinkWithSameContentToPath(
api_factory, {}, "file_and_symlink", /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: Retrieve mixed blobs and trees",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: Retrieve mixed blobs and trees", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestRetrieveMixedBlobsAndTrees(
api_factory, {}, "blobs_and_trees", /*is_hermetic=*/true);
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalAPI: Create directory prior to execution",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
- FactoryApi api_factory(&storage, &StorageConfig::Instance());
+TEST_CASE("LocalAPI: Create directory prior to execution", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+ FactoryApi api_factory(&storage_config.Get(), &storage);
+
TestCreateDirPriorToExecution(api_factory, {}, /*is_hermetic=*/true);
}
diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp
index 480b34df..bbd48ddc 100644
--- a/test/buildtool/execution_api/local/local_execution.test.cpp
+++ b/test/buildtool/execution_api/local/local_execution.test.cpp
@@ -28,7 +28,7 @@
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
-#include "test/utils/hermeticity/local.hpp"
+#include "test/utils/hermeticity/test_storage_config.hpp"
namespace {
@@ -58,13 +58,12 @@ inline void SetLauncher() {
} // namespace
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalExecution: No input, no output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("LocalExecution: No input, no output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
RepositoryConfig repo_config{};
- auto api = LocalApi(&StorageConfig::Instance(), &storage, &repo_config);
+ auto api = LocalApi(&storage_config.Get(), &storage, &repo_config);
std::string test_content("test");
std::vector<std::string> const cmdline = {"echo", "-n", test_content};
@@ -106,12 +105,13 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
}
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalExecution: No input, no output, env variables used",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("LocalExecution: No input, no output, env variables used",
+ "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+
RepositoryConfig repo_config{};
- auto api = LocalApi(&StorageConfig::Instance(), &storage, &repo_config);
+ auto api = LocalApi(&storage_config.Get(), &storage, &repo_config);
std::string test_content("test from env var");
std::vector<std::string> const cmdline = {
@@ -157,12 +157,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
}
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalExecution: No input, create output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("LocalExecution: No input, create output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+
RepositoryConfig repo_config{};
- auto api = LocalApi(&StorageConfig::Instance(), &storage, &repo_config);
+ auto api = LocalApi(&storage_config.Get(), &storage, &repo_config);
std::string test_content("test");
auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content);
@@ -214,12 +214,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
}
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalExecution: One input copied to output",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("LocalExecution: One input copied to output", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+
RepositoryConfig repo_config{};
- auto api = LocalApi(&StorageConfig::Instance(), &storage, &repo_config);
+ auto api = LocalApi(&storage_config.Get(), &storage, &repo_config);
std::string test_content("test");
auto test_digest = ArtifactDigest::Create<ObjectType::File>(test_content);
@@ -285,12 +285,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
}
}
-TEST_CASE_METHOD(HermeticLocalTestFixture,
- "LocalExecution: Cache failed action's result",
- "[execution_api]") {
- auto const storage = Storage::Create(&StorageConfig::Instance());
+TEST_CASE("LocalExecution: Cache failed action's result", "[execution_api]") {
+ auto const storage_config = TestStorageConfig::Create();
+ auto const storage = Storage::Create(&storage_config.Get());
+
RepositoryConfig repo_config{};
- auto api = LocalApi(&StorageConfig::Instance(), &storage, &repo_config);
+ auto api = LocalApi(&storage_config.Get(), &storage, &repo_config);
auto flag = GetTestDir() / "flag";
std::vector<std::string> const cmdline = {