fix: stabilize two CI test failures (Paris today, worker cancel race) #307
@@ -587,8 +587,8 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
|||||||
);
|
);
|
||||||
|
|
||||||
it('stops during calendar preparation without a plan or an obligation conflict', async () => {
|
it('stops during calendar preparation without a plan or an obligation conflict', async () => {
|
||||||
|
holdForCancelAtStage = 'preparation';
|
||||||
const stages: string[] = [];
|
const stages: string[] = [];
|
||||||
let preparationUpdates = 0;
|
|
||||||
const calculation = createPlanningCalculation({
|
const calculation = createPlanningCalculation({
|
||||||
horizon: { start: '2024-01-01', end: '2027-01-01' },
|
horizon: { start: '2024-01-01', end: '2027-01-01' },
|
||||||
balances: [],
|
balances: [],
|
||||||
@@ -596,7 +596,7 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
|||||||
declaredDays: [{ date: '2024-01-02', type: 'other' }],
|
declaredDays: [{ date: '2024-01-02', type: 'other' }],
|
||||||
progress: (stage) => {
|
progress: (stage) => {
|
||||||
stages.push(stage);
|
stages.push(stage);
|
||||||
if (stage === 'preparation' && ++preparationUpdates === 2) calculation.cancel();
|
if (stage === 'preparation') calculation.cancel();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const outcome = await calculation.outcome;
|
const outcome = await calculation.outcome;
|
||||||
@@ -606,7 +606,7 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
|||||||
});
|
});
|
||||||
if (outcome.kind !== 'PlanningIncomplete') return;
|
if (outcome.kind !== 'PlanningIncomplete') return;
|
||||||
expect(outcome.incumbent).toBeUndefined();
|
expect(outcome.incumbent).toBeUndefined();
|
||||||
expect(preparationUpdates).toBeGreaterThanOrEqual(2);
|
expect(stages).toContain('preparation');
|
||||||
expect(stages).not.toContain('obligations');
|
expect(stages).not.toContain('obligations');
|
||||||
expect(await calculation.explanationError).toBeUndefined();
|
expect(await calculation.explanationError).toBeUndefined();
|
||||||
expect(heartbeats).toBeGreaterThan(0);
|
expect(heartbeats).toBeGreaterThan(0);
|
||||||
|
|||||||
Reference in new issue
Block a user