MCPcopy
hub / github.com/google/go-containerregistry / TestWrite_Progress

Function TestWrite_Progress

pkg/v1/remote/progress_test.go:99–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

97}
98
99func TestWrite_Progress(t *testing.T) {
100 img, err := random.Image(1000, 5)
101 if err != nil {
102 t.Fatal(err)
103 }
104 c := make(chan v1.Update, 200)
105
106 // Set up a fake registry.
107 s := httptest.NewServer(registry.New())
108 defer s.Close()
109 u, err := url.Parse(s.URL)
110 if err != nil {
111 t.Fatal(err)
112 }
113 dst := fmt.Sprintf("%s/test/progress/upload", u.Host)
114 ref, err := name.ParseReference(dst)
115 if err != nil {
116 t.Fatal(err)
117 }
118
119 if err := Write(ref, img, WithProgress(c)); err != nil {
120 t.Fatalf("Write: %v", err)
121 }
122
123 if err := checkUpdates(c); err != nil {
124 t.Fatal(err)
125 }
126}
127
128// An image with multiple identical layers is handled correctly.
129func TestWrite_Progress_DedupeLayers(t *testing.T) {

Callers

nothing calls this directly

Calls 7

ImageFunction · 0.92
NewFunction · 0.92
ParseReferenceFunction · 0.92
checkUpdatesFunction · 0.85
WriteFunction · 0.70
WithProgressFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…