Skip to content

toluna-terraform/terraform-aws-codepipline-test-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integration & Stress tests framework Terraform module

Description

This module supports running integration & stress tests intended as a post installation hook of deploy stage using codepipeline,before shifting traffic from test to production, it is lambda based and uses postman collections for Integratin Tests and .jmx for Stress tests.

The output is then uploaded to S3 as junit and html reports and publish under codebuild with a unique report group.

Depending on the flags set in consul application configuration, integraton_tests and stress_tests may be performed or skipped.

This framework works for differnt DeploymentTypes (ECS / SAM / AppMesh).

* an environment equals in it's name to the Terraform workspace it runs under so when referring to an environment or workspace throughout this document their value is actually the same.

The following resources will be created:

  • Lambda
  • Codebuild project
  • Report group

Usage

module "test_runner" {
  source = "./modules/integration-runner"
  app_name = var.app_name
  env_type = var.env_type
  postman_collections = var.postman_collections
  jmx_file_path = var.jmx_file_path
}

Toggles

In your deploy appspec include the following condition to determinant if to run tests after deploy and before shifting traffic.

    %{ if HOOKS }
    ,
    "Hooks": [
		{
			"BeforeAllowTraffic": "${APP_NAME}-${ENV_TYPE}-test-framework-manager"
		}
	]
    %{ endif }

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

Name Source Version
test_framework_manager ./modules/test-framework-manager n/a

Resources

Name Type
aws_codebuild_report_group.CodeCoverageReport resource
aws_codebuild_report_group.IntegrationTestReport resource
aws_codebuild_report_group.StreesTestReport resource
aws_codebuild_report_group.TestReport resource
aws_caller_identity.current data source
aws_region.current data source
aws_ssm_parameter.ado_password data source
aws_ssm_parameter.ado_user data source

Inputs

Name Description Type Default Required
app_envs n/a any n/a yes
app_name n/a string n/a yes
env_type n/a string n/a yes
environment_variables n/a map(string) {} no
environment_variables_parameter_store n/a map(string)
{
"ADO_PASSWORD": "/app/ado_password",
"ADO_USER": "/app/ado_user"
}
no
jmeter_version n/a string "5.5" no
jmx_file_path n/a string "" no
postman_collections A list of postman collections (and environments) to run during the execution of the lambda function (in order). Collections and environments from the Postman API must be the collection/environment id
list(object({
collection = string
environment = string
}))
n/a yes

Outputs

Name Description
CodeCoverageReport n/a
IntegrationTestReport n/a
StressTestReport n/a
TestReport n/a