diff options
Diffstat (limited to 'test/buildtool/execution_engine/executor')
3 files changed, 41 insertions, 49 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS index ef01b6fc..ab257156 100644 --- a/test/buildtool/execution_engine/executor/TARGETS +++ b/test/buildtool/execution_engine/executor/TARGETS @@ -17,6 +17,7 @@ , ["@", "src", "src/buildtool/compatibility", "compatibility"] , ["@", "catch2", "", "catch2"] , ["@", "gsl", "", "gsl"] + , ["utils", "test_api_bundle"] , ["utils", "test_remote_config"] ] , "stage": ["test", "buildtool", "execution_engine", "executor"] @@ -42,6 +43,7 @@ , ["", "catch-main"] , ["@", "catch2", "", "catch2"] , ["@", "gsl", "", "gsl"] + , ["utils", "test_api_bundle"] ] , "stage": ["test", "buildtool", "execution_engine", "executor"] } diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 2e8a03aa..15752c94 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -35,6 +35,7 @@ #include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/progress_reporting/progress.hpp" +#include "test/utils/executor/test_api_bundle.hpp" /// \brief Mockup API test config. struct TestApiConfig { @@ -296,9 +297,9 @@ TEST_CASE("Executor: Process artifact", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -320,9 +321,9 @@ TEST_CASE("Executor: Process artifact", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -344,9 +345,9 @@ TEST_CASE("Executor: Process artifact", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -393,9 +394,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -420,9 +421,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -447,9 +448,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -477,9 +478,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -504,9 +505,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, @@ -534,9 +535,9 @@ TEST_CASE("Executor: Process action", "[executor]") { RemoteContext const remote_context{.auth = &auth, .retry_config = &retry_config, .exec_config = &remote_config}; + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{&repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, &stats, diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index 7bbc9d8f..bef97e85 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -38,6 +38,7 @@ #include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/progress_reporting/progress.hpp" +#include "test/utils/executor/test_api_bundle.hpp" #include "test/utils/remote_execution/test_remote_config.hpp" using ApiFactory = std::function<IExecutionApi::Ptr()>; @@ -147,13 +148,9 @@ static inline void RunHelloWorldCompilation( : HashFunction::Type::GitSHA1}; auto api = factory(); - Executor runner{repo_config, - api.get(), - api.get(), - &remote_context, - hash_function, - stats, - progress}; + auto const apis = CreateTestApiBundle(hash_function, api); + Executor runner{ + repo_config, &apis, &remote_context, hash_function, stats, progress}; // upload local artifacts auto const* main_cpp_node = g.ArtifactNodeWithId(main_cpp_id); @@ -281,13 +278,9 @@ static inline void RunGreeterCompilation( : HashFunction::Type::GitSHA1}; auto api = factory(); - Executor runner{repo_config, - api.get(), - api.get(), - &remote_context, - hash_function, - stats, - progress}; + auto const apis = CreateTestApiBundle(hash_function, api); + Executor runner{ + repo_config, &apis, &remote_context, hash_function, stats, progress}; // upload local artifacts for (auto const& id : {greet_hpp_id, greet_cpp_id, main_cpp_id}) { @@ -455,13 +448,9 @@ static inline void TestUploadAndDownloadTrees( .retry_config = &retry_config, .exec_config = &*remote_config}; - Executor runner{repo_config, - api.get(), - api.get(), - &remote_context, - hash_function, - stats, - progress}; + auto const apis = CreateTestApiBundle(hash_function, api); + Executor runner{ + repo_config, &apis, &remote_context, hash_function, stats, progress}; REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id))); REQUIRE(runner.Process(g.ArtifactNodeWithId(bar_id))); @@ -630,9 +619,9 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, stats, @@ -683,9 +672,9 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, stats, @@ -753,9 +742,9 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, stats, @@ -825,9 +814,9 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, stats, @@ -850,9 +839,9 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); + auto const apis = CreateTestApiBundle(hash_function, api); Executor runner{repo_config, - api.get(), - api.get(), + &apis, &remote_context, hash_function, stats, |