@@ -150,7 +150,39 @@ func TestProcess(t *testing.T) {
150150 expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
151151 },
152152 {
153- desc : "In child checkpoint: Inactive pod-checkpointer, local parent, local running, api parent: should start" ,
153+ desc : "Inactive pod-checkpointer, no local parent, no api parent: should remove all" ,
154+ localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}, "AA" : {}},
155+ localParents : map [string ]* v1.Pod {"AA" : {}},
156+ apiParents : map [string ]* v1.Pod {"AA" : {}},
157+ inactiveCheckpoints : map [string ]* v1.Pod {
158+ "kube-system/pod-checkpointer" : {
159+ ObjectMeta : v1.ObjectMeta {
160+ Namespace : "kube-system" ,
161+ Name : "pod-checkpointer" ,
162+ },
163+ },
164+ "AA" : {},
165+ },
166+ expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
167+ },
168+ {
169+ desc : "Active pod-checkpointer, no local parent, no api parent: should remove all" ,
170+ localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}, "AA" : {}},
171+ localParents : map [string ]* v1.Pod {"AA" : {}},
172+ apiParents : map [string ]* v1.Pod {"AA" : {}},
173+ activeCheckpoints : map [string ]* v1.Pod {
174+ "kube-system/pod-checkpointer" : {
175+ ObjectMeta : v1.ObjectMeta {
176+ Namespace : "kube-system" ,
177+ Name : "pod-checkpointer" ,
178+ },
179+ },
180+ "AA" : {},
181+ },
182+ expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
183+ },
184+ {
185+ desc : "Running as an on-disk checkpointer: Inactive pod-checkpointer, local parent, local running, api parent: should start" ,
154186 podName : "pod-checkpointer-mynode" ,
155187 localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}},
156188 localParents : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}},
@@ -166,7 +198,8 @@ func TestProcess(t *testing.T) {
166198 expectStart : []string {"kube-system/pod-checkpointer" },
167199 },
168200 {
169- desc : "In child checkpoint: Inactive pod-checkpointer, local parent, no local running, api not reachable: should start" ,
201+ desc : "Running as an on-disk checkpointer: Inactive pod-checkpointer, local parent, no local running, api not reachable: should start" ,
202+ podName : "pod-checkpointer-mynode" ,
170203 localParents : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}},
171204 inactiveCheckpoints : map [string ]* v1.Pod {
172205 "kube-system/pod-checkpointer" : {
@@ -179,7 +212,7 @@ func TestProcess(t *testing.T) {
179212 expectStart : []string {"kube-system/pod-checkpointer" },
180213 },
181214 {
182- desc : "In child checkpoint : Inactive pod-checkpointer, no local parent, no api parent: should remove in the last" ,
215+ desc : "Running as an on-disk checkpointer : Inactive pod-checkpointer, no local parent, no api parent: should remove in the last" ,
183216 podName : "pod-checkpointer-mynode" ,
184217 localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}, "AA" : {}},
185218 localParents : map [string ]* v1.Pod {"BB" : {}},
@@ -195,6 +228,40 @@ func TestProcess(t *testing.T) {
195228 },
196229 expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
197230 },
231+ {
232+ desc : "Running as an on-disk checkpointer: Inactive pod-checkpointer, no local parent, no api parent: should remove all" ,
233+ podName : "pod-checkpointer-mynode" ,
234+ localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}, "AA" : {}},
235+ localParents : map [string ]* v1.Pod {"AA" : {}},
236+ apiParents : map [string ]* v1.Pod {"AA" : {}},
237+ inactiveCheckpoints : map [string ]* v1.Pod {
238+ "kube-system/pod-checkpointer" : {
239+ ObjectMeta : v1.ObjectMeta {
240+ Namespace : "kube-system" ,
241+ Name : "pod-checkpointer" ,
242+ },
243+ },
244+ "AA" : {},
245+ },
246+ expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
247+ },
248+ {
249+ desc : "Running as an on-disk checkpointer: Active pod-checkpointer, no local parent, no api parent: should remove all" ,
250+ podName : "pod-checkpointer-mynode" ,
251+ localRunning : map [string ]* v1.Pod {"kube-system/pod-checkpointer" : {}, "AA" : {}},
252+ localParents : map [string ]* v1.Pod {"AA" : {}},
253+ apiParents : map [string ]* v1.Pod {"AA" : {}},
254+ activeCheckpoints : map [string ]* v1.Pod {
255+ "kube-system/pod-checkpointer" : {
256+ ObjectMeta : v1.ObjectMeta {
257+ Namespace : "kube-system" ,
258+ Name : "pod-checkpointer" ,
259+ },
260+ },
261+ "AA" : {},
262+ },
263+ expectRemove : []string {"AA" , "kube-system/pod-checkpointer" },
264+ },
198265 }
199266
200267 for _ , tc := range cases {
0 commit comments