Closed syreddy84 closed 4 years ago
Ah, you must've ended up with a newer version of Terratest. The newer one now takes in a *tls.Config
argument after the URL. You can either fix it by setting that argument to nil
(which should be fine since we're making HTTP requests in this test, not HTTPS) or downgrading to an older Terratest version.
Hi I have updated the tls.Config to nil, but i got this error instead.
TestAlbExample 2020-04-07T12:18:22+08:00 retry.go:72: HTTP GET to URL https://terraform-up-and-running-669391245.us-east-2.elb.amazonaws.com
TestAlbExample 2020-04-07T12:18:22+08:00 http_helper.go:27: Making an HTTP GET call to URL https://terraform-up-and-running-669391245.us-east-2.elb.amazonaws.com
TestAlbExample 2020-04-07T12:18:32+08:00 retry.go:84: HTTP GET to URL https://terraform-up-and-running-669391245.us-east-2.elb.amazonaws.com returned an error: Get "https://terraform-up-and-running-669391245.us-east-2.elb.amazonaws.com": dial tcp 3.22.108.33:443: i/o timeout (Client.Timeout exceeded while awaiting headers). Sleeping for 20s and will try again.
looks like something to do with the tls?
What code are you running? The http_helper
will use whatever URL you pass in... And I'm noticing the URL is https
, so are you setting that to https intentionally? The examples in the book all use http.
my mistake.. typo there. thanks for pointing that out.
different but somehow related, but in the next test case for dependency injection, the test kept failing with :-
`TestHelloWorldAppExample 2020-04-07T18:52:43+08:00 retry.go:72: HTTP GET to URL http://hello-world-test-MZnpP5-1676154927.us-east-2.elb.amazonaws.com TestHelloWorldAppExample 2020-04-07T18:52:43+08:00 http_helper.go:32: Making an HTTP GET call to URL http://hello-world-test-MZnpP5-1676154927.us-east-2.elb.amazonaws.com TestHelloWorldAppExample 2020-04-07T18:52:44+08:00 retry.go:84: HTTP GET to URL http://hello-world-test-MZnpP5-1676154927.us-east-2.elb.amazonaws.com returned an error: Validation failed for URL http://hello-world-test-MZnpP5-1676154927.us-east-2.elb.amazonaws.com. Response status: 200. Response body:
DB address: mock-value-for-test
DB port: 3306
. Sleeping for 10s and will try again. ` Am I supposed to change anything, i.e. the mock DB address?Which test is this? What chapter/section?
Chapter 7, Dependency Injection Test Codes, Pg 243 onwards
Oh, you're right, that is a bug! The test is looking for the response body to be exactly "Hello, World" (see here), but instead, it should be looking for the body to contain "Hello, World". Not sure how that slipped by. I'll fix it this weekend.
thanks for the fix
Hi,
I am unable to run terra tests mentioned in chapter 7 because of the below errors. can you please help
/alb_example_test.go:36:30: not enough arguments in call to http_helper.HttpGetWithRetry have ("testing".T, string, int, string, int, time.Duration) want ("prod-grade-infra/vendor/github.com/gruntwork-io/terratest/modules/testing".TestingT, string, tls.Config, int, string, int, time.Duration)