lambda integration tests - test to show that environment config has an effect (#28815)

This commit is contained in:
mikedlr 2017-09-20 20:10:06 +01:00 committed by Ryan Brown
parent d871964aca
commit 140ea7f5ff
2 changed files with 53 additions and 2 deletions

View file

@ -1,5 +1,6 @@
from __future__ import print_function
import json
import os
def handler(event, context):
@ -17,7 +18,16 @@ def handler(event, context):
name = event["name"]
return {"message": "hello " + name}
# we can use environment variables as part of the configuration of the lambda
# which can change the behaviour of the lambda without needing a new upload
extra = os.environ.get("EXTRA_MESSAGE")
if extra is not None and len(extra) > 0:
greeting = "hello {0}. {1}".format(name, extra)
else:
greeting = "hello " + name
return {"message": greeting}
def main():