Skip to content

Commit

Permalink
Fail reset-project test fast if NFS error persists
Browse files Browse the repository at this point in the history
The reset-project E2E test has a built-in retry to try to work around
the 404 errors we'd been getting from hgweb. If those are cauesd by NFS
directory caching, then we should stop using a retry so that we get
those 404 errors fast — if we're going to get them, that is.
  • Loading branch information
rmunn committed May 7, 2024
1 parent 4cbe550 commit f6165f7
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions frontend/tests/resetProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,14 @@ test('reset project and upload .zip file', async ({ page, tempProject, tempDir }
await resetProjectModel.assertGone();

// Step 2: Get tip hash and file list from hgweb, check some known values
// It can take a while for the server to pick up the new repo
let beforeResetJson: HgWebJson;
await expect(async () => {
const beforeResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`);
beforeResetJson = await beforeResetResponse.json() as HgWebJson;
expect(beforeResetJson).toHaveProperty('node');
expect(beforeResetJson.node).not.toEqual(allZeroHash);
expect(beforeResetJson).toHaveProperty('files');
expect(beforeResetJson.files).toHaveLength(1);
expect(beforeResetJson.files[0]).toHaveProperty('basename');
expect(beforeResetJson.files[0].basename).toBe('hello.txt');
}).toPass({
intervals: [1_000, 3_000, 5_000],
});
const beforeResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`);
const beforeResetJson = await beforeResetResponse.json() as HgWebJson;
expect(beforeResetJson).toHaveProperty('node');
expect(beforeResetJson.node).not.toEqual(allZeroHash);
expect(beforeResetJson).toHaveProperty('files');
expect(beforeResetJson.files).toHaveLength(1);
expect(beforeResetJson.files[0]).toHaveProperty('basename');
expect(beforeResetJson.files[0].basename).toBe('hello.txt');

// Step 3: reset project, do not upload zip file
await projectPage.goto();
Expand All @@ -65,16 +59,11 @@ test('reset project and upload .zip file', async ({ page, tempProject, tempDir }
await resetProjectModel.assertGone();

// Step 4: confirm it's empty now
// It can take a while for the server to pick up the new repo
await expect(async () => {
const afterResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`);
const afterResetJson = await afterResetResponse.json() as HgWebJson;
expect(afterResetJson.node).toEqual(allZeroHash);
expect(afterResetJson).toHaveProperty('files');
expect(afterResetJson.files).toHaveLength(0);
}).toPass({
intervals: [1_000, 3_000, 5_000],
});
const afterResetResponse = await page.request.get(`${testEnv.serverBaseUrl}/hg/${tempProject.code}/file/tip?style=json-lex`);
const afterResetJson = await afterResetResponse.json() as HgWebJson;
expect(afterResetJson.node).toEqual(allZeroHash);
expect(afterResetJson).toHaveProperty('files');
expect(afterResetJson.files).toHaveLength(0);

// Step 5: reset project again, uploading zip file downloaded from step 1
await projectPage.goto();
Expand Down

0 comments on commit f6165f7

Please sign in to comment.