Merge pull request #50313 from ClickHouse/fix-flaky-async-loader-test

Fix flaky `AsyncLoader.StaticPriorities` unit test
This commit is contained in:
Sergei Trifonov 2023-05-29 13:42:15 +02:00 committed by GitHub
commit 688f23b325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -616,6 +616,15 @@ TEST(AsyncLoader, StaticPriorities)
schedule += fmt::format("{}{}", self->name, self->pool()); schedule += fmt::format("{}{}", self->name, self->pool());
}; };
// Job DAG with priorities. After priority inheritance from H9, jobs D9 and E9 can be
// executed in undefined order (Tested further in DynamicPriorities)
// A0(9) -+-> B3
// |
// `-> C4
// |
// `-> D1(9) -.
// | +-> F0(9) --> G0(9) --> H9
// `-> E2(9) -'
std::vector<LoadJobPtr> jobs; std::vector<LoadJobPtr> jobs;
jobs.push_back(makeLoadJob({}, 0, "A", job_func)); // 0 jobs.push_back(makeLoadJob({}, 0, "A", job_func)); // 0
jobs.push_back(makeLoadJob({ jobs[0] }, 3, "B", job_func)); // 1 jobs.push_back(makeLoadJob({ jobs[0] }, 3, "B", job_func)); // 1
@ -629,8 +638,7 @@ TEST(AsyncLoader, StaticPriorities)
t.loader.start(); t.loader.start();
t.loader.wait(); t.loader.wait();
ASSERT(schedule == "A9E9D9F9G9H9C4B3" || schedule == "A9D9E9F9G9H9C4B3");
ASSERT_EQ(schedule, "A9E9D9F9G9H9C4B3");
} }
TEST(AsyncLoader, SimplePrioritization) TEST(AsyncLoader, SimplePrioritization)