Skip to content

Commit

Permalink
HARMONY-1966: Add a separate test for mixed case destinationUrl.
Browse files Browse the repository at this point in the history
  • Loading branch information
ygliuvt committed Dec 16, 2024
1 parent 8897d15 commit 47794ee
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions services/harmony/test/destination-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const reprojectAndZarrQuery = {
format: 'application/x-zarr',
ignoreErrors: true,
concatenate: false,
destinationUrl: 's3://dummy/P1',
destinationUrl: 's3://dummy/p1',
};

/**
Expand Down Expand Up @@ -72,15 +72,45 @@ 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);
});

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');
});
});

Expand Down

0 comments on commit 47794ee

Please sign in to comment.