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

Function TestSignCommandChangeListIsCleanedOnError

cmd/docker-trust/trust/sign_test.go:253–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestSignCommandChangeListIsCleanedOnError(t *testing.T) {
254 tmpDir := t.TempDir()
255
256 config.SetDir(tmpDir)
257 cli := test.NewFakeCli(&fakeClient{})
258 cli.SetNotaryClient(notaryfake.GetLoadedNotaryRepository)
259 cmd := newSignCommand(cli)
260 cmd.SetArgs([]string{"ubuntu:latest"})
261 cmd.SetOut(io.Discard)
262 cmd.SetErr(io.Discard)
263
264 err := cmd.Execute()
265 assert.Assert(t, err != nil)
266
267 notaryRepo, err := client.NewFileCachedRepository(tmpDir, "docker.io/library/ubuntu", "https://localhost", nil, testPassRetriever, trustpinning.TrustPinConfig{})
268 assert.NilError(t, err)
269 cl, err := notaryRepo.GetChangelist()
270 assert.NilError(t, err)
271 assert.Check(t, is.Equal(len(cl.List()), 0))
272}
273
274func TestSignCommandLocalFlag(t *testing.T) {
275 cli := test.NewFakeCli(&fakeClient{})

Callers

nothing calls this directly

Calls 7

SetNotaryClientMethod · 0.95
newSignCommandFunction · 0.85
SetArgsMethod · 0.80
GetChangelistMethod · 0.80
ListMethod · 0.65
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…