diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-17 16:14:12 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-19 09:50:37 +0200 |
commit | c8394c2ffc3688356cf985d46e8ce56d72050f6a (patch) | |
tree | 2a5deb6ed40f3e8daca90c02711cbc3aba3f548c /test/buildtool/execution_engine/executor | |
parent | 31b782119138859c29ac8ff54bcfe19aa00fca42 (diff) | |
download | justbuild-c8394c2ffc3688356cf985d46e8ce56d72050f6a.tar.gz |
Remove the RetryConfig singleton
...and replace it with instances created early via a builder
pattern.
Diffstat (limited to 'test/buildtool/execution_engine/executor')
3 files changed, 49 insertions, 22 deletions
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 5d3a1b6e..c1e8f06a 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -283,13 +283,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -304,13 +305,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -325,13 +327,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -367,13 +370,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -391,13 +395,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -415,13 +420,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -442,13 +448,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -466,13 +473,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; @@ -493,13 +501,14 @@ TEST_CASE("Executor: Process action", "[executor]") { Statistics stats{}; Progress progress{}; Auth auth{}; + RetryConfig retry_config{}; // default retry config Executor runner{&repo_config, api.get(), api.get(), /*properties=*/{}, /*dispatch_list=*/{}, &auth, - &RetryConfig::Instance(), + &retry_config, &stats, &progress}; diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index 3fa1e113..e683f373 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -130,6 +130,8 @@ static inline void RunHelloWorldCompilation( auto remote_config = TestRemoteConfig::ReadFromEnvironment(); REQUIRE(remote_config); + RetryConfig retry_config{}; // default retry config + auto api = factory(); Executor runner{repo_config, api.get(), @@ -137,7 +139,7 @@ static inline void RunHelloWorldCompilation( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; @@ -257,6 +259,8 @@ static inline void RunGreeterCompilation( auto remote_config = TestRemoteConfig::ReadFromEnvironment(); REQUIRE(remote_config); + RetryConfig retry_config{}; // default retry config + auto api = factory(); Executor runner{repo_config, api.get(), @@ -264,7 +268,7 @@ static inline void RunGreeterCompilation( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; @@ -425,13 +429,15 @@ static inline void TestUploadAndDownloadTrees( auto remote_config = TestRemoteConfig::ReadFromEnvironment(); REQUIRE(remote_config); + RetryConfig retry_config{}; // default retry config + Executor runner{repo_config, api.get(), api.get(), remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id))); @@ -578,6 +584,8 @@ static inline void TestRetrieveOutputDirectories( auto remote_config = TestRemoteConfig::ReadFromEnvironment(); REQUIRE(remote_config); + RetryConfig retry_config{}; // default retry config + SECTION("entire action output as directory") { auto const make_tree_desc = create_action({}, {""}); auto const root_desc = @@ -599,7 +607,7 @@ static inline void TestRetrieveOutputDirectories( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; REQUIRE(runner.Process(action)); @@ -654,7 +662,7 @@ static inline void TestRetrieveOutputDirectories( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; REQUIRE(runner.Process(action)); @@ -726,7 +734,7 @@ static inline void TestRetrieveOutputDirectories( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; REQUIRE(runner.Process(action)); @@ -800,7 +808,7 @@ static inline void TestRetrieveOutputDirectories( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; CHECK_FALSE(runner.Process(action)); @@ -827,7 +835,7 @@ static inline void TestRetrieveOutputDirectories( remote_config->platform_properties, remote_config->dispatch, auth, - &RetryConfig::Instance(), + &retry_config, stats, progress}; CHECK_FALSE(runner.Process(action)); diff --git a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp index 424745de..dd6cc23e 100755 --- a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp +++ b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp @@ -37,12 +37,14 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") { auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); + RetryConfig retry_config{}; // default retry config + TestBlobUpload(&repo_config, [&] { return BazelApi::Ptr{new BazelApi{"remote-execution", remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }); } @@ -61,6 +63,8 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") { auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); + RetryConfig retry_config{}; // default retry config + TestHelloWorldCompilation( &repo_config, &stats, @@ -71,7 +75,7 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }, &*auth_config, @@ -92,6 +96,8 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") { auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); + RetryConfig retry_config{}; // default retry config + TestGreeterCompilation( &repo_config, &stats, @@ -102,7 +108,7 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }, &*auth_config, @@ -123,6 +129,8 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") { auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); + RetryConfig retry_config{}; // default retry config + TestUploadAndDownloadTrees( &repo_config, &stats, @@ -133,7 +141,7 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }, &*auth_config, @@ -154,6 +162,8 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") { auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); + RetryConfig retry_config{}; // default retry config + TestRetrieveOutputDirectories( &repo_config, &stats, @@ -164,7 +174,7 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }, &*auth_config, |