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

Function TestPushAndPullContainer

pkg/registry/compatibility_test.go:30–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestPushAndPullContainer(t *testing.T) {
31 s := httptest.NewServer(registry.New())
32 defer s.Close()
33
34 r := strings.TrimPrefix(s.URL, "http://") + "/foo:latest"
35 d, err := name.NewTag(r)
36 if err != nil {
37 t.Fatalf("Unable to create tag: %v", err)
38 }
39
40 i, err := random.Image(1024, 1)
41 if err != nil {
42 t.Fatalf("Unable to make random image: %v", err)
43 }
44
45 if err := remote.Write(d, i); err != nil {
46 t.Fatalf("Error writing image: %v", err)
47 }
48
49 ref, err := name.ParseReference(r)
50 if err != nil {
51 t.Fatalf("Error parsing tag: %v", err)
52 }
53
54 ri, err := remote.Image(ref)
55 if err != nil {
56 t.Fatalf("Error reading image: %v", err)
57 }
58
59 b := &bytes.Buffer{}
60 if err := tarball.Write(ref, ri, b); err != nil {
61 t.Fatalf("Error writing image to tarball: %v", err)
62 }
63}

Callers

nothing calls this directly

Calls 8

NewFunction · 0.92
NewTagFunction · 0.92
ImageFunction · 0.92
WriteFunction · 0.92
ParseReferenceFunction · 0.92
ImageFunction · 0.92
WriteFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…