Add EnvSettings.SetNamespace method

Signed-off-by: Ilya Shaisultanov <ilya.shaisultanov@gmail.com>
pull/7504/head
Ilya Shaisultanov 6 years ago
parent df20164cd2
commit 10266a6b72

@ -121,6 +121,11 @@ func (s *EnvSettings) Namespace() string {
return "default"
}
//SetNamespace sets the namespace
func (s *EnvSettings) SetNamespace(ns string) {
s.namespace = ns
}
//RESTClientGetter gets the kubeconfig from EnvSettings
func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter {
s.configOnce.Do(func() {

@ -86,6 +86,13 @@ func TestEnvSettings(t *testing.T) {
}
})
}
settings := New()
settings.SetNamespace("custom-namespace")
if settings.Namespace() != "custom-namespace" {
t.Errorf("expected namespace %s, got %s", "custom-namespace", settings.Namespace())
}
}
func resetEnv() func() {

Loading…
Cancel
Save