(t *testing.T)
| 554 | } |
| 555 | |
| 556 | func 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 |
nothing calls this directly
no test coverage detected