MCPcopy Create free account
hub / github.com/docker/cli / TestManifestCreateRefuseAmend

Function TestManifestCreateRefuseAmend

cli/command/manifest/create_test.go:80–96  ·  view source on GitHub ↗

attempt to overwrite a saved manifest and get refused

(t *testing.T)

Source from the content-addressed store, hash-verified

78
79// attempt to overwrite a saved manifest and get refused
80func TestManifestCreateRefuseAmend(t *testing.T) {
81 manifestStore := store.NewStore(t.TempDir())
82
83 cli := test.NewFakeCli(nil)
84 cli.SetManifestStore(manifestStore)
85 namedRef := ref(t, "alpine:3.0")
86 imageManifest := fullImageManifest(t, namedRef)
87 err := manifestStore.Save(ref(t, "list:v1"), namedRef, imageManifest)
88 assert.NilError(t, err)
89
90 cmd := newCreateListCommand(cli)
91 cmd.SetArgs([]string{"example.com/list:v1", "example.com/alpine:3.0"})
92 cmd.SetOut(io.Discard)
93 cmd.SetErr(io.Discard)
94 err = cmd.Execute()
95 assert.Error(t, err, "refusing to amend an existing manifest list with no --amend flag")
96}
97
98// attempt to make a manifest list without valid images
99func TestManifestCreateNoManifest(t *testing.T) {

Callers

nothing calls this directly

Calls 9

SetManifestStoreMethod · 0.95
SaveMethod · 0.95
fullImageManifestFunction · 0.85
newCreateListCommandFunction · 0.85
SetArgsMethod · 0.80
refFunction · 0.70
SetOutMethod · 0.45
SetErrMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…