From d202e8f6051df5eb89d0f2eb1b9ac7109d204f56 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 2 Jul 2024 13:21:14 +0200 Subject: Remove HermeticLocalTestFixture ...and create StorageConfig and Storage in place if needed. --- .../execution_api/local/local_execution.test.cpp | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'test/buildtool/execution_api/local/local_execution.test.cpp') 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 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 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(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(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 const cmdline = { -- cgit v1.2.3