Skip to content

Commit 542546c

Browse files
SimonTheLegash2k
authored andcommitted
Use HTTPClientFor instead of defaultHTTPClient
This allows for the http client to accept certificates from the kind cluster.
1 parent e708f5a commit 542546c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

test/e2e/e2e_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ package e2e
66
import (
77
"context"
88
"fmt"
9-
"net/http"
109
"time"
1110

1211
. "github.com/onsi/ginkgo/v2"
1312
. "github.com/onsi/gomega"
1413
"github.com/onsi/gomega/format"
1514
v1 "k8s.io/api/core/v1"
1615
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
16+
"k8s.io/client-go/rest"
1717
"k8s.io/klog/v2"
1818
"k8s.io/kubectl/pkg/scheme"
1919
"sigs.k8s.io/cli-utils/test/e2e/e2eutil"
@@ -68,7 +68,9 @@ var _ = BeforeSuite(func() {
6868
inventoryConfigs[ConfigMapTypeInvConfig] = invconfig.NewConfigMapTypeInvConfig(cfg)
6969
inventoryConfigs[CustomTypeInvConfig] = invconfig.NewCustomTypeInvConfig(cfg)
7070

71-
mapper, err := apiutil.NewDynamicRESTMapper(cfg, http.DefaultClient)
71+
httpClient, err := rest.HTTPClientFor(cfg)
72+
Expect(err).NotTo(HaveOccurred())
73+
mapper, err := apiutil.NewDynamicRESTMapper(cfg, httpClient)
7274
Expect(err).NotTo(HaveOccurred())
7375

7476
c, err = client.New(cfg, client.Options{

test/stress/stress_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ package stress
55

66
import (
77
"context"
8-
"net/http"
98
"time"
109

1110
. "github.com/onsi/ginkgo/v2"
1211
. "github.com/onsi/gomega"
1312
"github.com/onsi/gomega/format"
1413
v1 "k8s.io/api/core/v1"
14+
"k8s.io/client-go/rest"
1515
"k8s.io/klog/v2"
1616
"k8s.io/kubectl/pkg/scheme"
1717
"sigs.k8s.io/cli-utils/test/e2e/e2eutil"
@@ -55,7 +55,9 @@ var _ = BeforeSuite(func() {
5555

5656
invConfig = invconfig.NewCustomTypeInvConfig(cfg)
5757

58-
mapper, err := apiutil.NewDynamicRESTMapper(cfg, http.DefaultClient)
58+
httpClient, err := rest.HTTPClientFor(cfg)
59+
Expect(err).NotTo(HaveOccurred())
60+
mapper, err := apiutil.NewDynamicRESTMapper(cfg, httpClient)
5961
Expect(err).NotTo(HaveOccurred())
6062

6163
c, err = client.New(cfg, client.Options{

0 commit comments

Comments
 (0)