From 3a56fb9de44554d4cbe9ec0ce91df2878a62438b Mon Sep 17 00:00:00 2001 From: tomcrane Date: Wed, 11 Sep 2024 13:10:26 +0100 Subject: [PATCH] We need to wait for the deposit to finish! --- LeedsPrototypeTests/tests/exporting.spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/LeedsPrototypeTests/tests/exporting.spec.ts b/LeedsPrototypeTests/tests/exporting.spec.ts index 530d3bc..9536141 100644 --- a/LeedsPrototypeTests/tests/exporting.spec.ts +++ b/LeedsPrototypeTests/tests/exporting.spec.ts @@ -30,8 +30,18 @@ test.describe('Export an existing Digital Object and make changes to it, then cr }); const exportDeposit = await exportResp.json(); expect(exportDeposit.files).toMatch(/s3:\/\/.*/); - console.log("The files for " + digitalObjectUri + " have been placed under " + exportDeposit.files); - + console.log("The files for " + digitalObjectUri + " will be placed under " + exportDeposit.files); + console.log("But we need to wait for the export to finish! It might take a long time"); + await expect.poll(async () => { + console.log("GET the export deposit: " + exportDeposit['@id']); + const exDepReq = await request.get(exportDeposit['@id']); + const exDep = await exDepReq.json(); + console.log("status: " + exDep.status); + return exDep.status; + }, { + intervals: [2000], // every 2 seconds + timeout: 60000 // allow 1 minute to complete + }).toMatch("ready"); const s3Client = getS3Client(); await listKeys(s3Client, exportDeposit.files);