summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_engine/executor
diff options
context:
space:
mode:
Diffstat (limited to 'test/buildtool/execution_engine/executor')
-rw-r--r--test/buildtool/execution_engine/executor/TARGETS20
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp90
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp32
-rwxr-xr-xtest/buildtool/execution_engine/executor/executor_api_local.test.cpp62
-rwxr-xr-xtest/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp66
5 files changed, 223 insertions, 47 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS
index 57ef9b44..0cca077d 100644
--- a/test/buildtool/execution_engine/executor/TARGETS
+++ b/test/buildtool/execution_engine/executor/TARGETS
@@ -2,6 +2,21 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["executor_api_tests"]
, "hdrs": ["executor_api.test.hpp"]
+ , "deps":
+ [ ["@", "src", "src/buildtool/auth", "auth"]
+ , ["@", "src", "src/buildtool/common", "artifact_description"]
+ , ["@", "src", "src/buildtool/common", "artifact_factory"]
+ , ["@", "src", "src/buildtool/common", "common"]
+ , ["@", "src", "src/buildtool/execution_api/common", "common"]
+ , ["@", "src", "src/buildtool/execution_api/remote", "config"]
+ , ["@", "src", "src/buildtool/execution_engine/dag", "dag"]
+ , ["@", "src", "src/buildtool/execution_engine/executor", "executor"]
+ , ["@", "src", "src/buildtool/file_system", "file_system_manager"]
+ , ["@", "src", "src/buildtool/progress_reporting", "progress"]
+ , ["utils", "test_env"]
+ , ["@", "catch2", "", "catch2"]
+ , ["@", "gsl", "", "gsl"]
+ ]
, "stage": ["test", "buildtool", "execution_engine", "executor"]
}
, "executor":
@@ -29,12 +44,11 @@
, "data": ["test_data"]
, "private-deps":
[ "executor_api_tests"
- , ["@", "src", "src/buildtool/common", "artifact_factory"]
+ , ["@", "src", "src/buildtool/auth", "auth"]
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/common", "config"]
, ["@", "src", "src/buildtool/execution_api/local", "local"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
- , ["@", "src", "src/buildtool/execution_engine/dag", "dag"]
, ["@", "src", "src/buildtool/execution_engine/executor", "executor"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
, ["utils", "catch-main-remote-execution"]
@@ -50,7 +64,7 @@
, "data": ["test_data"]
, "private-deps":
[ "executor_api_tests"
- , ["@", "src", "src/buildtool/common", "artifact_factory"]
+ , ["@", "src", "src/buildtool/auth", "auth"]
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/common", "config"]
, ["@", "src", "src/buildtool/execution_api/remote", "bazel"]
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index f063ffe4..a55c398d 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -280,8 +280,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -293,8 +299,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(not runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -306,8 +318,14 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(not runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -342,8 +360,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -358,8 +382,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -374,8 +404,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -393,8 +429,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -409,8 +451,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -428,8 +476,14 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = TestApi::Ptr{new TestApi{config}};
Statistics stats{};
Progress progress{};
- Executor runner{
- &repo_config, api.get(), api.get(), {}, {}, &stats, &progress};
+ Executor runner{&repo_config,
+ api.get(),
+ api.get(),
+ /*properties=*/{},
+ /*dispatch_list=*/{},
+ /*auth=*/nullptr,
+ &stats,
+ &progress};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index 8c3c84ca..db80e861 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -24,6 +24,7 @@
#include "catch2/catch_test_macros.hpp"
#include "gsl/gsl"
+#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_description.hpp"
#include "src/buildtool/common/artifact_factory.hpp"
@@ -93,6 +94,7 @@ static inline void RunHelloWorldCompilation(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
bool is_hermetic = true,
int expected_queued = 0,
int expected_cached = 0) {
@@ -131,6 +133,7 @@ static inline void RunHelloWorldCompilation(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
@@ -165,6 +168,7 @@ static inline void RunGreeterCompilation(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
std::string const& greetcpp,
bool is_hermetic = true,
int expected_queued = 0,
@@ -251,6 +255,7 @@ static inline void RunGreeterCompilation(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
@@ -298,18 +303,19 @@ static inline void RunGreeterCompilation(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
bool is_hermetic = true) {
SetupConfig(repo_config);
// expecting 1 action queued, 0 results from cache
// NOLINTNEXTLINE
RunHelloWorldCompilation(
- repo_config, stats, progress, factory, is_hermetic, 1, 0);
+ repo_config, stats, progress, factory, auth, is_hermetic, 1, 0);
SECTION("Running same compilation again") {
// expecting 2 actions queued, 1 result from cache
// NOLINTNEXTLINE
RunHelloWorldCompilation(
- repo_config, stats, progress, factory, is_hermetic, 2, 1);
+ repo_config, stats, progress, factory, auth, is_hermetic, 2, 1);
}
}
@@ -318,12 +324,20 @@ static inline void RunGreeterCompilation(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
bool is_hermetic = true) {
SetupConfig(repo_config);
// expecting 3 action queued, 0 results from cache
// NOLINTNEXTLINE
- RunGreeterCompilation(
- repo_config, stats, progress, factory, "greet.cpp", is_hermetic, 3, 0);
+ RunGreeterCompilation(repo_config,
+ stats,
+ progress,
+ factory,
+ auth,
+ "greet.cpp",
+ is_hermetic,
+ 3,
+ 0);
SECTION("Running same compilation again") {
// expecting 6 actions queued, 3 results from cache
@@ -331,6 +345,7 @@ static inline void RunGreeterCompilation(
stats,
progress,
factory,
+ auth,
"greet.cpp",
is_hermetic,
6, // NOLINT
@@ -343,6 +358,7 @@ static inline void RunGreeterCompilation(
stats,
progress,
factory,
+ auth,
"greet_mod.cpp",
is_hermetic,
6, // NOLINT
@@ -355,6 +371,7 @@ static inline void TestUploadAndDownloadTrees(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
bool /*is_hermetic*/ = true,
int /*expected_queued*/ = 0,
int /*expected_cached*/ = 0) {
@@ -399,6 +416,7 @@ static inline void TestUploadAndDownloadTrees(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id)));
@@ -507,6 +525,7 @@ static inline void TestRetrieveOutputDirectories(
gsl::not_null<Statistics*> const& stats,
gsl::not_null<Progress*> const& progress,
ApiFactory const& factory,
+ Auth::TLS const* auth,
bool /*is_hermetic*/ = true,
int /*expected_queued*/ = 0,
int /*expected_cached*/ = 0) {
@@ -560,6 +579,7 @@ static inline void TestRetrieveOutputDirectories(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -610,6 +630,7 @@ static inline void TestRetrieveOutputDirectories(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -676,6 +697,7 @@ static inline void TestRetrieveOutputDirectories(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -747,6 +769,7 @@ static inline void TestRetrieveOutputDirectories(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
CHECK_FALSE(runner.Process(action));
@@ -771,6 +794,7 @@ static inline void TestRetrieveOutputDirectories(
api.get(),
RemoteExecutionConfig::PlatformProperties(),
RemoteExecutionConfig::DispatchList(),
+ auth,
stats,
progress};
CHECK_FALSE(runner.Process(action));
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 670a3fa7..b6ffe2d7 100755
--- a/test/buildtool/execution_engine/executor/executor_api_local.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor_api_local.test.cpp
@@ -13,8 +13,10 @@
// limitations under the License.
#include <memory>
+#include <optional>
#include "catch2/catch_test_macros.hpp"
+#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/execution_api/local/local_api.hpp"
@@ -38,9 +40,18 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
RepositoryConfig repo_config{};
Statistics stats{};
Progress progress{};
- TestHelloWorldCompilation(&repo_config, &stats, &progress, [&] {
- return std::make_unique<LocalApi>(&repo_config);
- });
+
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
+ TestHelloWorldCompilation(
+ &repo_config,
+ &stats,
+ &progress,
+ [&] { return std::make_unique<LocalApi>(&repo_config); },
+ auth ? &*auth : nullptr);
}
TEST_CASE_METHOD(HermeticLocalTestFixture,
@@ -49,9 +60,18 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
RepositoryConfig repo_config{};
Statistics stats{};
Progress progress{};
- TestGreeterCompilation(&repo_config, &stats, &progress, [&] {
- return std::make_unique<LocalApi>(&repo_config);
- });
+
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
+ TestGreeterCompilation(
+ &repo_config,
+ &stats,
+ &progress,
+ [&] { return std::make_unique<LocalApi>(&repo_config); },
+ auth ? &*auth : nullptr);
}
TEST_CASE_METHOD(HermeticLocalTestFixture,
@@ -60,9 +80,18 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
RepositoryConfig repo_config{};
Statistics stats{};
Progress progress{};
- TestUploadAndDownloadTrees(&repo_config, &stats, &progress, [&] {
- return std::make_unique<LocalApi>(&repo_config);
- });
+
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
+ TestUploadAndDownloadTrees(
+ &repo_config,
+ &stats,
+ &progress,
+ [&] { return std::make_unique<LocalApi>(&repo_config); },
+ auth ? &*auth : nullptr);
}
TEST_CASE_METHOD(HermeticLocalTestFixture,
@@ -71,7 +100,16 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
RepositoryConfig repo_config{};
Statistics stats{};
Progress progress{};
- TestRetrieveOutputDirectories(&repo_config, &stats, &progress, [&] {
- return std::make_unique<LocalApi>(&repo_config);
- });
+
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
+ TestRetrieveOutputDirectories(
+ &repo_config,
+ &stats,
+ &progress,
+ [&] { return std::make_unique<LocalApi>(&repo_config); },
+ auth ? &*auth : nullptr);
}
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 56094fc3..83554e64 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
@@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <optional>
+
#include "catch2/catch_test_macros.hpp"
+#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp"
@@ -25,10 +28,17 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") {
RepositoryConfig repo_config{};
ExecutionConfiguration config;
auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
TestBlobUpload(&repo_config, [&] {
- return BazelApi::Ptr{
- new BazelApi{"remote-execution", info->host, info->port, config}};
+ return BazelApi::Ptr{new BazelApi{"remote-execution",
+ info->host,
+ info->port,
+ auth ? &*auth : nullptr,
+ config}};
});
}
@@ -41,14 +51,23 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
TestHelloWorldCompilation(
&repo_config,
&stats,
&progress,
[&] {
- return BazelApi::Ptr{new BazelApi{
- "remote-execution", info->host, info->port, config}};
+ return BazelApi::Ptr{new BazelApi{"remote-execution",
+ info->host,
+ info->port,
+ auth ? &*auth : nullptr,
+ config}};
},
+ auth ? &*auth : nullptr,
false /* not hermetic */);
}
@@ -61,14 +80,23 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
TestGreeterCompilation(
&repo_config,
&stats,
&progress,
[&] {
- return BazelApi::Ptr{new BazelApi{
- "remote-execution", info->host, info->port, config}};
+ return BazelApi::Ptr{new BazelApi{"remote-execution",
+ info->host,
+ info->port,
+ auth ? &*auth : nullptr,
+ config}};
},
+ auth ? &*auth : nullptr,
false /* not hermetic */);
}
@@ -81,14 +109,23 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
TestUploadAndDownloadTrees(
&repo_config,
&stats,
&progress,
[&] {
- return BazelApi::Ptr{new BazelApi{
- "remote-execution", info->host, info->port, config}};
+ return BazelApi::Ptr{new BazelApi{"remote-execution",
+ info->host,
+ info->port,
+ auth ? &*auth : nullptr,
+ config}};
},
+ auth ? &*auth : nullptr,
false /* not hermetic */);
}
@@ -101,13 +138,22 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") {
auto const& info = RemoteExecutionConfig::RemoteAddress();
+ std::optional<Auth::TLS> auth = {};
+ if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) {
+ auth = Auth::TLS::Instance();
+ }
+
TestRetrieveOutputDirectories(
&repo_config,
&stats,
&progress,
[&] {
- return BazelApi::Ptr{new BazelApi{
- "remote-execution", info->host, info->port, config}};
+ return BazelApi::Ptr{new BazelApi{"remote-execution",
+ info->host,
+ info->port,
+ auth ? &*auth : nullptr,
+ config}};
},
+ auth ? &*auth : nullptr,
false /* not hermetic */);
}