From 15ef21dfef4e80d182aba0548b5d4fac237fa882 Mon Sep 17 00:00:00 2001 From: Alexander VT Date: Mon, 28 Nov 2022 10:36:44 -0600 Subject: [PATCH 1/5] fix(metadata-test): ensure test setup is successful in creating indexd records --- suites/apis/metadataIngestionTest.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/suites/apis/metadataIngestionTest.js b/suites/apis/metadataIngestionTest.js index e15a281f6..abaad7cc3 100644 --- a/suites/apis/metadataIngestionTest.js +++ b/suites/apis/metadataIngestionTest.js @@ -317,6 +317,11 @@ Scenario('create a new mds entry and then issue http delete against mds/objects/ console.log(`uploadTmpFile: ${uploadTmpFile}`); } + // To test the endpoint, the mds record entry needs to reference an indexd record + // So let us create one + const ok = await indexd.do.addFileIndices(Object.values(files)); + expect(ok).to.be.true; + const guidToBeDeleted = files.allowed.did; const createMdsEntryReq = await I.sendPostRequest( From c94e2a242ad7c1993aa0cf4ce753c15251c79045 Mon Sep 17 00:00:00 2001 From: Alexander VT Date: Mon, 28 Nov 2022 12:55:30 -0600 Subject: [PATCH 2/5] fix(test): ensure passing indexd into function that uses it --- suites/apis/metadataIngestionTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suites/apis/metadataIngestionTest.js b/suites/apis/metadataIngestionTest.js index abaad7cc3..038a34e35 100644 --- a/suites/apis/metadataIngestionTest.js +++ b/suites/apis/metadataIngestionTest.js @@ -308,7 +308,7 @@ Scenario('Dispatch partial match get-dbgap-metadata job with mock dbgap xml and }).retry(1); // Scenario #4 - Instrument the metadata-service DELETE endpoint -Scenario('create a new mds entry and then issue http delete against mds/objects/{guid} @metadataIngestion', async ({ I, users }) => { +Scenario('create a new mds entry and then issue http delete against mds/objects/{guid} @metadataIngestion', async ({ I, users, indexd }) => { // create a local small file to upload to test bucket. const uploadTmpFile = await bash.runCommand(` echo "hello mds" > mds-test.file && aws s3 cp ./mds-test.file s3://cdis-presigned-url-test/mds-test.file From 297b05fe25c50122d5f21c05ba84d877754dfe41 Mon Sep 17 00:00:00 2001 From: Alexander VT Date: Mon, 28 Nov 2022 15:02:05 -0600 Subject: [PATCH 3/5] fix(metadata): create guids before every test --- suites/apis/metadataIngestionTest.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/suites/apis/metadataIngestionTest.js b/suites/apis/metadataIngestionTest.js index 038a34e35..3ba399ec9 100644 --- a/suites/apis/metadataIngestionTest.js +++ b/suites/apis/metadataIngestionTest.js @@ -182,11 +182,6 @@ BeforeSuite(async ({ I, users, indexd }) => { `/mds-admin/metadata/${expectedResults.get_dbgap_metadata.testGUIDForPartialMatch}`, users.indexingAcct.accessTokenHeader, ); - - // To test the deletion endpoint, the mds record entry needs to reference an indexd record - // So let us create one - const ok = await indexd.do.addFileIndices(Object.values(files)); - expect(ok).to.be.true; }); AfterSuite(async ({ I }) => { @@ -197,6 +192,14 @@ AfterSuite(async ({ I }) => { } }); +Before(async ({ indexd }) => { + console.log('populating indexd records...'); + // To test the deletion endpoint, the mds record entry needs to reference an indexd record + // So let us create one + const ok = await indexd.do.addFileIndices(Object.values(files)); + expect(ok).to.be.true; +}); + // Scenario #1 - Instrument sower HTTP API endpoint to trigger the ingest-metadata-manifest job // and check if the expected mds entry is created successfully Scenario('Dispatch ingest-metadata-manifest sower job with simple tsv and verify metadata ingestion @metadataIngestion', async ({ I, users }) => { From 2977ac35410d5ec23b8284c9f21026d10f4c04e3 Mon Sep 17 00:00:00 2001 From: Alexander VT Date: Mon, 28 Nov 2022 15:13:59 -0600 Subject: [PATCH 4/5] fix(metadata): create guids before every test --- suites/apis/metadataIngestionTest.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/suites/apis/metadataIngestionTest.js b/suites/apis/metadataIngestionTest.js index 3ba399ec9..eb04552e4 100644 --- a/suites/apis/metadataIngestionTest.js +++ b/suites/apis/metadataIngestionTest.js @@ -311,7 +311,7 @@ Scenario('Dispatch partial match get-dbgap-metadata job with mock dbgap xml and }).retry(1); // Scenario #4 - Instrument the metadata-service DELETE endpoint -Scenario('create a new mds entry and then issue http delete against mds/objects/{guid} @metadataIngestion', async ({ I, users, indexd }) => { +Scenario('create a new mds entry and then issue http delete against mds/objects/{guid} @metadataIngestion', async ({ I, users }) => { // create a local small file to upload to test bucket. const uploadTmpFile = await bash.runCommand(` echo "hello mds" > mds-test.file && aws s3 cp ./mds-test.file s3://cdis-presigned-url-test/mds-test.file @@ -320,11 +320,6 @@ Scenario('create a new mds entry and then issue http delete against mds/objects/ console.log(`uploadTmpFile: ${uploadTmpFile}`); } - // To test the endpoint, the mds record entry needs to reference an indexd record - // So let us create one - const ok = await indexd.do.addFileIndices(Object.values(files)); - expect(ok).to.be.true; - const guidToBeDeleted = files.allowed.did; const createMdsEntryReq = await I.sendPostRequest( From eb3ffe8a5b8e46fcd2afb5af08f0e5cda42ed1f4 Mon Sep 17 00:00:00 2001 From: Alexander VT Date: Mon, 28 Nov 2022 15:42:12 -0600 Subject: [PATCH 5/5] fix(metadata): create guids before every test but allow 409 --- suites/apis/metadataIngestionTest.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/suites/apis/metadataIngestionTest.js b/suites/apis/metadataIngestionTest.js index eb04552e4..ff9b69e6c 100644 --- a/suites/apis/metadataIngestionTest.js +++ b/suites/apis/metadataIngestionTest.js @@ -196,8 +196,7 @@ Before(async ({ indexd }) => { console.log('populating indexd records...'); // To test the deletion endpoint, the mds record entry needs to reference an indexd record // So let us create one - const ok = await indexd.do.addFileIndices(Object.values(files)); - expect(ok).to.be.true; + await indexd.do.addFileIndices(Object.values(files)); }); // Scenario #1 - Instrument sower HTTP API endpoint to trigger the ingest-metadata-manifest job