Skip to content

Commit 4d4935b

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 b63eb4c commit 4d4935b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: test/e2e/framework/util.go

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

520520
// LoadConfig returns a config for a rest client with the UserAgent set to include the current test name.
521-
func LoadConfig() (config *restclient.Config, err error) {
521+
func LoadConfig(noUserAgent ...bool) (config *restclient.Config, err error) {
522522
defer func() {
523-
if err == nil && config != nil {
523+
if err == nil && config != nil && len(noUserAgent) == 0 {
524524
testDesc := ginkgo.CurrentSpecReport()
525525
if len(testDesc.ContainerHierarchyTexts) > 0 {
526526
testName := strings.Join(testDesc.ContainerHierarchyTexts, " ")
@@ -562,8 +562,8 @@ func LoadConfig() (config *restclient.Config, err error) {
562562
}
563563

564564
// LoadClientset returns clientset for connecting to kubernetes clusters.
565-
func LoadClientset() (*clientset.Clientset, error) {
566-
config, err := LoadConfig()
565+
func LoadClientset(noUserAgent ...bool) (*clientset.Clientset, error) {
566+
config, err := LoadConfig(noUserAgent...)
567567
if err != nil {
568568
return nil, fmt.Errorf("error creating client: %v", err.Error())
569569
}

0 commit comments

Comments
 (0)