Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Mar 31, 2021
1 parent 30bb6c7 commit 7a21f4c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions get_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,23 @@ func TestHttpGetter_file(t *testing.T) {
assertContents(t, dst, "Hello\n")
}

// TestHttpGetter_http2server tests that http.Request is not reused
// between HEAD & GET, which would lead to race condition in HTTP/2.
// This test is only meaningful for the race detector (go test -race).
func TestHttpGetter_http2server(t *testing.T) {
g := new(HttpGetter)
src, err := url.Parse("https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_SHA256SUMS")
if err != nil {
t.Fatal(err)
}
dst := tempTestFile(t)

err = g.GetFile(dst, src)
if err != nil {
t.Fatal(err)
}
}

func TestHttpGetter_auth(t *testing.T) {
ln := testHttpServer(t)
defer ln.Close()
Expand Down

0 comments on commit 7a21f4c

Please sign in to comment.