mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
In test framework LoadConfig(), use CurrentContext.Server for TestContext.Host
if it is unset. Otherwise, kubectl exec through http/kubectl proxy tests in test/e2e/kubectl/kubectl.go would fail with "--host variable must be set to the full URI to the api server on e2e run" error. With this change, running the following tests can now pass: $ e2e.test --kubeconfig=xxx --ginkgo.focus="should support exec through"
This commit is contained in:
parent
110da204f6
commit
3698a2540d
@ -557,6 +557,14 @@ func LoadConfig() (config *restclient.Config, err error) {
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// In case Host is not set in TestContext, sets it as
|
||||
// CurrentContext Server for k8s API client to connect to.
|
||||
if TestContext.Host == "" && c.Clusters != nil {
|
||||
currentContext, ok := c.Clusters[c.CurrentContext]
|
||||
if ok {
|
||||
TestContext.Host = currentContext.Server
|
||||
}
|
||||
}
|
||||
|
||||
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: TestContext.Host}}).ClientConfig()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user