diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-13 14:13:01 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-18 12:05:10 +0200 |
commit | 05b734f11b7a45a1da5c38fcc1f27780c3fe4354 (patch) | |
tree | f784191e033ff0f32c79439e4036423d7d066ce2 /test/buildtool/build_engine/target_map/target_map.test.cpp | |
parent | 866391f5436488cec823ad6bc0a446c0c9d70625 (diff) | |
download | justbuild-05b734f11b7a45a1da5c38fcc1f27780c3fe4354.tar.gz |
Create an individual instance of RemoteServeConfig in tests
...instead of intialization of the singleton.
Diffstat (limited to 'test/buildtool/build_engine/target_map/target_map.test.cpp')
-rw-r--r-- | test/buildtool/build_engine/target_map/target_map.test.cpp | 41 |
1 files changed, 33 insertions, 8 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 b7b1e1e3..67f21c0b 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -36,6 +36,7 @@ #include "src/buildtool/serve_api/remote/serve_api.hpp" #include "src/buildtool/storage/storage.hpp" #include "test/utils/hermeticity/local.hpp" +#include "test/utils/serve_service/test_serve_config.hpp" namespace { @@ -94,7 +95,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "simple targets", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -533,7 +537,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -617,7 +624,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -711,7 +721,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "built-in rules", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -915,7 +928,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "target reference", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -1052,7 +1068,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "trees", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -1155,7 +1174,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, @@ -1315,7 +1337,10 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "wrong arguments", "[target_map]") { Statistics stats{}; Progress exports_progress{}; - auto serve = ServeApi::Create(RemoteServeConfig::Instance()); + auto serve_config = TestServeConfig::ReadServeConfigFromEnvironment(); + REQUIRE(serve_config); + + auto serve = ServeApi::Create(*serve_config); AnalyseContext ctx{.repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, |