From 49c2382ea5ea45966ef15140fce6ad89672e956c Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 12 Sep 2024 17:45:14 +0200 Subject: execution_response: Allow failures to be reported while populating As populating the containers from remote response only takes place once, no assumptions should be made that this cannot fail (for example if wrong or invalid entries were produced). Instead, return error messages on failure to callers that can log accordingly. --- .../execution_api/local/local_execution.test.cpp | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'test/buildtool/execution_api/local/local_execution.test.cpp') diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp index 120100de..28fd03c6 100644 --- a/test/buildtool/execution_api/local/local_execution.test.cpp +++ b/test/buildtool/execution_api/local/local_execution.test.cpp @@ -211,9 +211,10 @@ TEST_CASE("LocalExecution: No input, create output", "[execution_api]") { // verify result CHECK_FALSE(output->IsCached()); - auto artifacts = output->Artifacts(); - REQUIRE(artifacts.contains(output_path)); - CHECK(artifacts.at(output_path).digest == test_digest); + auto const artifacts = output->Artifacts(); + REQUIRE(artifacts.has_value()); + REQUIRE(artifacts.value()->contains(output_path)); + CHECK(artifacts.value()->at(output_path).digest == test_digest); // ensure result IS in cache output = action->Execute(nullptr); @@ -229,9 +230,10 @@ TEST_CASE("LocalExecution: No input, create output", "[execution_api]") { // verify result CHECK_FALSE(output->IsCached()); - auto artifacts = output->Artifacts(); - REQUIRE(artifacts.contains(output_path)); - CHECK(artifacts.at(output_path).digest == test_digest); + auto const artifacts = output->Artifacts(); + REQUIRE(artifacts.has_value()); + REQUIRE(artifacts.value()->contains(output_path)); + CHECK(artifacts.value()->at(output_path).digest == test_digest); // ensure result IS STILL NOT in cache output = action->Execute(nullptr); @@ -290,9 +292,10 @@ TEST_CASE("LocalExecution: One input copied to output", "[execution_api]") { // verify result CHECK_FALSE(output->IsCached()); - auto artifacts = output->Artifacts(); - REQUIRE(artifacts.contains(output_path)); - CHECK(artifacts.at(output_path).digest == test_digest); + auto const artifacts = output->Artifacts(); + REQUIRE(artifacts.has_value()); + REQUIRE(artifacts.value()->contains(output_path)); + CHECK(artifacts.value()->at(output_path).digest == test_digest); // ensure result IS in cache output = action->Execute(nullptr); @@ -308,9 +311,10 @@ TEST_CASE("LocalExecution: One input copied to output", "[execution_api]") { // verify result CHECK_FALSE(output->IsCached()); - auto artifacts = output->Artifacts(); - REQUIRE(artifacts.contains(output_path)); - CHECK(artifacts.at(output_path).digest == test_digest); + auto const artifacts = output->Artifacts(); + REQUIRE(artifacts.has_value()); + REQUIRE(artifacts.value()->contains(output_path)); + CHECK(artifacts.value()->at(output_path).digest == test_digest); // ensure result IS STILL NOT in cache output = action->Execute(nullptr); -- cgit v1.2.3