Skip to content

Commit

Permalink
More debugging of integration failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsharratt committed Feb 10, 2017
1 parent 8e02127 commit 4754f3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .serverless_plugins/remove-storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class RemoveStorageBucket {
};
}

listAllKeys(marker) {
listAllKeys(token) {
const allKeys = [];
return this.s3.listObjects({
return this.s3.listObjectsV2({
Bucket: this.bucket,
Marker: marker,
ContinuationToken: token,
}).promise()
.then((data) => {
allKeys.push(data.Contents);

if (data.IsTruncated) {
return this.listAllKeys(data.NextMarker);
return this.listAllKeys(data.NextContinuationToken);
}

return [].concat.apply([], allKeys).map(
Expand Down
9 changes: 2 additions & 7 deletions integration/bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ const slsDeploy = spawn('sls', ['deploy', '--stage', stage]);

let registryUrl;

slsDeploy.stderr.on('data', (data) => {
console.log('Error:', data.toString());
});

slsDeploy.stdout.on('data', (data) => {
console.log(data.toString());
if (!registryUrl) {
const registryRegex = new RegExp('https://.+?(?={name})');
const urls = registryRegex.exec(data.toString());
Expand All @@ -37,10 +32,10 @@ slsDeploy.stdout.on('data', (data) => {
}
});

slsDeploy.on('close', (code) => {
slsDeploy.on('exit', (code) => {
if (code === 0) {
console.log(`Finished deployment for yith ${stage} : code ${code}`);
} else {
throw new Error(code);
console.log(`Error deploying code ${code}`);
}
});
6 changes: 3 additions & 3 deletions test/serverless_plugins/remove-storage/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Plugin: RemoveStorageBucket', () => {

const awsS3Instance = createStubInstance(AWS.S3);
awsS3Instance.deleteBucket = deleteBucketStub;
awsS3Instance.listObjects = listObjectsStub;
awsS3Instance.listObjectsV2 = listObjectsStub;
awsS3Instance.deleteObjects = deleteObjectsStub;

return awsS3Instance;
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Plugin: RemoveStorageBucket', () => {

assert(listObjectsStub.calledWithExactly({
Bucket: 'foo-bucket',
Marker: undefined,
ContinuationToken: undefined,
}));
});

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Plugin: RemoveStorageBucket', () => {
});

const awsS3Instance = createStubInstance(AWS.S3);
awsS3Instance.listObjects = listObjectsStub;
awsS3Instance.listObjectsV2 = listObjectsStub;

return awsS3Instance;
}),
Expand Down

0 comments on commit 4754f3b

Please sign in to comment.