Skip to content

Commit

Permalink
chore: add conformance suite client options (#3343)
Browse files Browse the repository at this point in the history
pass options to the Kubernetes client
  • Loading branch information
BobyMCbobs authored Sep 18, 2024
1 parent f5b5bab commit b5e115d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion conformance/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import (
func DefaultOptions(t *testing.T) suite.ConformanceOptions {
cfg, err := config.GetConfig()
require.NoError(t, err, "error loading Kubernetes config")
client, err := client.New(cfg, client.Options{})
clientOptions := client.Options{}
client, err := client.New(cfg, clientOptions)
require.NoError(t, err, "error initializing Kubernetes client")

// This clientset is needed in addition to the client only because
Expand Down Expand Up @@ -79,6 +80,7 @@ func DefaultOptions(t *testing.T) suite.ConformanceOptions {
AllowCRDsMismatch: *flags.AllowCRDsMismatch,
CleanupBaseResources: *flags.CleanupBaseResources,
Client: client,
ClientOptions: clientOptions,
Clientset: clientset,
ConformanceProfiles: conformanceProfiles,
Debug: *flags.ShowDebug,
Expand Down
5 changes: 4 additions & 1 deletion conformance/utils/suite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
// conformance tests.
type ConformanceTestSuite struct {
Client client.Client
ClientOptions client.Options
Clientset clientset.Interface
RESTClient *rest.RESTClient
RestConfig *rest.Config
Expand Down Expand Up @@ -123,6 +124,7 @@ type ConformanceTestSuite struct {
// Options can be used to initialize a ConformanceTestSuite.
type ConformanceOptions struct {
Client client.Client
ClientOptions client.Options
Clientset clientset.Interface
RestConfig *rest.Config
GatewayClassName string
Expand Down Expand Up @@ -234,6 +236,7 @@ func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite,

suite := &ConformanceTestSuite{
Client: options.Client,
ClientOptions: options.ClientOptions,
Clientset: options.Clientset,
RestConfig: options.RestConfig,
RoundTripper: roundTripper,
Expand Down Expand Up @@ -398,7 +401,7 @@ func (suite *ConformanceTestSuite) setClientsetForTest(test ConformanceTest) err
strings.Join(featureNames, ","),
},
"::")
client, err := client.New(suite.RestConfig, client.Options{})
client, err := client.New(suite.RestConfig, suite.ClientOptions)
if err != nil {
return err
}
Expand Down

0 comments on commit b5e115d

Please sign in to comment.