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

Function TestReconcileContainers_ExitedIsNoop

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

Source from the content-addressed store, hash-verified

554}
555
556func TestReconcileContainers_ExitedIsNoop(t *testing.T) {
557 svc := types.ServiceConfig{Name: "web", Scale: intPtr(1)}
558 hash := mustServiceHash(t, svc)
559
560 project := &types.Project{
561 Name: "myproject",
562 Services: types.Services{"web": svc},
563 }
564 observed := &ObservedState{
565 ProjectName: "myproject",
566 Containers: map[string][]ObservedContainer{
567 "web": {{
568 ID: "c1", Number: 1, State: container.StateExited, ConfigHash: hash,
569 Summary: container.Summary{
570 ID: "c1", State: container.StateExited,
571 Labels: map[string]string{api.ServiceLabel: "web", api.ContainerNumberLabel: "1", api.ConfigHashLabel: hash},
572 },
573 }},
574 },
575 Networks: map[string]ObservedNetwork{},
576 Volumes: map[string]ObservedVolume{},
577 }
578
579 plan, err := reconcile(t.Context(), project, observed, defaultReconcileOptions(), noPrompt)
580 assert.NilError(t, err)
581 // Exited containers are left as-is, matching convergence.go:199 behavior
582 assert.Assert(t, plan.IsEmpty())
583}
584
585// TestReconcileContainers_DependsOnChain verifies that a dependent service's
586// container creation depends on the last plan node of the service it depends

Callers

nothing calls this directly

Calls 5

intPtrFunction · 0.85
mustServiceHashFunction · 0.85
reconcileFunction · 0.85
defaultReconcileOptionsFunction · 0.85
IsEmptyMethod · 0.45

Tested by

no test coverage detected