update tests
This commit is contained in:
1 parent
b9fd29b906
commit
2b6734bb78
1 file changed
+17
-2
@@ -486,10 +486,25 @@ describe("SuperSimpleQueue", () => {
|
|||||||
// ── getMetrics ───────────────────────────────────────────────────────────
|
// ── getMetrics ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe("getMetrics", () => {
|
describe("getMetrics", () => {
|
||||||
it("returns empty metrics when no jobs", async () => {
|
it("returns empty job metrics plus this process as the sole worker when no jobs", async () => {
|
||||||
const { queue } = createQueue();
|
const { queue } = createQueue();
|
||||||
const metrics = await queue.getMetrics();
|
const metrics = await queue.getMetrics();
|
||||||
expect(metrics).toEqual({ jobs: 0, activeJobs: 0, failingJobs: 0, jobsWithFailures: [], totalRuns: 0, totalFailures: 0, workers: [] });
|
expect(metrics).toEqual({
|
||||||
|
jobs: 0,
|
||||||
|
activeJobs: 0,
|
||||||
|
failingJobs: 0,
|
||||||
|
jobsWithFailures: [],
|
||||||
|
totalRuns: 0,
|
||||||
|
totalFailures: 0,
|
||||||
|
workers: [
|
||||||
|
{
|
||||||
|
// hostname:pid:uuid, matching less-simple-scheduler's workerId format
|
||||||
|
workerId: expect.stringMatching(/^.+:\d+:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),
|
||||||
|
mode: "primary",
|
||||||
|
lastSeenAt: expect.any(Number),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("aggregates metrics from jobs", async () => {
|
it("aggregates metrics from jobs", async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user