summaryrefslogtreecommitdiff
path: root/test/laminar-functional.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2026-10-30 10:35:54 +0100
committerOliver Giles <ohw.giles@gmail.com>2026-11-02 11:27:47 +1300
commit9968f74ae957382d2c4e967564b307dbcc8eeaa2 (patch)
tree80301ab5db0dfacc320b7d44d993b1e611a6c72b /test/laminar-functional.cpp
parent9d928ccad8c89c6f22892d167ea3842173ef62d1 (diff)
downloadlaminar-master.tar.gz
laminar-master.zip
Fix page count underflow for jobs with no completed runsHEADlocal/laminarmaster
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.
Diffstat (limited to 'test/laminar-functional.cpp')
-rw-r--r--test/laminar-functional.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/laminar-functional.cpp b/test/laminar-functional.cpp
index e796d26..20da1ae 100644
--- a/test/laminar-functional.cpp
+++ b/test/laminar-functional.cpp
@@ -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");