Adjusting test case to eventually exit with an error after a reasonable time.

This commit is contained in:
Ian Roddis
2021-08-25 15:20:08 -03:00
parent 212bd80df2
commit fcdc225e28

View File

@@ -133,9 +133,8 @@ TEST_CASE("Server Basic Endpoints", "[server_basic]") {
}
// Wait until our DAG is complete
bool complete = false;
while (!complete) {
complete = true;
bool complete = true;
for (auto i = 0; i < 10; ++i) {
auto response = REQUEST(baseURL + "/v1/dagrun/" + std::to_string(runID));
REQUIRE(response.code() == Pistache::Http::Code::Ok);
rj::Document doc;
@@ -147,6 +146,7 @@ TEST_CASE("Server Basic Endpoints", "[server_basic]") {
const auto &taskStates = doc["taskStates"].GetArray();
REQUIRE(taskStates.Size() == 3);
complete = true;
for (size_t i = 0; i < taskStates.Size(); ++i) {
std::string state = taskStates[i].GetString();
if (state != "COMPLETED") {
@@ -154,8 +154,10 @@ TEST_CASE("Server Basic Endpoints", "[server_basic]") {
break;
}
}
if (complete) break;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
REQUIRE(complete);
std::this_thread::sleep_for(std::chrono::seconds(2));
for (const auto &pth : std::vector<fs::path>{"dagrun_A", "dagrun_B"}) {