1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-11-02 16:44:45 +00:00

Fix page count underflow for jobs with no completed runs

The job status page computes the number of pages as
(nRuns-1) / runsPerPage + 1 with nRuns unsigned. A job whose first
run is still in progress has no completed builds, so nRuns is 0 and
the subtraction wraps, displaying "Page 1 of 214748365". Report a
single page in that case, and add a functional test for it.
This commit is contained in:
Petr Mrázek
2026-10-30 10:35:54 +01:00
committed by Oliver Giles
parent 9d928ccad8
commit 9968f74ae9
2 changed files with 13 additions and 1 deletions

View File

@@ -163,6 +163,18 @@ TEST_F(LaminarFixture, JobDescription) {
EXPECT_STREQ("bar", data["description"].GetString());
}
TEST_F(LaminarFixture, JobPagesWithoutRuns) {
defineJob("foo", "true");
auto es = eventSource("/jobs/foo");
ioContext->waitScope.poll();
ASSERT_EQ(1, es->messages().size());
auto json = es->messages().front().GetObject();
ASSERT_TRUE(json.HasMember("data"));
auto data = json["data"].GetObject();
ASSERT_TRUE(data.HasMember("pages"));
EXPECT_EQ(1, data["pages"].GetInt());
}
TEST_F(LaminarFixture, QueueFront) {
setNumExecutors(0);
defineJob("foo", "true");