Address comments, fix tests.

This commit is contained in:
Brendan Burns
2015-01-30 20:51:40 -08:00
parent 250b9ccd74
commit 7e48b26ff5
4 changed files with 44 additions and 6 deletions

View File

@@ -59,6 +59,42 @@ func TestGenerate(t *testing.T) {
},
},
},
{
params: map[string]string{
"name": "foo",
"image": "someimage",
"replicas": "1",
"port": "80",
},
expected: &api.ReplicationController{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"run-container": "foo"},
},
Spec: api.ReplicationControllerSpec{
Replicas: 1,
Selector: map[string]string{"run-container": "foo"},
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"run-container": "foo"},
},
Spec: api.PodSpec{
Containers: []api.Container{
{
Name: "foo",
Image: "someimage",
Ports: []api.Port{
{
ContainerPort: 80,
},
},
},
},
},
},
},
},
},
{
params: map[string]string{
"name": "foo",
@@ -97,8 +133,8 @@ func TestGenerate(t *testing.T) {
if !test.expectErr && err != nil {
t.Errorf("unexpected error: %v", err)
}
if !reflect.DeepEqual(obj, test.expected) {
t.Errorf("\nexpected:\n%v\nsaw:\n%v", test.expected, obj)
if !reflect.DeepEqual(obj.(*api.ReplicationController).Spec.Template, test.expected.Spec.Template) {
t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected.Spec.Template, obj.(*api.ReplicationController).Spec.Template)
}
}
}