From 47794ee75e6a20d5ad69497a064a43fac84b626e Mon Sep 17 00:00:00 2001 From: Yonggang Liu Date: Mon, 16 Dec 2024 12:06:37 -0500 Subject: [PATCH] HARMONY-1966: Add a separate test for mixed case destinationUrl. --- services/harmony/test/destination-url.ts | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/services/harmony/test/destination-url.ts b/services/harmony/test/destination-url.ts index cefb6c5b0..58e5baa46 100644 --- a/services/harmony/test/destination-url.ts +++ b/services/harmony/test/destination-url.ts @@ -18,7 +18,7 @@ const reprojectAndZarrQuery = { format: 'application/x-zarr', ignoreErrors: true, concatenate: false, - destinationUrl: 's3://dummy/P1', + destinationUrl: 's3://dummy/p1', }; /** @@ -72,7 +72,7 @@ describe('when setting destinationUrl on ogc request', function () { it('the job has harmony-job-status-link file created with the job status link', async function () { expect(this.res.status).to.equal(200); const jobId = JSON.parse(this.res.text).jobID; - const s3Url = 's3://dummy/P1/' + jobId + '/harmony-job-status-link'; + const s3Url = 's3://dummy/p1/' + jobId + '/harmony-job-status-link'; const statusLink = await defaultObjectStore().getObject(s3Url); // this.res.request.url is the job status link expect(statusLink).to.equal(this.res.request.url); @@ -80,7 +80,37 @@ describe('when setting destinationUrl on ogc request', function () { it('sets the destination_url on the job in db', async function () { const retrieved = await Job.forUser(this.trx, 'anonymous'); - expect(retrieved.data[0].destination_url).to.eq('s3://dummy/P1'); + expect(retrieved.data[0].destination_url).to.eq('s3://dummy/p1'); + }); + }); + + describe('when making a request with a valid mixed case destinationUrl', function () { + hookGetBucketRegion('us-west-2'); + reprojectAndZarrQuery.destinationUrl = 's3://dummy/UPPERCASE_PATH/p1'; + hookRangesetRequest('1.0.0', collection, 'all', { query: { ...reprojectAndZarrQuery } }); + hookRedirect('anonymous'); + hookTransaction(); + + it('returns 200 status code for the job', async function () { + expect(this.res.status).to.equal(200); + }); + + it('does not include the dataExpiration field in the job status', function () { + expect(this.res.body.dataExpiration).to.be.undefined; + }); + + it('the job has harmony-job-status-link file created with the job status link', async function () { + expect(this.res.status).to.equal(200); + const jobId = JSON.parse(this.res.text).jobID; + const s3Url = 's3://dummy/UPPERCASE_PATH/p1/' + jobId + '/harmony-job-status-link'; + const statusLink = await defaultObjectStore().getObject(s3Url); + // this.res.request.url is the job status link + expect(statusLink).to.equal(this.res.request.url); + }); + + it('sets the destination_url on the job in db', async function () { + const retrieved = await Job.forUser(this.trx, 'anonymous'); + expect(retrieved.data[0].destination_url).to.eq('s3://dummy/UPPERCASE_PATH/p1'); }); });