Skip to content

Commit 20c91b9

Browse files
authored
Merge pull request #6 from byu-oit/bug/codedeploy-race
workaround CodeDeploy race condition
2 parents 84a5596 + 658ffda commit 20c91b9

File tree

1 file changed

+8
-1
lines changed
  • examples/simple-lambda-with-deploy-test/tst

1 file changed

+8
-1
lines changed

examples/simple-lambda-with-deploy-test/tst/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const codedeploy = new AWS.CodeDeploy({ apiVersion: '2014-10-06', region: 'us-we
44

55
exports.handler = async function (event, context) {
66
console.log(event)
7-
console.log(context)
7+
8+
// Workaround for CodeDeploy bug.
9+
// Give the ALB 10 seconds to make sure the test TG has switched to the new code.
10+
await sleep(10000)
811

912
let errorFromTests
1013
await runTests('.postman').catch(err => { errorFromTests = err })
@@ -47,4 +50,8 @@ async function runTests (postmanFilesDir) {
4750
}
4851
}
4952

53+
function sleep(ms) {
54+
return new Promise(resolve => setTimeout(resolve, ms));
55+
}
56+
5057
// runTests()

0 commit comments

Comments
 (0)