Use correct namespace in unit tests that use fake clientset

Fake clientset no longer needs to be prepopulated with records: keeping
them in leads to the name conflict on creates. Also, since fake
clientset now respects namespaces, we need to correctly populate them.
This commit is contained in:
Oleg Shaldybin
2016-06-01 18:47:36 -07:00
parent d445d4082d
commit 3b15d5be19
8 changed files with 47 additions and 19 deletions

View File

@@ -1426,8 +1426,25 @@ func newNode(name string) *api.Node {
}
func newPod(name, host string) *api.Pod {
return &api.Pod{ObjectMeta: api.ObjectMeta{Name: name}, Spec: api.PodSpec{NodeName: host},
Status: api.PodStatus{Conditions: []api.PodCondition{{Type: api.PodReady, Status: api.ConditionTrue}}}}
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Namespace: "default",
Name: name,
},
Spec: api.PodSpec{
NodeName: host,
},
Status: api.PodStatus{
Conditions: []api.PodCondition{
{
Type: api.PodReady,
Status: api.ConditionTrue,
},
},
},
}
return pod
}
func contains(node *api.Node, nodes []*api.Node) bool {