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

Function addParentWithDownloadingChildren

cmd/display/tty_test.go:609–635  ·  view source on GitHub ↗

addParentWithDownloadingChildren wires a parent task with N children whose non-zero totals trigger the " X.XMB / Y.YMB" suffix in prepareLineData's progress field. Used by the multi-render regression test below.

(w *ttyWriter, parentID string, children int, totalBytes int64)

Source from the content-addressed store, hash-verified

607// non-zero totals trigger the " X.XMB / Y.YMB" suffix in prepareLineData's
608// progress field. Used by the multi-render regression test below.
609func addParentWithDownloadingChildren(w *ttyWriter, parentID string, children int, totalBytes int64) {
610 parent := &task{
611 ID: parentID,
612 parents: make(map[string]struct{}),
613 startTime: time.Now(),
614 text: "Pulling",
615 status: api.Working,
616 spinner: NewSpinner(),
617 }
618 w.tasks[parent.ID] = parent
619 w.ids = append(w.ids, parent.ID)
620 for i := range children {
621 c := &task{
622 ID: fmt.Sprintf("%s/layer%d", parentID, i),
623 parents: map[string]struct{}{parent.ID: {}},
624 startTime: time.Now(),
625 text: "Downloading",
626 status: api.Working,
627 total: totalBytes / int64(children),
628 current: totalBytes / int64(children) / 2,
629 percent: 50,
630 spinner: NewSpinner(),
631 }
632 w.tasks[c.ID] = c
633 w.ids = append(w.ids, c.ID)
634 }
635}
636
637// TestPrintWithDimensions_MultipleRendersFit verifies the cross-render aspect
638// of docker/compose#13595: even a single overflowing line desyncs the cursor

Calls 1

NewSpinnerFunction · 0.85

Tested by

no test coverage detected