Limit the type for kubectl expose command

This commit is contained in:
feihujiang
2015-08-26 16:06:40 +08:00
parent 3d2816435b
commit 98689a99ec
9 changed files with 90 additions and 15 deletions

View File

@@ -165,6 +165,33 @@ func TestLabelsForObject(t *testing.T) {
}
}
func TestCanBeExposed(t *testing.T) {
factory := NewFactory(nil)
tests := []struct {
kind string
expectErr bool
}{
{
kind: "ReplicationController",
expectErr: false,
},
{
kind: "Node",
expectErr: true,
},
}
for _, test := range tests {
err := factory.CanBeExposed(test.kind)
if test.expectErr && err == nil {
t.Error("unexpected non-error")
}
if !test.expectErr && err != nil {
t.Errorf("unexpected error: %v", err)
}
}
}
func TestFlagUnderscoreRenaming(t *testing.T) {
factory := NewFactory(nil)