Pass http getter as pointer in tests

Signed-off-by: Matthias Fehr <matthias@monostream.com>
(cherry picked from commit 7d22040e66)
release-3.8
Matthias Fehr 3 years ago committed by Matt Farina
parent 65b6e6d1ca
commit b216f76899
No known key found for this signature in database
GPG Key ID: 92C44A3D421FF7F9

@ -402,24 +402,24 @@ func TestHTTPGetterTarDownload(t *testing.T) {
func TestHttpClientInsecureSkipVerify(t *testing.T) {
g := HTTPGetter{}
g.opts.url = "https://localhost"
verifyInsecureSkipVerify(t, g, "Blank HTTPGetter", false)
verifyInsecureSkipVerify(t, &g, "Blank HTTPGetter", false)
g = HTTPGetter{}
g.opts.url = "https://localhost"
g.opts.caFile = "testdata/ca.crt"
verifyInsecureSkipVerify(t, g, "HTTPGetter with ca file", false)
verifyInsecureSkipVerify(t, &g, "HTTPGetter with ca file", false)
g = HTTPGetter{}
g.opts.url = "https://localhost"
g.opts.insecureSkipVerifyTLS = true
verifyInsecureSkipVerify(t, g, "HTTPGetter with skip cert verification only", true)
verifyInsecureSkipVerify(t, &g, "HTTPGetter with skip cert verification only", true)
g = HTTPGetter{}
g.opts.url = "https://localhost"
g.opts.certFile = "testdata/client.crt"
g.opts.keyFile = "testdata/client.key"
g.opts.insecureSkipVerifyTLS = true
transport := verifyInsecureSkipVerify(t, g, "HTTPGetter with 2 way ssl", true)
transport := verifyInsecureSkipVerify(t, &g, "HTTPGetter with 2 way ssl", true)
if len(transport.TLSClientConfig.Certificates) <= 0 {
t.Fatal("transport.TLSClientConfig.Certificates is not present")
}
@ -428,7 +428,7 @@ func TestHttpClientInsecureSkipVerify(t *testing.T) {
}
}
func verifyInsecureSkipVerify(t *testing.T, g HTTPGetter, caseName string, expectedValue bool) *http.Transport {
func verifyInsecureSkipVerify(t *testing.T, g *HTTPGetter, caseName string, expectedValue bool) *http.Transport {
returnVal, err := g.httpClient()
if err != nil {

Loading…
Cancel
Save