forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added integration tests for overwrite resources
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/integration/aws/general/overwrite-resources/service/handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
module.exports.hello = (event, context, callback) => { | ||
callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event }); | ||
}; | ||
|
||
module.exports.world = (event, context, callback) => { | ||
callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event }); | ||
}; | ||
|
18 changes: 18 additions & 0 deletions
18
tests/integration/aws/general/overwrite-resources/service/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
service: aws-nodejs # NOTE: update this with your service name | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs4.3 | ||
|
||
functions: | ||
hello: | ||
handler: handler.hello | ||
world: | ||
handler: handler.world | ||
|
||
resources: | ||
Resources: | ||
HelloLambdaFunction: | ||
Type: "AWS::Lambda::Function" | ||
Properties: | ||
Timeout: 10 |
44 changes: 44 additions & 0 deletions
44
tests/integration/aws/general/overwrite-resources/tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const expect = require('chai').expect; | ||
const AWS = require('aws-sdk'); | ||
const BbPromise = require('bluebird'); | ||
|
||
const Utils = require('../../../../utils/index'); | ||
|
||
const Lambda = new AWS.Lambda({ region: 'us-east-1' }); | ||
BbPromise.promisifyAll(Lambda, { suffix: 'Promised' }); | ||
|
||
describe('AWS - General: Overwrite resources test', function () { | ||
this.timeout(0); | ||
|
||
let stackName; | ||
|
||
before(() => { | ||
stackName = Utils.createTestService('aws-nodejs', path.join(__dirname, 'service')); | ||
Utils.deployService(); | ||
}); | ||
|
||
it('should overwrite timeout config for hello function', () => { | ||
const helloFunctionName = `${stackName}-hello`; | ||
return Lambda.getFunctionPromised({ FunctionName: helloFunctionName }) | ||
.then(data => { | ||
const timeout = data.Configuration.Timeout; | ||
expect(timeout).to.equal(10); | ||
}); | ||
}); | ||
|
||
it('should NOT overwrite timeout config for world function', () => { | ||
const worldFunctionName = `${stackName}-world`; | ||
return Lambda.getFunctionPromised({ FunctionName: worldFunctionName }) | ||
.then(data => { | ||
const timeout = data.Configuration.Timeout; | ||
expect(timeout).to.equal(6); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
Utils.removeService(); | ||
}); | ||
}); |