@cumulus/integration-tests 9.9.0 → 10.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmr.js +13 -12
- package/dist/index.js +1086 -934
- package/package.json +12 -12
package/cmr.js
CHANGED
|
@@ -5,6 +5,7 @@ const got = require('got');
|
|
|
5
5
|
const pWaitFor = require('p-wait-for');
|
|
6
6
|
const xml2js = require('xml2js');
|
|
7
7
|
const { s3 } = require('@cumulus/aws-client/services');
|
|
8
|
+
const { buildS3Uri } = require('@cumulus/aws-client/S3');
|
|
8
9
|
const log = require('@cumulus/common/log');
|
|
9
10
|
const { getSearchUrl } = require('@cumulus/cmr-client');
|
|
10
11
|
|
|
@@ -227,15 +228,15 @@ function generateCmrXml(granule, collection, additionalUrls) {
|
|
|
227
228
|
*/
|
|
228
229
|
async function generateAndStoreCmrXml(granule, collection, bucket, additionalUrls) {
|
|
229
230
|
const xml = generateCmrXml(granule, collection, additionalUrls);
|
|
230
|
-
const granuleFiles = granule.files.map((f) => f.
|
|
231
|
+
const granuleFiles = granule.files.map((f) => `s3://${f.bucket}/${f.key}`);
|
|
231
232
|
|
|
232
|
-
const stagingDir =
|
|
233
|
+
const stagingDir = 'file-staging';
|
|
233
234
|
|
|
234
|
-
const
|
|
235
|
+
const fileKey = `${stagingDir}/${granule.granuleId}.cmr.xml`;
|
|
235
236
|
|
|
236
237
|
const params = {
|
|
237
238
|
Bucket: bucket,
|
|
238
|
-
Key:
|
|
239
|
+
Key: fileKey,
|
|
239
240
|
Body: xml,
|
|
240
241
|
ContentType: 'application/xml',
|
|
241
242
|
Tagging: `granuleId=${granule.granuleId}`,
|
|
@@ -243,8 +244,8 @@ async function generateAndStoreCmrXml(granule, collection, bucket, additionalUrl
|
|
|
243
244
|
|
|
244
245
|
await s3().putObject(params).promise();
|
|
245
246
|
|
|
246
|
-
granuleFiles.push(`s3://${bucket}/${
|
|
247
|
-
log.info(`s3://${bucket}/${
|
|
247
|
+
granuleFiles.push(`s3://${bucket}/${fileKey}`);
|
|
248
|
+
log.info(`s3://${bucket}/${fileKey}`);
|
|
248
249
|
log.info(granuleFiles);
|
|
249
250
|
return granuleFiles;
|
|
250
251
|
}
|
|
@@ -387,13 +388,13 @@ async function generateAndStoreCmrUmmJson(
|
|
|
387
388
|
};
|
|
388
389
|
}
|
|
389
390
|
|
|
390
|
-
const stagingDir =
|
|
391
|
+
const stagingDir = 'file-staging';
|
|
391
392
|
|
|
392
|
-
const
|
|
393
|
+
const fileKey = `${stagingDir}/${granule.granuleId}.cmr.json`;
|
|
393
394
|
|
|
394
395
|
const params = {
|
|
395
396
|
Bucket: bucket,
|
|
396
|
-
Key:
|
|
397
|
+
Key: fileKey,
|
|
397
398
|
Body: JSON.stringify(jsonObject),
|
|
398
399
|
ContentType: 'application/json',
|
|
399
400
|
Tagging: `granuleId=${granule.granuleId}`,
|
|
@@ -401,9 +402,9 @@ async function generateAndStoreCmrUmmJson(
|
|
|
401
402
|
|
|
402
403
|
await s3().putObject(params).promise();
|
|
403
404
|
|
|
404
|
-
const granuleFiles = granule.files.map((f) => f.
|
|
405
|
-
granuleFiles.push(`s3://${bucket}/${
|
|
406
|
-
log.info(`s3://${bucket}/${
|
|
405
|
+
const granuleFiles = granule.files.map((f) => buildS3Uri(f.bucket, f.key));
|
|
406
|
+
granuleFiles.push(`s3://${bucket}/${fileKey}`);
|
|
407
|
+
log.info(`s3://${bucket}/${fileKey}`);
|
|
407
408
|
log.info(granuleFiles);
|
|
408
409
|
return granuleFiles;
|
|
409
410
|
}
|