(t *testing.T)
| 414 | } |
| 415 | |
| 416 | func TestReconcileContainers_ScaleUp(t *testing.T) { |
| 417 | svc := types.ServiceConfig{Name: "web", Scale: intPtr(3)} |
| 418 | hash := mustServiceHash(t, svc) |
| 419 | |
| 420 | project := &types.Project{ |
| 421 | Name: "myproject", |
| 422 | Services: types.Services{"web": svc}, |
| 423 | } |
| 424 | observed := &ObservedState{ |
| 425 | ProjectName: "myproject", |
| 426 | Containers: map[string][]ObservedContainer{ |
| 427 | "web": {{ |
| 428 | ID: "c1", Number: 1, State: container.StateRunning, ConfigHash: hash, |
| 429 | Summary: container.Summary{ |
| 430 | ID: "c1", State: container.StateRunning, |
| 431 | Labels: map[string]string{api.ServiceLabel: "web", api.ContainerNumberLabel: "1", api.ConfigHashLabel: hash}, |
| 432 | }, |
| 433 | }}, |
| 434 | }, |
| 435 | Networks: map[string]ObservedNetwork{}, |
| 436 | Volumes: map[string]ObservedVolume{}, |
| 437 | } |
| 438 | |
| 439 | plan, err := reconcile(t.Context(), project, observed, defaultReconcileOptions(), noPrompt) |
| 440 | assert.NilError(t, err) |
| 441 | |
| 442 | assert.Equal(t, plan.String(), strings.TrimSpace(` |
| 443 | [] -> #1 service:web:2, CreateContainer, no existing container |
| 444 | [] -> #2 service:web:3, CreateContainer, no existing container |
| 445 | `)+"\n") |
| 446 | } |
| 447 | |
| 448 | func TestReconcileContainers_ScaleDown(t *testing.T) { |
| 449 | svc := types.ServiceConfig{Name: "web", Scale: intPtr(1)} |
nothing calls this directly
no test coverage detected