MCPcopy
hub / github.com/baetyl/baetyl / TestGetDelObjectCfgs

Function TestGetDelObjectCfgs

engine/clean_test.go:240–376  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

238}
239
240func TestGetDelObjectCfgs(t *testing.T) {
241 finishedJobs := map[string]struct{}{
242 "app2": {},
243 }
244 cfg1 := specv1.Configuration{Name: "cfg1", Version: "v1"}
245 cfg2 := specv1.Configuration{Name: "cfg2", Version: "v2"}
246 cfg3 := specv1.Configuration{Name: "cfg3", Version: "v3"}
247 objectCfgs := map[string]*specv1.Configuration{
248 makeKey(specv1.KindConfiguration, "cfg1", "v1"): &cfg1,
249 makeKey(specv1.KindConfiguration, "cfg2", "v2"): &cfg2,
250 makeKey(specv1.KindConfiguration, "cfg3", "v3"): &cfg3,
251 }
252 occupiedApps := map[string]*specv1.Application{
253 "app1": {
254 Name: "app1",
255 Version: "v1",
256 Volumes: []specv1.Volume{{
257 Name: "vm1",
258 VolumeSource: specv1.VolumeSource{
259 Config: &specv1.ObjectReference{
260 Name: "cfg1",
261 Version: "v1",
262 },
263 },
264 }},
265 Services: []specv1.Service{{
266 Name: "svc1",
267 VolumeMounts: []specv1.VolumeMount{{
268 Name: "vm1",
269 AutoClean: false,
270 }},
271 }},
272 },
273 "app2": {
274 Name: "app2",
275 Version: "v1",
276 Volumes: []specv1.Volume{{
277 Name: "vm2",
278 VolumeSource: specv1.VolumeSource{
279 Config: &specv1.ObjectReference{
280 Name: "cfg2",
281 Version: "v2",
282 },
283 },
284 }},
285 Services: []specv1.Service{{
286 Name: "svc2",
287 VolumeMounts: []specv1.VolumeMount{{
288 Name: "vm2",
289 AutoClean: true,
290 }},
291 }},
292 },
293 }
294 obsoleteApps := map[string]*specv1.Application{
295 "app3": {
296 Name: "app3",
297 Version: "v2",

Callers

nothing calls this directly

Calls 2

getDelObjectCfgsFunction · 0.85
makeKeyFunction · 0.70

Tested by

no test coverage detected