expose: Re-use labels in case none was specified

This commit is contained in:
kargakis
2015-05-13 10:52:25 +02:00
parent 5010b2dde0
commit ac652d16e6
7 changed files with 77 additions and 6 deletions

View File

@@ -41,13 +41,15 @@ func TestRunExposeService(t *testing.T) {
args: []string{"service", "baz"},
input: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", ResourceVersion: "12"},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1beta3"},
Spec: api.ServiceSpec{
Selector: map[string]string{"app": "go"},
},
},
flags: map[string]string{"selector": "func=stream", "protocol": "UDP", "port": "14", "service-name": "foo"},
flags: map[string]string{"selector": "func=stream", "protocol": "UDP", "port": "14", "service-name": "foo", "labels": "svc=test"},
output: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", ResourceVersion: "12"},
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", ResourceVersion: "12", Labels: map[string]string{"svc": "test"}},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1beta3"},
Spec: api.ServiceSpec{
Ports: []api.ServicePort{
{