MCPcopy Index your code
hub / github.com/docker/cli / TestUpgradePromptTermination

Function TestUpgradePromptTermination

cli/command/plugin/upgrade_test.go:15–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestUpgradePromptTermination(t *testing.T) {
16 ctx, cancel := context.WithCancel(context.Background())
17 t.Cleanup(cancel)
18
19 cli := test.NewFakeCli(&fakeClient{
20 pluginUpgradeFunc: func(name string, options client.PluginUpgradeOptions) (client.PluginUpgradeResult, error) {
21 return nil, errors.New("should not be called")
22 },
23 pluginInspectFunc: func(name string) (client.PluginInspectResult, error) {
24 return client.PluginInspectResult{
25 Plugin: plugin.Plugin{
26 ID: "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078",
27 Name: "foo/bar",
28 Enabled: false,
29 PluginReference: "localhost:5000/foo/bar:v0.1.0",
30 },
31 }, nil
32 },
33 })
34 cmd := newUpgradeCommand(cli)
35 // need to set a remote address that does not match the plugin
36 // reference sent by the `pluginInspectFunc`
37 cmd.SetArgs([]string{"foo/bar", "localhost:5000/foo/bar:v1.0.0"})
38 cmd.SetOut(io.Discard)
39 cmd.SetErr(io.Discard)
40 test.TerminatePrompt(ctx, t, cmd, cli)
41 golden.Assert(t, cli.OutBuffer().String(), "plugin-upgrade-terminate.golden")
42}

Callers

nothing calls this directly

Calls 6

OutBufferMethod · 0.95
newUpgradeCommandFunction · 0.85
SetArgsMethod · 0.80
StringMethod · 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…