Skip to content

Commit e651c3e

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 a6abded commit e651c3e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/e2e/framework/util.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ func restclientConfig(kubeContext string) (*clientcmdapi.Config, error) {
469469
type ClientConfigGetter func() (*restclient.Config, error)
470470

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

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

0 commit comments

Comments
 (0)