diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-24 17:09:01 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-31 17:15:46 +0100 |
commit | 66df7f4956c6fe1823eb43d31c3cbac7d8716125 (patch) | |
tree | 3f8bf106b3e189eeb4cfa01f97e8f9bb18678406 /test | |
parent | 3dc81b4b5a89f4e37af45ec9954723c79c3017cf (diff) | |
download | justbuild-66df7f4956c6fe1823eb43d31c3cbac7d8716125.tar.gz |
just-mr: Failure in serve api root tree requests should be fatal
The requests to retrieve the tree of a commit, archive, or distdir
also set up those trees in a way that the serve endpoint can later
build against them, besides allowing just-mr to set up roots
locally. Therefore, if the witnessing entity (Git commit, content
blob, or distdir, respectively) is known to the serve endpoint,
then failing to set up the root tree there should result in a
failure also of the just-mr setup on the client side.
Diffstat (limited to 'test')
-rw-r--r-- | test/buildtool/serve_api/source_tree_client.test.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/test/buildtool/serve_api/source_tree_client.test.cpp b/test/buildtool/serve_api/source_tree_client.test.cpp index 8c1e3b30..bc8bfad1 100644 --- a/test/buildtool/serve_api/source_tree_client.test.cpp +++ b/test/buildtool/serve_api/source_tree_client.test.cpp @@ -36,33 +36,35 @@ TEST_CASE("Serve service client: tree-of-commit request", "[serve_api]") { SECTION("Commit in bare checkout") { auto root_id = st_client.ServeCommitTree(kRootCommit, ".", false); - REQUIRE(root_id); - CHECK(root_id.value() == kRootId); + REQUIRE(std::holds_alternative<std::string>(root_id)); + CHECK(std::get<std::string>(root_id) == kRootId); auto baz_id = st_client.ServeCommitTree(kRootCommit, "baz", false); - REQUIRE(baz_id); - CHECK(baz_id.value() == kBazId); + REQUIRE(std::holds_alternative<std::string>(baz_id)); + CHECK(std::get<std::string>(baz_id) == kBazId); } SECTION("Commit in non-bare checkout") { auto root_id = st_client.ServeCommitTree(kRootSymCommit, ".", false); - REQUIRE(root_id); - CHECK(root_id.value() == kRootSymId); + REQUIRE(std::holds_alternative<std::string>(root_id)); + CHECK(std::get<std::string>(root_id) == kRootSymId); auto baz_id = st_client.ServeCommitTree(kRootSymCommit, "baz", false); - REQUIRE(baz_id); - CHECK(baz_id.value() == kBazSymId); + REQUIRE(std::holds_alternative<std::string>(baz_id)); + CHECK(std::get<std::string>(baz_id) == kBazSymId); } SECTION("Subdir not found") { auto root_id = st_client.ServeCommitTree(kRootCommit, "does_not_exist", false); - CHECK_FALSE(root_id); + REQUIRE(std::holds_alternative<bool>(root_id)); + CHECK(std::get<bool>(root_id)); // fatal failure } SECTION("Commit not known") { auto root_id = st_client.ServeCommitTree( "0123456789abcdef0123456789abcdef01234567", ".", false); - CHECK_FALSE(root_id); + REQUIRE(std::holds_alternative<bool>(root_id)); + CHECK_FALSE(std::get<bool>(root_id)); // non-fatal failure } } |