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

Function TestNonexistingHelp

e2e/cli-plugins/run_test.go:41–63  ·  view source on GitHub ↗

TestNonexistingHelp ensures correct behaviour when invoking a nonexistent plugin with `--help`.

(t *testing.T)

Source from the content-addressed store, hash-verified

39// TestNonexistingHelp ensures correct behaviour when invoking a
40// nonexistent plugin with `--help`.
41func TestNonexistingHelp(t *testing.T) {
42 run, _, cleanup := prepare(t)
43 defer cleanup()
44
45 res := icmd.RunCmd(run("nonexistent", "--help"))
46 res.Assert(t, icmd.Expected{
47 ExitCode: 0,
48 // This should actually be the whole docker help
49 // output, so spot check instead having of a golden
50 // with everything in, which will change too frequently.
51 Out: "Usage: docker [OPTIONS] COMMAND\n\nA self-sufficient runtime for containers",
52 Err: icmd.None,
53 })
54 // Short -h should be the same, modulo the deprecation message
55 exp := shortHFlagDeprecated + res.Stdout()
56 res = icmd.RunCmd(run("nonexistent", "-h"))
57 res.Assert(t, icmd.Expected{
58 ExitCode: 0,
59 // This should be identical to the --help case above
60 Out: exp,
61 Err: icmd.None,
62 })
63}
64
65// TestRunBad ensures correct behaviour when running an existent but invalid plugin
66func TestRunBad(t *testing.T) {

Callers

nothing calls this directly

Calls 2

prepareFunction · 0.85
runFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…