diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-12 09:56:36 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-16 17:51:12 +0200 |
commit | ed0cd750a98a9334f95d99a5ba4ce3abe17538f1 (patch) | |
tree | 371a81a9c211cb103ff4e768ccace131f32ee5ee | |
parent | 0d65f1285899230497fa50efdaf4387092c08d61 (diff) | |
download | justbuild-ed0cd750a98a9334f95d99a5ba4ce3abe17538f1.tar.gz |
test: Reduce verbosity in config methods
As the classes describe the config type, their static creators can
have generic names, which reduces unnecessary verbosity.
15 files changed, 40 insertions, 40 deletions
diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp index 1c688b1e..949b3db0 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -101,7 +101,7 @@ TEST_CASE("simple targets", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -550,7 +550,7 @@ TEST_CASE("configuration deduplication", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -644,7 +644,7 @@ TEST_CASE("generator functions in string arguments", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -750,7 +750,7 @@ TEST_CASE("built-in rules", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -966,7 +966,7 @@ TEST_CASE("target reference", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -1115,7 +1115,7 @@ TEST_CASE("trees", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -1228,7 +1228,7 @@ TEST_CASE("RESULT error reporting", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; @@ -1400,7 +1400,7 @@ TEST_CASE("wrong arguments", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto serve_config = TestServeConfig::ReadFromEnvironment(); REQUIRE(serve_config); Auth auth{}; diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp index 073bf08d..8c2d6633 100644 --- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp @@ -25,7 +25,7 @@ namespace { auto const kApiFactory = []() { static auto const& server = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); return IExecutionApi::Ptr{new BazelApi{ "remote-execution", server->host, server->port, &*auth_config, {}}}; diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp index 85a23590..4cd5e13b 100644 --- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp @@ -32,7 +32,7 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") { std::string instance_name{"remote-execution"}; std::string content("test"); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); // Create CAS client diff --git a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp index fe9da14f..c1f70ecc 100755 --- a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp @@ -30,7 +30,7 @@ TEST_CASE("Bazel internals: Execution Client", "[execution_api]") { auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(content)); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); BazelExecutionClient execution_client( @@ -102,7 +102,7 @@ TEST_CASE("Bazel internals: Execution Client using env variables", auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(content)); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); BazelExecutionClient execution_client( diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index 54d99305..443ca30d 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -33,7 +33,7 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1; TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); std::string instance_name{"remote-execution"}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); auto network = BazelNetwork{instance_name, info->host, info->port, &*auth_config, {}}; @@ -81,7 +81,7 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); std::string instance_name{"remote-execution"}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); auto network = BazelNetwork{instance_name, info->host, info->port, &*auth_config, {}}; diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index 9903039b..3b936068 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -30,7 +30,7 @@ constexpr std::size_t kLargeSize = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + 1; TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); auto stream = ByteStreamClient{info->host, info->port, &*auth_config}; auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); @@ -110,7 +110,7 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); auto stream = ByteStreamClient{info->host, info->port, &*auth_config}; auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); diff --git a/test/buildtool/execution_engine/executor/executor_api_local.test.cpp b/test/buildtool/execution_engine/executor/executor_api_local.test.cpp index 7d645e0e..5c423dea 100644 --- a/test/buildtool/execution_engine/executor/executor_api_local.test.cpp +++ b/test/buildtool/execution_engine/executor/executor_api_local.test.cpp @@ -45,7 +45,7 @@ TEST_CASE("Executor<LocalApi>: Compile hello world", "[executor]") { RepositoryConfig repo_config{}; Statistics stats{}; Progress progress{}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestHelloWorldCompilation( &repo_config, @@ -65,7 +65,7 @@ TEST_CASE("Executor<LocalApi>: Compile greeter", "[executor]") { RepositoryConfig repo_config{}; Statistics stats{}; Progress progress{}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestGreeterCompilation( &repo_config, @@ -85,7 +85,7 @@ TEST_CASE("Executor<LocalApi>: Upload and download trees", "[executor]") { RepositoryConfig repo_config{}; Statistics stats{}; Progress progress{}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestUploadAndDownloadTrees( &repo_config, @@ -105,7 +105,7 @@ TEST_CASE("Executor<LocalApi>: Retrieve output directories", "[executor]") { RepositoryConfig repo_config{}; Statistics stats{}; Progress progress{}; - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestRetrieveOutputDirectories( &repo_config, 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 d2f41bf1..cdd47068 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 @@ -28,7 +28,7 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") { RepositoryConfig repo_config{}; ExecutionConfiguration config; auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestBlobUpload(&repo_config, [&] { @@ -46,7 +46,7 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestHelloWorldCompilation( @@ -73,7 +73,7 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestGreeterCompilation( @@ -100,7 +100,7 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestUploadAndDownloadTrees( @@ -127,7 +127,7 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") { auto const& info = RemoteExecutionConfig::RemoteAddress(); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestRetrieveOutputDirectories( diff --git a/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp b/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp index d1663c52..27e933de 100644 --- a/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp +++ b/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp @@ -41,7 +41,7 @@ TEST_CASE("Remote: Output created and contents are correct", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestHelloWorldCopyMessage( @@ -52,7 +52,7 @@ TEST_CASE("Remote: Output created when entry point is local artifact", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestCopyLocalFile( @@ -62,7 +62,7 @@ TEST_CASE("Remote: Output created when entry point is local artifact", TEST_CASE("Remote: Actions are not re-run", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestSequencePrinterBuildLibraryOnly( @@ -72,7 +72,7 @@ TEST_CASE("Remote: Actions are not re-run", "[graph_traverser]") { TEST_CASE("Remote: KNOWN artifact", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestHelloWorldWithKnownSource( @@ -82,7 +82,7 @@ TEST_CASE("Remote: KNOWN artifact", "[graph_traverser]") { TEST_CASE("Remote: Blobs uploaded and correctly used", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestBlobsUploadedAndUsed( @@ -93,7 +93,7 @@ TEST_CASE("Remote: Environment variables are set and used", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestEnvironmentVariablesSetAndUsed( @@ -103,7 +103,7 @@ TEST_CASE("Remote: Environment variables are set and used", TEST_CASE("Remote: Trees correctly used", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestTreesUsed( @@ -113,7 +113,7 @@ TEST_CASE("Remote: Trees correctly used", "[graph_traverser]") { TEST_CASE("Remote: Nested trees correctly used", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestNestedTreesUsed( @@ -123,7 +123,7 @@ TEST_CASE("Remote: Nested trees correctly used", "[graph_traverser]") { TEST_CASE("Remote: Detect flaky actions", "[graph_traverser]") { StorageConfig const storage_config = CreateConfig(); auto const storage = Storage::Create(&storage_config); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); REQUIRE(auth_config); TestFlakyHelloWorldDetected( diff --git a/test/buildtool/serve_api/source_tree_client.test.cpp b/test/buildtool/serve_api/source_tree_client.test.cpp index 970d2aca..e1f6d84b 100644 --- a/test/buildtool/serve_api/source_tree_client.test.cpp +++ b/test/buildtool/serve_api/source_tree_client.test.cpp @@ -32,7 +32,7 @@ auto const kRootSymId = std::string{"18770dacfe14c15d88450c21c16668e13ab0e7f9"}; auto const kBazSymId = std::string{"1868f82682c290f0b1db3cacd092727eef1fa57f"}; TEST_CASE("Serve service client: tree-of-commit request", "[serve_api]") { - auto config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto config = TestServeConfig::ReadFromEnvironment(); REQUIRE(config); REQUIRE(config->remote_address); diff --git a/test/utils/remote_execution/bazel_action_creator.hpp b/test/utils/remote_execution/bazel_action_creator.hpp index 38468535..1199a385 100644 --- a/test/utils/remote_execution/bazel_action_creator.hpp +++ b/test/utils/remote_execution/bazel_action_creator.hpp @@ -83,7 +83,7 @@ auto action_id = ArtifactDigest::Create<ObjectType::File>(action_data); blobs.emplace_back(action_id, action_data, /*is_exec=*/false); - auto auth_config = TestAuthConfig::ReadAuthConfigFromEnvironment(); + auto auth_config = TestAuthConfig::ReadFromEnvironment(); if (not auth_config) { return nullptr; } diff --git a/test/utils/remote_execution/main-remote-execution.cpp b/test/utils/remote_execution/main-remote-execution.cpp index 091a8038..e18ceb5a 100644 --- a/test/utils/remote_execution/main-remote-execution.cpp +++ b/test/utils/remote_execution/main-remote-execution.cpp @@ -45,7 +45,7 @@ void wait_for_grpc_to_shutdown() { ReadCompatibilityFromEnv(); // Ensure authentication config is available - if (not TestAuthConfig::ReadAuthConfigFromEnvironment()) { + if (not TestAuthConfig::ReadFromEnvironment()) { std::exit(EXIT_FAILURE); } diff --git a/test/utils/remote_execution/test_auth_config.hpp b/test/utils/remote_execution/test_auth_config.hpp index fd157f22..2f5cca25 100644 --- a/test/utils/remote_execution/test_auth_config.hpp +++ b/test/utils/remote_execution/test_auth_config.hpp @@ -26,7 +26,7 @@ class TestAuthConfig final { public: - [[nodiscard]] static auto ReadAuthConfigFromEnvironment() noexcept + [[nodiscard]] static auto ReadFromEnvironment() noexcept -> std::optional<Auth> { Auth::TLS::Builder tls_builder; auto config = tls_builder.SetCACertificate(ReadTLSAuthCACertFromEnv()) diff --git a/test/utils/serve_service/main-serve.cpp b/test/utils/serve_service/main-serve.cpp index a5e94826..5a08eb89 100644 --- a/test/utils/serve_service/main-serve.cpp +++ b/test/utils/serve_service/main-serve.cpp @@ -81,7 +81,7 @@ void wait_for_grpc_to_shutdown() { // remote execution, so no need to do those again // Ensure the config can be read from the environment - auto config = TestServeConfig::ReadServeConfigFromEnvironment(); + auto config = TestServeConfig::ReadFromEnvironment(); if (not config or not config->remote_address) { return false; } diff --git a/test/utils/serve_service/test_serve_config.hpp b/test/utils/serve_service/test_serve_config.hpp index c38c2dfe..4b94d0f7 100644 --- a/test/utils/serve_service/test_serve_config.hpp +++ b/test/utils/serve_service/test_serve_config.hpp @@ -26,7 +26,7 @@ class TestServeConfig final { public: - [[nodiscard]] static auto ReadServeConfigFromEnvironment() noexcept + [[nodiscard]] static auto ReadFromEnvironment() noexcept -> std::optional<RemoteServeConfig> { RemoteServeConfig::Builder builder; auto config = builder.SetRemoteAddress(ReadRemoteServeAddressFromEnv()) |