Skip to content

Commit ecd41b5

Browse files
committed
fixups
1 parent 4cc2689 commit ecd41b5

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

tests/functional/aws-node-sdk/test/multipleBackend/delete/delete.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,21 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
7070
Metadata: { 'scal-location-constraint': awsLocation }
7171
}));
7272

73-
process.stdout.write('Putting big object to AWS\n');
73+
process.stdout.write('Putting large object to AWS\n');
7474
await s3.send(new PutObjectCommand({
7575
Bucket: bucket,
7676
Key: bigObject,
7777
Body: bigBody,
7878
Metadata: { 'scal-location-constraint': awsLocation }
7979
}));
80+
81+
process.stdout.write('Putting object to AWS\n');
82+
await s3.send(new PutObjectCommand({
83+
Bucket: bucket,
84+
Key: mismatchObject,
85+
Body: body,
86+
Metadata: { 'scal-location-constraint': awsLocationMismatch }
87+
}));
8088
});
8189

8290
after(async () => {
@@ -91,7 +99,7 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
9199

92100
try {
93101
await s3.send(new GetObjectCommand({ Bucket: bucket, Key: memObject }));
94-
throw new Error('Expected NoSuchKey error but got success');
102+
assert.fail('Expected NoSuchKey error but got success');
95103
} catch (err) {
96104
assert.strictEqual(err.code, 'NoSuchKey');
97105
}
@@ -102,7 +110,7 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
102110

103111
try {
104112
await s3.send(new GetObjectCommand({ Bucket: bucket, Key: fileObject }));
105-
throw new Error('Expected NoSuchKey error but got success');
113+
assert.fail('Expected NoSuchKey error but got success');
106114
} catch (err) {
107115
assert.strictEqual(err.code, 'NoSuchKey');
108116
}
@@ -113,7 +121,7 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
113121

114122
try {
115123
await s3.send(new GetObjectCommand({ Bucket: bucket, Key: awsObject }));
116-
throw new Error('Expected NoSuchKey error but got success');
124+
assert.fail('Expected NoSuchKey error but got success');
117125
} catch (err) {
118126
assert.strictEqual(err.code, 'NoSuchKey');
119127
}
@@ -124,7 +132,7 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
124132

125133
try {
126134
await s3.send(new GetObjectCommand({ Bucket: bucket, Key: emptyObject }));
127-
throw new Error('Expected NoSuchKey error but got success');
135+
assert.fail('Expected NoSuchKey error but got success');
128136
} catch (err) {
129137
assert.strictEqual(err.code, 'NoSuchKey');
130138
}
@@ -135,24 +143,23 @@ describeSkipIfNotMultiple('Multiple backend delete', () => {
135143

136144
try {
137145
await s3.send(new GetObjectCommand({ Bucket: bucket, Key: bigObject }));
138-
throw new Error('Expected NoSuchKey error but got success');
146+
assert.fail('Expected NoSuchKey error but got success');
139147
} catch (err) {
140148
assert.strictEqual(err.code, 'NoSuchKey');
141149
}
142150
});
143151

144-
it('should return an InvalidLocationConstraint ' +
145-
'error for mismatch location', async () => {
152+
it('should delete object from AWS location with bucketMatch set to ' +
153+
'false', async () => {
146154
try {
147-
await s3.send(new PutObjectCommand({
155+
await s3.send(new DeleteObjectCommand({ Bucket: bucket, Key: mismatchObject }));
156+
await s3.send(new GetObjectCommand({
148157
Bucket: bucket,
149-
Key: mismatchObject,
150-
Body: body,
151-
Metadata: { 'scal-location-constraint': awsLocationMismatch }
158+
Key: mismatchObject
152159
}));
153-
throw new Error('Expected InvalidLocationConstraint error but got success');
160+
assert.fail('Expected NoSuchKey error but got success');
154161
} catch (err) {
155-
assert.strictEqual(err.code, 'InvalidLocationConstraint');
162+
assert.strictEqual(err.code, 'NoSuchKey');
156163
}
157164
});
158165
});

tests/functional/aws-node-sdk/test/multipleBackend/get/get.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ describe('Multiple backend get object', function testSuite() {
7171
done => {
7272
const command = new GetObjectCommand({ Bucket: '', Key: 'somekey' });
7373
s3.send(command)
74-
.then(() => {
75-
done(new Error('Expected failure but got success'));
76-
})
74+
.then(() => done(new Error('Expected failure but got success')))
7775
.catch(err => {
7876
assert.notEqual(err, null,
7977
'Expected failure but got success');
@@ -85,9 +83,7 @@ describe('Multiple backend get object', function testSuite() {
8583
done => {
8684
const command = new GetObjectCommand({ Bucket: bucket, Key: 'nope' });
8785
s3.send(command)
88-
.then(() => {
89-
done(new Error('Expected failure but got success'));
90-
})
86+
.then(() => done(new Error('Expected failure but got success')))
9187
.catch(err => {
9288
assert.notEqual(err, null,
9389
'Expected failure but got success');

tests/functional/aws-node-sdk/test/object/copyPart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function checkNoError(err) {
2929

3030
function checkError(err, code) {
3131
assert.notEqual(err, null, 'Expected failure but got success');
32-
assert.strictEqual(err.code, code);
32+
assert.strictEqual(err.name, code);
3333
}
3434

3535
describe('Object Part Copy', () => {

0 commit comments

Comments
 (0)