Skip to content

Commit fdd575f

Browse files
authored
Merge pull request kubernetes#87030 from jiayingz/test-host
In test framework LoadConfig(), use CurrentContext.Server for TestCon…
2 parents 916edd9 + 3698a25 commit fdd575f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/e2e/framework/util.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,14 @@ func LoadConfig() (config *restclient.Config, err error) {
557557
}
558558
return nil, err
559559
}
560+
// In case Host is not set in TestContext, sets it as
561+
// CurrentContext Server for k8s API client to connect to.
562+
if TestContext.Host == "" && c.Clusters != nil {
563+
currentContext, ok := c.Clusters[c.CurrentContext]
564+
if ok {
565+
TestContext.Host = currentContext.Server
566+
}
567+
}
560568

561569
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: TestContext.Host}}).ClientConfig()
562570
}

0 commit comments

Comments
 (0)