Skip to content

Commit 30e2c96

Browse files
Merge pull request #265 from SumoLogic/sumo_269118
Fixed testsuite
2 parents 0ddbe92 + 0faf7e0 commit 30e2c96

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

aws-observability-terraform/test/appmodule/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
1. Clone git repository
1414
2. Set variables at following file
1515
- aws-observability-terraform/examples/appmodule/main.auto.tfvars
16-
3. Now Go back to folder aws-observability-terraform and run following command to execute all Test functions, with function name pattern as Test*
17-
```go test -v -timeout 50m ./test/appmodule```
16+
3. Now Go back to folder aws-observability-terraform and
17+
- Run the following command to execute all Test functions, with function name pattern as Test*
18+
```go test -v -timeout 120m ./test/appmodule```
19+
For single Terratest case
20+
```go test -v -timeout 30m ./test/appmodule -run ^TestAppModule1$```
1821
4. Go test command runs all functions starting with name Test*. So if you want to run a particular test case according to your use case, comment the rest of the Testing functions. It’ll take less time to run than running all test cases.
1922
5. In case of failure - you can determine the cause of failure, fix the issue and re-run the failed test case.
2023
6. For example if you only run testcase 3 you can expect successful test execution as follows:

aws-observability-terraform/test/appmodule/terraform.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package test
22

33
import (
44
"fmt"
5-
"testing"
6-
75
"github.com/gruntwork-io/terratest/modules/terraform"
86
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
7+
"os"
8+
"path/filepath"
9+
"testing"
910
)
1011

1112
// Deploy the resources using Terraform
@@ -42,4 +43,12 @@ func destroyTerraform(t *testing.T, workingDir string) {
4243
terraform.DestroyE(t, terraformOptions)
4344
}
4445
fmt.Println(out)
46+
fmt.Println("####################################################################")
47+
fmt.Println("Clean up local state files")
48+
fmt.Println("####################################################################")
49+
// Clean up local state files
50+
os.RemoveAll(filepath.Join(workingDir, ".terraform"))
51+
os.Remove(filepath.Join(workingDir, ".test-data"))
52+
os.Remove(filepath.Join(workingDir, "terraform.tfstate"))
53+
os.Remove(filepath.Join(workingDir, "terraform.tfstate.backup"))
4554
}

aws-observability-terraform/test/sourcemodule/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
- aws-observability-terraform/examples/sourcemodule/overrideSources/main.auto.tfvars
1717
3. Provide Existing collectorID and S3 bucket at function TestSourceModule4 at
1818
- aws-observability-terraform/test/sourcemodule/source_test.go
19-
4. Go to folder aws-observability-terraform and run following command to execute all Test functions, with function name pattern as Test*
20-
```go test -v -timeout 50m ./test/sourcemodule```
19+
4. Go to folder aws-observability-terraform and
20+
- Run following command to execute all Test functions, with function name pattern as Test*
21+
```go test -v -timeout 100m ./test/sourcemodule```
22+
For single Terratest case
23+
```go test -v -timeout 20m ./test/sourcemodule -run ^TestSourceModule1$```
2124
5. Go test command runs all functions starting with name Test*. So if you want to run a particular test case according to your use case, comment the rest of the Testing functions. It’ll take less time to run than running all test cases.
2225
6. For example if you only run testcase 3 you can expect successful test execution as follows:
2326

aws-observability-terraform/test/sourcemodule/source_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestSourceModule2(t *testing.T) {
179179
})
180180
}
181181

182-
Testing scenerio 3 - Collect CW Logs via Lambda Log forwarder, CW Metrics via CW metric source
182+
// Testing scenario 3 - Collect CW Logs via Lambda Log forwarder, CW Metrics via CW metric source
183183
func TestSourceModule3(t *testing.T) {
184184
// t.Parallel()
185185

0 commit comments

Comments
 (0)