Skip to content

Commit

Permalink
Use HTTPClientFor instead of defaultHTTPClient
Browse files Browse the repository at this point in the history
This allows for the http client to accept certificates from the kind
cluster.
  • Loading branch information
SimonTheLeg authored and ash2k committed Aug 9, 2023
1 parent e708f5a commit 542546c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ package e2e
import (
"context"
"fmt"
"net/http"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/scheme"
"sigs.k8s.io/cli-utils/test/e2e/e2eutil"
Expand Down Expand Up @@ -68,7 +68,9 @@ var _ = BeforeSuite(func() {
inventoryConfigs[ConfigMapTypeInvConfig] = invconfig.NewConfigMapTypeInvConfig(cfg)
inventoryConfigs[CustomTypeInvConfig] = invconfig.NewCustomTypeInvConfig(cfg)

mapper, err := apiutil.NewDynamicRESTMapper(cfg, http.DefaultClient)
httpClient, err := rest.HTTPClientFor(cfg)
Expect(err).NotTo(HaveOccurred())
mapper, err := apiutil.NewDynamicRESTMapper(cfg, httpClient)
Expect(err).NotTo(HaveOccurred())

c, err = client.New(cfg, client.Options{
Expand Down
6 changes: 4 additions & 2 deletions test/stress/stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package stress

import (
"context"
"net/http"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/scheme"
"sigs.k8s.io/cli-utils/test/e2e/e2eutil"
Expand Down Expand Up @@ -55,7 +55,9 @@ var _ = BeforeSuite(func() {

invConfig = invconfig.NewCustomTypeInvConfig(cfg)

mapper, err := apiutil.NewDynamicRESTMapper(cfg, http.DefaultClient)
httpClient, err := rest.HTTPClientFor(cfg)
Expect(err).NotTo(HaveOccurred())
mapper, err := apiutil.NewDynamicRESTMapper(cfg, httpClient)
Expect(err).NotTo(HaveOccurred())

c, err = client.New(cfg, client.Options{
Expand Down

0 comments on commit 542546c

Please sign in to comment.