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

Function TestReconcileContainers_ScaleUp

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

Source from the content-addressed store, hash-verified

414}
415
416func 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
448func TestReconcileContainers_ScaleDown(t *testing.T) {
449 svc := types.ServiceConfig{Name: "web", Scale: intPtr(1)}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected