Add a placeholder to boundPod's SelfLink, and test that one can make references to them.

This commit is contained in:
Daniel Smith
2014-11-03 17:46:08 -08:00
parent c4aa4d28a6
commit 724db61c1d
3 changed files with 17 additions and 8 deletions

View File

@@ -43,5 +43,9 @@ func (b *BasicBoundPodFactory) MakeBoundPod(machine string, pod *api.Pod) (*api.
for ix, container := range boundPod.Spec.Containers {
boundPod.Spec.Containers[ix].Env = append(container.Env, envVars...)
}
// Make a dummy self link so that references to this bound pod will work.
// TODO: When kubelets get boundPods from apiserver instead of etcd, then
// the selflink should be generated there.
boundPod.SelfLink = "/api/v1beta1/boundPods/" + boundPod.Name
return boundPod, nil
}

View File

@@ -54,6 +54,10 @@ func TestMakeBoundPodNoServices(t *testing.T) {
if pod.Name != "foobar" {
t.Errorf("Failed to assign ID to pod: %#v", pod.Name)
}
if _, err := api.GetReference(pod); err != nil {
t.Errorf("Unable to get a reference to bound pod: %v", err)
}
}
func TestMakeBoundPodServices(t *testing.T) {