From c8394c2ffc3688356cf985d46e8ce56d72050f6a Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 17 Jul 2024 16:14:12 +0200 Subject: Remove the RetryConfig singleton ...and replace it with instances created early via a builder pattern. --- .../execution_engine/executor/executor.test.cpp | 27 ++++++++++++++-------- .../executor/executor_api.test.hpp | 24 ++++++++++++------- .../executor/executor_api_remote_bazel.test.cpp | 20 ++++++++++++---- 3 files changed, 49 insertions(+), 22 deletions(-) (limited to '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 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: 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: 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: 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: 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: 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: 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: 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: 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: Retrieve output directories", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, - &RetryConfig::Instance(), + &retry_config, config}}; }, &*auth_config, -- cgit v1.2.3