diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index 06ddad6d84..1eb73720a8 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -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()) } diff --git a/pkg/api/conversion.go b/pkg/api/conversion.go index 372adb7609..f6a6204563 100644 --- a/pkg/api/conversion.go +++ b/pkg/api/conversion.go @@ -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 { diff --git a/pkg/kubelet/config/http_test.go b/pkg/kubelet/config/http_test.go index 7c1196e1d2..f556774cc1 100644 --- a/pkg/kubelet/config/http_test.go +++ b/pkg/kubelet/config/http_test.go @@ -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{}},