Skip to content

Commit b4878d1

Browse files
fixup test move destroyKmsKey promisify into helpers file
1 parent ac5b527 commit b4878d1

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

tests/functional/sse-kms-migration/arnPrefix.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const log = new DummyRequestLogger();
66
const { makeRequest } = require('../raw-node/utils/makeRequest');
77
const helpers = require('./helpers');
88
const scenarios = require('./scenarios');
9-
const kms = require('../../../lib/kms/wrapper');
109

1110
// copy part of aws-node-sdk/test/object/encryptionHeaders.js and add more tests
1211

@@ -508,7 +507,6 @@ describe('ensure MPU use good SSE', () => {
508507
});
509508

510509
describe('KMS error', () => {
511-
const destroyKmsKey = promisify(kms.destroyBucketKey);
512510
const sseConfig = { algo: 'aws:kms', masterKeyId: true }
513511
const Bucket = 'bkt-kms-err';
514512
const Key = 'obj';
@@ -560,14 +558,14 @@ describe('KMS error', () => {
560558
// ensure we can decrypt and read the object
561559
const obj = await helpers.s3.getObject({ Bucket, Key }).promise();
562560
assert.strictEqual(obj.Body.toString(), body);
563-
void await destroyKmsKey(masterKeyArn, log);
561+
void await helpers.destroyKmsKey(masterKeyArn, log);
564562
});
565563

566564
after(async () => {
567565
void await helpers.cleanup(Bucket);
568566
if (masterKeyArn) {
569567
try {
570-
void await destroyKmsKey(masterKeyArn, log);
568+
void await helpers.destroyKmsKey(masterKeyArn, log);
571569
} catch (e) { void e; }
572570
[masterKeyArn, masterKeyId] = [null, null];
573571
}
@@ -576,7 +574,7 @@ describe('KMS error', () => {
576574
afterEach(async () => {
577575
if (anotherKeyInfo) {
578576
try {
579-
void await destroyKmsKey(anotherKeyInfo.masterKeyArn, log);
577+
void await helpers.destroyKmsKey(anotherKeyInfo.masterKeyArn, log);
580578
} catch (e) { void e; }
581579
anotherKeyInfo = null;
582580
}
@@ -642,7 +640,7 @@ describe('KMS error', () => {
642640
const mpu = await helpers.s3.createMultipartUpload(
643641
helpers.putObjParams(Bucket, mpuKey, sseConfig, anotherKeyInfo.masterKeyArn)).promise();
644642

645-
void await destroyKmsKey(anotherKeyInfo.masterKeyArn, log);
643+
void await helpers.destroyKmsKey(anotherKeyInfo.masterKeyArn, log);
646644
await assert.rejects(helpers.s3.uploadPart(
647645
{
648646
UploadId: mpu.UploadId,

tests/functional/sse-kms-migration/helpers.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ async function createKmsKey(log) {
9494
});
9595
}
9696

97+
const destroyKmsKey = promisify(kms.destroyBucketKey);
98+
9799
async function cleanup(Bucket) {
98100
await bucketUtil.empty(Bucket);
99101
await s3.deleteBucket({ Bucket }).promise();
@@ -112,5 +114,6 @@ module.exports = {
112114
putEncryptedObject,
113115
getObjectMDSSE,
114116
createKmsKey,
117+
destroyKmsKey,
115118
cleanup,
116119
};

0 commit comments

Comments
 (0)