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

Function TestManifestAnnotateError

cli/command/manifest/annotate_test.go:14–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestManifestAnnotateError(t *testing.T) {
15 testCases := []struct {
16 args []string
17 expectedError string
18 }{
19 {
20 args: []string{"too-few-arguments"},
21 expectedError: "requires 2 arguments",
22 },
23 {
24 args: []string{"th!si'sa/fa!ke/li$t/name", "example.com/alpine:3.0"},
25 expectedError: "error parsing name for manifest list",
26 },
27 {
28 args: []string{"example.com/list:v1", "th!si'sa/fa!ke/im@ge/nam32"},
29 expectedError: "error parsing name for manifest",
30 },
31 }
32
33 for _, tc := range testCases {
34 cli := test.NewFakeCli(nil)
35 cmd := newAnnotateCommand(cli)
36 cmd.SetArgs(tc.args)
37 cmd.SetOut(io.Discard)
38 cmd.SetErr(io.Discard)
39 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
40 }
41}
42
43func TestManifestAnnotate(t *testing.T) {
44 manifestStore := store.NewStore(t.TempDir())

Callers

nothing calls this directly

Calls 4

newAnnotateCommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…