Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion e2e/storage/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ export async function putTextObject(
}

export async function putDirectoryMarker(client: S3Client, bucket: string, key: string) {
await client.send(new PutObjectCommand({ Bucket: bucket, Key: key, Body: '' }));
// The SDK sets no Content-Length for a falsy body, so '' triggers its stream warning.
await client.send(
new PutObjectCommand({ Bucket: bucket, Key: key, Body: Buffer.alloc(0), ContentLength: 0 })
);
}

export async function deleteKnownKeys(client: S3Client, bucket: string, keys: string[]) {
Expand Down
3 changes: 2 additions & 1 deletion e2e/storage/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ test.describe('Storage S3 — Upload', () => {
const warning = page.getByRole('dialog', { name: 'Upload in progress' });
await page.goBack();
await expect(warning).toBeVisible();
expect(page.url()).toBe(browseUrl);
// SvelteKit restores the URL of a cancelled Back asynchronously.
await expect(page).toHaveURL(browseUrl);
await warning.getByRole('button', { name: 'Stay' }).click();
await expect(warning).toBeHidden();
await expect(page.getByRole('heading', { name: 'Upload', exact: true })).toBeVisible();
Expand Down
12 changes: 11 additions & 1 deletion e2e/support/garage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,17 @@ async function ensureBucket(bucketName: string): Promise<string> {
return existingId;
}

const created = await adminPost('/v2/CreateBucket', { globalAlias: bucketName });
let created: unknown;
try {
created = await adminPost('/v2/CreateBucket', { globalAlias: bucketName });
} catch (err) {
// Another worker may have created the bucket since the lookup above.
const racedId = await findBucketId(bucketName);
if (racedId) {
return racedId;
}
throw err;
}
const createdId = readString(created, ['id', 'bucketId', 'bucket_id']);

if (createdId) {
Expand Down
Loading