From 5da6eb328f90e30aad99710738cc64c5ee7d8cb5 Mon Sep 17 00:00:00 2001 From: Christopher Fry Date: Fri, 6 Oct 2023 10:20:48 -0700 Subject: [PATCH] chore: skip server certificate verification for http requests in e2e tests (#15733) * chore: skip verifying server certificate for http requests in e2e tests Signed-off-by: Chris Fry * chore: skip certificate verification only for remote tests Signed-off-by: Chris Fry --------- Signed-off-by: Chris Fry --- test/e2e/fixture/http.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/e2e/fixture/http.go b/test/e2e/fixture/http.go index 58c56046d3858..1e818f5262024 100644 --- a/test/e2e/fixture/http.go +++ b/test/e2e/fixture/http.go @@ -2,6 +2,7 @@ package fixture import ( "bytes" + "crypto/tls" "encoding/json" "io" "net/http" @@ -27,7 +28,14 @@ func DoHttpRequest(method string, path string, data ...byte) (*http.Response, er return nil, err } req.AddCookie(&http.Cookie{Name: common.AuthCookieName, Value: token}) - return http.DefaultClient.Do(req) + + httpClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: IsRemote()}, + }, + } + + return httpClient.Do(req) } // DoHttpJsonRequest executes a http request against the Argo CD API server and unmarshals the response body as JSON