MCPcopy
hub / github.com/docker/compose / TestReconcileContainers_ConfigChanged

Function TestReconcileContainers_ConfigChanged

pkg/compose/reconcile_test.go:383–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func TestReconcileContainers_ConfigChanged(t *testing.T) {
384 project := &types.Project{
385 Name: "myproject",
386 Services: types.Services{
387 "web": {Name: "web", Scale: intPtr(1)},
388 },
389 }
390 observed := &ObservedState{
391 ProjectName: "myproject",
392 Containers: map[string][]ObservedContainer{
393 "web": {{
394 ID: "c1aabbccddee", Number: 1, State: container.StateRunning, ConfigHash: "oldhash",
395 Summary: container.Summary{
396 ID: "c1aabbccddee", State: container.StateRunning,
397 Labels: map[string]string{api.ServiceLabel: "web", api.ContainerNumberLabel: "1", api.ConfigHashLabel: "oldhash"},
398 },
399 }},
400 },
401 Networks: map[string]ObservedNetwork{},
402 Volumes: map[string]ObservedVolume{},
403 }
404
405 plan, err := reconcile(t.Context(), project, observed, defaultReconcileOptions(), noPrompt)
406 assert.NilError(t, err)
407
408 assert.Equal(t, plan.String(), strings.TrimSpace(`
409[] -> #1 service:web:1, CreateContainer, config changed (tmpName) [recreate:web:1]
410[1] -> #2 service:web:1, StopContainer, replaced by #1 [recreate:web:1]
411[2] -> #3 service:web:1, RemoveContainer, replaced by #1 [recreate:web:1]
412[3] -> #4 service:web:1, RenameContainer, finalize recreate [recreate:web:1]
413`)+"\n")
414}
415
416func TestReconcileContainers_ScaleUp(t *testing.T) {
417 svc := types.ServiceConfig{Name: "web", Scale: intPtr(3)}

Callers

nothing calls this directly

Calls 4

intPtrFunction · 0.85
reconcileFunction · 0.85
defaultReconcileOptionsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected