diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-25 17:02:03 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-30 12:10:06 +0200 |
commit | b5a92a60035ea3731a96bbdc8bca18986b558a05 (patch) | |
tree | 088d85e95d929b31cf74afb1a922b34c4afa7138 /test/buildtool/graph_traverser | |
parent | deba068d8692bf6d265926885de5601d72f5d461 (diff) | |
download | justbuild-b5a92a60035ea3731a96bbdc8bca18986b558a05.tar.gz |
Pass RemoteContext to ApiBundle
The CreateRemote method is also updated to receive all
remote-related information as arguments, such that it does not have
to rely on the ApiBundle internal fields which will eventually be
removed.
Diffstat (limited to 'test/buildtool/graph_traverser')
-rw-r--r-- | test/buildtool/graph_traverser/TARGETS | 1 | ||||
-rw-r--r-- | test/buildtool/graph_traverser/graph_traverser.test.hpp | 155 |
2 files changed, 115 insertions, 41 deletions
diff --git a/test/buildtool/graph_traverser/TARGETS b/test/buildtool/graph_traverser/TARGETS index 189ad233..1035fbcd 100644 --- a/test/buildtool/graph_traverser/TARGETS +++ b/test/buildtool/graph_traverser/TARGETS @@ -11,6 +11,7 @@ , ["@", "src", "src/buildtool/execution_api/local", "config"] , ["@", "src", "src/buildtool/execution_api/local", "context"] , ["@", "src", "src/buildtool/execution_api/remote", "config"] + , ["@", "src", "src/buildtool/execution_api/remote", "context"] , ["@", "src", "src/buildtool/file_system", "file_system_manager"] , ["@", "src", "src/buildtool/file_system", "jsonfs"] , ["@", "src", "src/buildtool/graph_traverser", "graph_traverser"] diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp index c28f3a6c..0f3de2e6 100644 --- a/test/buildtool/graph_traverser/graph_traverser.test.hpp +++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp @@ -35,6 +35,7 @@ #include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/execution_api/remote/config.hpp" +#include "src/buildtool/execution_api/remote/context.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/jsonfs.hpp" #include "src/buildtool/graph_traverser/graph_traverser.hpp" @@ -169,15 +170,24 @@ class TestProject { auto const local_exec_config = CreateLocalExecConfig(); auto const clargs = p.CmdLineArgs(); + Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -204,12 +214,6 @@ class TestProject { SECTION("Executable is retrieved as executable") { auto const clargs_exec = p.CmdLineArgs("_entry_points_get_executable"); - RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&local_context, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; GraphTraverser const gt_get_exec{clargs_exec.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -246,15 +250,24 @@ class TestProject { auto const local_exec_config = CreateLocalExecConfig(); auto const clargs = p.CmdLineArgs(); + Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -286,15 +299,24 @@ class TestProject { auto const local_exec_config = CreateLocalExecConfig(); auto const clargs = p.CmdLineArgs(); + Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -346,18 +368,25 @@ class TestProject { auto const local_exec_config = CreateLocalExecConfig(); auto const clargs_update_cpp = full_hello_world.CmdLineArgs("_entry_points_upload_source"); + Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{&local_context, - full_hello_world.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{ + &local_context, &remote_context, full_hello_world.GetRepoConfig()}; + GraphTraverser const gt_upload{clargs_update_cpp.gtargs, full_hello_world.GetRepoConfig(), remote_config->platform_properties, @@ -414,16 +443,25 @@ static void TestBlobsUploadedAndUsed( TestProject p("use_uploaded_blobs"); auto const clargs = p.CmdLineArgs(); - auto const local_exec_config = CreateLocalExecConfig(); Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + + auto const local_exec_config = CreateLocalExecConfig(); + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -462,16 +500,25 @@ static void TestEnvironmentVariablesSetAndUsed( TestProject p("use_env_variables"); auto const clargs = p.CmdLineArgs(); - auto const local_exec_config = CreateLocalExecConfig(); Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + + auto const local_exec_config = CreateLocalExecConfig(); + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -510,16 +557,25 @@ static void TestTreesUsed( TestProject p("use_trees"); auto const clargs = p.CmdLineArgs(); - auto const local_exec_config = CreateLocalExecConfig(); Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + + auto const local_exec_config = CreateLocalExecConfig(); + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -558,16 +614,25 @@ static void TestNestedTreesUsed( TestProject p("use_nested_trees"); auto const clargs = p.CmdLineArgs(); - auto const local_exec_config = CreateLocalExecConfig(); Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + + auto const local_exec_config = CreateLocalExecConfig(); + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; + GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -605,16 +670,24 @@ static void TestFlakyHelloWorldDetected( bool /*is_hermetic*/ = true) { TestProject p("flaky_hello_world"); - auto const local_exec_config = CreateLocalExecConfig(); Statistics stats{}; Progress progress{}; - RetryConfig retry_config{}; // default retry config + + auto const local_exec_config = CreateLocalExecConfig(); + // pack the local context instances to be passed to ApiBundle LocalContext const local_context{.exec_config = &local_exec_config, .storage_config = &storage_config, .storage = &storage}; - ApiBundle const apis{ - &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; + + RetryConfig retry_config{}; // default retry config + + // pack the remote context instances to be passed to ApiBundle + RemoteContext const remote_context{.auth = auth, + .retry_config = &retry_config, + .exec_config = remote_config}; + + ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()}; { auto clargs = p.CmdLineArgs("_entry_points_ctimes"); |