From 6d9fe431512753dd9afc8d309064fad87c9b443a Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 21 Mar 2024 14:00:46 +0100 Subject: [PATCH] gock doesn't work with https (#18) --- pkg/client/client_test.go | 4 ++-- pkg/test/client.go | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index b3cc140..b198d73 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -26,14 +26,14 @@ import ( func TestNewClientOK(t *testing.T) { // given t.Cleanup(gock.OffAll) - gock.New("https://example.com"). + gock.New("http://example.com"). Get("api"). Persist(). Reply(200). BodyString("{}") // when - cl, err := client.NewClient("cool-token", "https://example.com") + cl, err := client.NewClient("cool-token", "http://example.com") // then require.NoError(t, err) diff --git a/pkg/test/client.go b/pkg/test/client.go index 6b4e4ff..966020d 100644 --- a/pkg/test/client.go +++ b/pkg/test/client.go @@ -42,14 +42,6 @@ func NewFakeClients(t *testing.T, initObjs ...runtime.Object) (clicontext.NewCli } func NewFakeExternalClient(t *testing.T, token string, apiEndpoint string) *rest.RESTClient { - // mock request to download a script from GitHub - gock.New("https://raw.githubusercontent.com"). - Get("codeready-toolchain/toolchain-cicd/master/scripts/add-cluster.sh"). - Persist(). // make sure multiple requests are all handled by Gock - Reply(200) - - // gock.Observe(gock.DumpRequest) - t.Cleanup(gock.OffAll) cl, err := client.NewRESTClient(token, apiEndpoint) require.NoError(t, err) // override the underlying client's transport with Gock to intercep requests