|
1 | | -# Test AWS Modules |
| 1 | +# Test Modules |
2 | 2 |
|
3 | | -This folder contains all the files for testing the AWS modules. |
| 3 | +`terratest` folder contains GO test cases for AWS and Sumo Logic modules. |
4 | 4 |
|
5 | | -`test.go` is the root test files that runs the test cases for the all the AWS modules. |
| 5 | +`run_tests.sh` is the shell script that runs the test cases for the all the modules. |
6 | 6 |
|
7 | 7 | ## Test Design |
8 | 8 |
|
9 | | -Test cases are divided into Two parts : |
| 9 | +Test cases have been divided into Two parts : |
10 | 10 |
|
11 | 11 | ###### Unit Tests |
| 12 | +Unit tests checks for : |
12 | 13 |
|
13 | | -- |
| 14 | +- `Terraform` installation |
| 15 | +- `tflint` installation |
| 16 | +- `terrafom fmt` to check for formatting across all the terraform files in the module folder. |
14 | 17 |
|
15 | 18 | ###### Integration Tests |
16 | 19 |
|
17 | | -- |
18 | | - |
19 | | -## Testing |
| 20 | +Integration test checks for : |
| 21 | + |
| 22 | +- `terraform init and validate` to initialize and validate the terraform files. |
| 23 | +- `terraform apply` to check across various test cases. |
| 24 | + - Test cases have been written based on various inputs that can impact terraform resource creation. |
| 25 | +- Validate expected and actual resource create, changed and destroyed. |
| 26 | +- Validate expected (this takes up a JSON file with expected outputs) and actual outputs from modules. |
| 27 | +- Validate if the logs or metrics have been received in Sumo Logic. |
| 28 | + |
| 29 | +## Testing |
| 30 | + |
| 31 | +- Update the `run_tests.sh` to provide below environment variables |
| 32 | + - SUMOLOGIC_ENVIRONMENT -> Sumo Logic environment (au, ca, de, eu, jp, us1, us2, in, or fed). |
| 33 | + - SUMOLOGIC_ACCESS_ID -> Sumo Logic Access ID. |
| 34 | + - SUMOLOGIC_ACCESS_KEY -> Sumo Logic Access key. |
| 35 | + - SUMOLOGIC_ORG_ID -> Sumo Logic Organization ID. |
| 36 | + - AWS_DEFAULT_PROFILE -> AWS CLI Profile name. |
| 37 | + - AWS_PROFILE -> AWS CLI Profile name. |
| 38 | +- Replace below variables in `set_env_variables` method with correct values in `run_tests.sh` from AWS account and Sumo Logic org. |
| 39 | + - BUCKET_NAME -> A Bucket from us-east-1 region |
| 40 | + - BUCKET_NAME_US_WEST_1 -> A Bucket from us-west-1 region. |
| 41 | + - BUCKET_NAME_AP_SOUTH_1 -> A Bucket from ap-south-1 region. |
| 42 | + - PATH_EXPRESSION -> A correct path expression to fetch logs. |
| 43 | + - PATH_EXPRESSION_US_WEST_1 -> A correct path expression to fetch logs. |
| 44 | + - PATH_EXPRESSION_AP_SOUTH_1 -> A correct path expression to fetch logs. |
| 45 | + - IAM_ROLE -> AN IAM role with CloudTrail, ELB, Metrics and Root Cause permissions. |
| 46 | + - TOPIC_ARN -> A SNS topic ARN from us-east-1 region. |
| 47 | + - TOPIC_ARN_US_WEST_1 -> A SNS topic ARN from us-west-1 region. |
| 48 | + - COLLECTOR_ID -> A Existing Sumo Logic hosted collector ID. |
| 49 | +- One above 2 steps have been performed, run the test cases for the module you would like to test. |
| 50 | + - You can update the `modules` the variable in `run_tests.sh` file. |
| 51 | +- A `test.log` file will be generated in the module's test folder. |
0 commit comments