Skip to content

Commit 1ceb719

Browse files
authored
Merge pull request #58 from brikis98/fix-hello-world-test
Fix TestHelloWorldAppExample
2 parents ddb2965 + 5bdb662 commit 1ceb719

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

code/terraform/07-testing-terraform-code/test/hello_world_app_example_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package test
33
import (
44
"fmt"
55
"github.com/gruntwork-io/terratest/modules/random"
6+
"strings"
67

78
"github.com/gruntwork-io/terratest/modules/http-helper"
89

@@ -36,19 +37,18 @@ func TestHelloWorldAppExample(t *testing.T) {
3637
albDnsName := terraform.OutputRequired(t, opts, "alb_dns_name")
3738
url := fmt.Sprintf("http://%s", albDnsName)
3839

39-
expectedStatus := 200
40-
expectedBody := "Hello, World"
41-
4240
maxRetries := 10
4341
timeBetweenRetries := 10 * time.Second
4442

45-
http_helper.HttpGetWithRetry(
43+
http_helper.HttpGetWithRetryWithCustomValidation(
4644
t,
4745
url,
48-
expectedStatus,
49-
expectedBody,
5046
maxRetries,
5147
timeBetweenRetries,
48+
func(status int, body string) bool {
49+
return status == 200 &&
50+
strings.Contains(body, "Hello, World")
51+
},
5252
)
5353

5454
}

0 commit comments

Comments
 (0)