mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 00:34:10 -04:00
add ut for cluster-scoped controller case
This commit is contained in:
parent
b3e4fed844
commit
a67f22c849
1 changed files with 20 additions and 0 deletions
|
|
@ -208,6 +208,26 @@ func TestClaimPods(t *testing.T) {
|
|||
patches: 1,
|
||||
}
|
||||
}(),
|
||||
func() test {
|
||||
// act as a cluster-scoped controller
|
||||
controller := v1.ReplicationController{}
|
||||
controller.Namespace = ""
|
||||
controller.UID = types.UID(controllerUID)
|
||||
pod1 := newPod("pod1", productionLabel, nil)
|
||||
pod2 := newPod("pod2", productionLabel, nil)
|
||||
pod2.Namespace = "fakens"
|
||||
return test{
|
||||
name: "Cluster scoped controller claims pods of specified namespace",
|
||||
manager: NewPodControllerRefManager(&FakePodControl{},
|
||||
&controller,
|
||||
productionLabelSelector,
|
||||
controllerKind,
|
||||
func(ctx context.Context) error { return nil }),
|
||||
pods: []*v1.Pod{pod1, pod2},
|
||||
claimed: []*v1.Pod{pod1, pod2},
|
||||
patches: 2,
|
||||
}
|
||||
}(),
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue