Skip to content

Commit 30c0336

Browse files
p0lyn0mialbertinatto
authored andcommitted
UPSTREAM: <carry>: conditionally fill the UserAgent from the currently running test
OpenShift uses these function before any test is run and they cause NPE OpenShift-Rebase-Source: 834af76
1 parent cf2fe11 commit 30c0336

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/e2e/framework/util.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,9 @@ func restclientConfig(kubeContext string) (*clientcmdapi.Config, error) {
470470
type ClientConfigGetter func() (*restclient.Config, error)
471471

472472
// LoadConfig returns a config for a rest client with the UserAgent set to include the current test name.
473-
func LoadConfig() (config *restclient.Config, err error) {
473+
func LoadConfig(noUserAgent ...bool) (config *restclient.Config, err error) {
474474
defer func() {
475-
if err == nil && config != nil {
475+
if err == nil && config != nil && len(noUserAgent) == 0 {
476476
testDesc := ginkgo.CurrentSpecReport()
477477
if len(testDesc.ContainerHierarchyTexts) > 0 {
478478
testName := strings.Join(testDesc.ContainerHierarchyTexts, " ")
@@ -514,8 +514,8 @@ func LoadConfig() (config *restclient.Config, err error) {
514514
}
515515

516516
// LoadClientset returns clientset for connecting to kubernetes clusters.
517-
func LoadClientset() (*clientset.Clientset, error) {
518-
config, err := LoadConfig()
517+
func LoadClientset(noUserAgent ...bool) (*clientset.Clientset, error) {
518+
config, err := LoadConfig(noUserAgent...)
519519
if err != nil {
520520
return nil, fmt.Errorf("error creating client: %v", err.Error())
521521
}

0 commit comments

Comments
 (0)