Add a check in ConfirmUsable() to validate the contextName

This commit is contained in:
Angus Salkeld
2016-09-01 11:35:11 +10:00
parent 3269849ded
commit e9cad12e5f
3 changed files with 27 additions and 13 deletions

View File

@@ -49,12 +49,13 @@ func TestKubectlValidation(t *testing.T) {
// Enable swagger api on master.
components.KubeMaster.InstallSwaggerAPI()
cluster := clientcmdapi.NewCluster()
cluster.Server = components.ApiServer.URL
cluster.InsecureSkipTLSVerify = true
cfg.Contexts = map[string]*clientcmdapi.Context{"test": ctx}
cfg.CurrentContext = "test"
overrides := clientcmd.ConfigOverrides{
ClusterInfo: *cluster,
Context: *ctx,
CurrentContext: "test",
ClusterInfo: *cluster,
}
cmdConfig := clientcmd.NewNonInteractiveClientConfig(*cfg, "test", &overrides, nil)
factory := util.NewFactory(cmdConfig)