expose: --dry-run should dump the object

Also make some tests use --dry-run and compare generated objects
against expected
This commit is contained in:
kargakis
2015-10-03 01:52:42 +02:00
parent 49a5f89921
commit 083c5bebbd
3 changed files with 67 additions and 111 deletions

View File

@@ -228,12 +228,6 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
ClientConfig: func() (*client.Config, error) {
return t.ClientConfig, t.Err
},
CanBeExposed: func(kind string) error {
if kind != "ReplicationController" && kind != "Service" && kind != "Pod" {
return fmt.Errorf("invalid resource provided: %v, only a replication controller, service or pod is accepted", kind)
}
return nil
},
Generator: func(name string) (kubectl.Generator, bool) {
generator, ok := generators[name]
return generator, ok
@@ -241,6 +235,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
}
rf := cmdutil.NewFactory(nil)
f.PodSelectorForObject = rf.PodSelectorForObject
f.CanBeExposed = rf.CanBeExposed
return f, t, testapi.Default.Codec()
}