Datadrivers Coding Challenge
Create a Lambda handler which performs a string reversion. The handler reads the string from one S3 bucket, flips the string, and then stores it in another S3 bucket. The use of Terraform is mandatory.
I created a workflow which gets triggered on push commits to the main branch. It consists of a deployment job deploy
and a test job test
. The workflow runs the deploy
and the test
job in a sequence, to test against the new deployment.
The first job deploy
bundles the handler and creates a terraform execution plan based on the defined resources in the main.tf template. Afterwards it deploys the execution plan in the terraform cloud.
The second job test
runs after the deploy
job. It copies an example string to the bucket and runs a couple of test functions against the new deployment.
The test cases are defined in a test suite as pure bash functions. They are executed directly in the pipeline without the need of a third-party testing framework.
- tests if the reverse-string-handler returns statusCode
204
if required parametersfrom: s3 object key of the file which contains a string to be reversed, to: s3 object key of the reversed string file
are passed and if the string in the destination bucket has actually been reversed
- tests if the reverse-string-handler returns statusCode
400
if required parameters are not being passed to the handler
- tests if the reverse-string-handler returns statusCode
500
if invalid s3 object keys are passed to the handler