TestNonexistingHelp ensures correct behaviour when invoking a nonexistent plugin with `--help`.
(t *testing.T)
| 39 | // TestNonexistingHelp ensures correct behaviour when invoking a |
| 40 | // nonexistent plugin with `--help`. |
| 41 | func 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 |
| 66 | func TestRunBad(t *testing.T) { |