Fix selfLink issues in integration test

pull/6/head
Paul Morie 2015-03-10 14:34:07 -04:00 committed by markturansky
parent c7e619d4a0
commit a486ab078f
3 changed files with 14 additions and 1 deletions

View File

@ -780,7 +780,7 @@ func main() {
// 1 pod infra container + 2 pods from the URL +
// 1 pod infra container + 1 pod from the service test.
if len(createdPods) != 9 {
glog.Fatalf("Unexpected list of created pods:\n\n%#v\n\n%#v\n\n%#v\n\n", createdPods.List(), fakeDocker1.Created, fakeDocker2.Created)
glog.Fatalf("Expected 9 pods; got %v\n\nlist of created pods:\n\n%#v\n\nDocker 1 Created:\n\n%#v\n\nDocker 2 Created:\n\n%#v\n\n", len(createdPods), createdPods.List(), fakeDocker1.Created, fakeDocker2.Created)
}
glog.Infof("OK - found created pods: %#v", createdPods.List())
}

View File

@ -40,6 +40,10 @@ func init() {
return nil
},
// Convert ContainerManifest to BoundPod
//
// This function generates a dummy selfLink using the same method as the
// boundPod registry, in order for the Kubelet to work with well-formed
// boundPods during the integration test.
func(in *ContainerManifest, out *BoundPod, s conversion.Scope) error {
out.Spec.Containers = in.Containers
out.Spec.Volumes = in.Volumes
@ -47,6 +51,11 @@ func init() {
out.Spec.DNSPolicy = in.DNSPolicy
out.Name = in.ID
out.UID = in.UUID
if in.ID != "" {
out.SelfLink = "/api/v1beta1/boundPods/" + in.ID
}
return nil
},
func(in *BoundPod, out *ContainerManifest, s conversion.Scope) error {

View File

@ -137,6 +137,7 @@ func TestExtractFromHTTP(t *testing.T) {
UID: "111",
Name: "foo" + "-" + hostname,
Namespace: "foobar",
SelfLink: "/api/v1beta1/boundPods/foo",
},
Spec: api.PodSpec{
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
@ -177,6 +178,7 @@ func TestExtractFromHTTP(t *testing.T) {
UID: "111",
Name: "foo" + "-" + hostname,
Namespace: "foobar",
SelfLink: "/api/v1beta1/boundPods/foo",
},
Spec: api.PodSpec{
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
@ -204,6 +206,7 @@ func TestExtractFromHTTP(t *testing.T) {
UID: "111",
Name: "foo" + "-" + hostname,
Namespace: "foobar",
SelfLink: "/api/v1beta1/boundPods/foo",
},
Spec: api.PodSpec{
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
@ -220,6 +223,7 @@ func TestExtractFromHTTP(t *testing.T) {
UID: "222",
Name: "bar" + "-" + hostname,
Namespace: "foobar",
SelfLink: "/api/v1beta1/boundPods/bar",
},
Spec: api.PodSpec{
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},