Fix two-planes e2e fuel 409s: refuel before return leg; healPlaneHome retries after refuel (ISS-055)
CI / build + unit + e2e (pull_request) Failing after 17m3s
CI / build + unit + e2e (pull_request) Failing after 17m3s
This commit is contained in:
+10
-1
@@ -226,7 +226,13 @@ async function healPlaneHome(page: Page, planeId: string): Promise<void> {
|
|||||||
if (p.locationIcao !== HUB) {
|
if (p.locationIcao !== HUB) {
|
||||||
// ISS-057: the landing above slowed the sim to 1× — setScale restores 1000× for the return leg.
|
// ISS-057: the landing above slowed the sim to 1× — setScale restores 1000× for the return leg.
|
||||||
await setScale(page, SCALE);
|
await setScale(page, SCALE);
|
||||||
expect((await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } })).status()).toBe(200);
|
let flyHome = await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } });
|
||||||
|
if (flyHome.status() === 409) {
|
||||||
|
// A long outbound leg can leave the tank too empty for the return — top up and retry.
|
||||||
|
expect((await page.request.post(`/api/planes/${planeId}/refuel`)).status()).toBe(200);
|
||||||
|
flyHome = await page.request.post(`/api/planes/${planeId}/fly`, { data: { destIcao: HUB } });
|
||||||
|
}
|
||||||
|
expect(flyHome.status()).toBe(200);
|
||||||
await expect
|
await expect
|
||||||
.poll(async () => ((await getState(page)).planes.find((x) => x.id === planeId)?.locationIcao ?? ''), {
|
.poll(async () => ((await getState(page)).planes.find((x) => x.id === planeId)?.locationIcao ?? ''), {
|
||||||
timeout: 240_000,
|
timeout: 240_000,
|
||||||
@@ -374,6 +380,9 @@ test('two planes fly in parallel; the last landing slows to 1× and the next dis
|
|||||||
expect(landed.packages.find((p) => p.id === pkgA.id)?.status).toBe('delivered');
|
expect(landed.packages.find((p) => p.id === pkgA.id)?.status).toBe('delivered');
|
||||||
expect(landed.packages.find((p) => p.id === pkgB.id)?.status).toBe('delivered');
|
expect(landed.packages.find((p) => p.id === pkgB.id)?.status).toBe('delivered');
|
||||||
|
|
||||||
|
// The outbound to the range edge left the tank nearly empty — top up for the return leg.
|
||||||
|
expect((await page.request.post(`/api/planes/${secondId}/refuel`)).status()).toBe(200);
|
||||||
|
|
||||||
// Resume semantics: with the starter still grounded, dispatching the second plane does NOT resume…
|
// Resume semantics: with the starter still grounded, dispatching the second plane does NOT resume…
|
||||||
const flyB2 = await page.request.post(`/api/planes/${secondId}/fly`, { data: { destIcao: HUB } });
|
const flyB2 = await page.request.post(`/api/planes/${secondId}/fly`, { data: { destIcao: HUB } });
|
||||||
expect(flyB2.status()).toBe(200);
|
expect(flyB2.status()).toBe(200);
|
||||||
|
|||||||
Reference in New Issue
Block a user