nolint:tparallel,paralleltest
(t *testing.T)
| 29 | |
| 30 | //nolint:tparallel,paralleltest |
| 31 | func TestCommandHelp(t *testing.T) { |
| 32 | // Test with AGPL commands |
| 33 | getCmds := func(t *testing.T) *serpent.Command { |
| 34 | // Must return a fresh instance of cmds each time. |
| 35 | |
| 36 | t.Helper() |
| 37 | var root cli.RootCmd |
| 38 | rootCmd, err := root.Command(root.AGPL()) |
| 39 | require.NoError(t, err) |
| 40 | |
| 41 | return rootCmd |
| 42 | } |
| 43 | clitest.TestCommandHelp(t, getCmds, append(clitest.DefaultCases(), |
| 44 | clitest.CommandHelpCase{ |
| 45 | Name: "coder agent --help", |
| 46 | Cmd: []string{"agent", "--help"}, |
| 47 | }, |
| 48 | clitest.CommandHelpCase{ |
| 49 | Name: "coder list --output json", |
| 50 | Cmd: []string{"list", "--output", "json"}, |
| 51 | }, |
| 52 | clitest.CommandHelpCase{ |
| 53 | Name: "coder users list --output json", |
| 54 | Cmd: []string{"users", "list", "--output", "json"}, |
| 55 | }, |
| 56 | clitest.CommandHelpCase{ |
| 57 | Name: "coder users list", |
| 58 | Cmd: []string{"users", "list"}, |
| 59 | }, |
| 60 | clitest.CommandHelpCase{ |
| 61 | Name: "coder provisioner list", |
| 62 | Cmd: []string{"provisioner", "list"}, |
| 63 | }, |
| 64 | clitest.CommandHelpCase{ |
| 65 | Name: "coder provisioner list --output json", |
| 66 | Cmd: []string{"provisioner", "list", "--output", "json"}, |
| 67 | }, |
| 68 | clitest.CommandHelpCase{ |
| 69 | Name: "coder provisioner jobs list", |
| 70 | Cmd: []string{"provisioner", "jobs", "list"}, |
| 71 | }, |
| 72 | clitest.CommandHelpCase{ |
| 73 | Name: "coder provisioner jobs list --output json", |
| 74 | Cmd: []string{"provisioner", "jobs", "list", "--output", "json"}, |
| 75 | }, |
| 76 | // TODO (SasSwart): Remove these once the sync commands are promoted out of experimental. |
| 77 | clitest.CommandHelpCase{ |
| 78 | Name: "coder exp sync --help", |
| 79 | Cmd: []string{"exp", "sync", "--help"}, |
| 80 | }, |
| 81 | clitest.CommandHelpCase{ |
| 82 | Name: "coder exp sync ping --help", |
| 83 | Cmd: []string{"exp", "sync", "ping", "--help"}, |
| 84 | }, |
| 85 | clitest.CommandHelpCase{ |
| 86 | Name: "coder exp sync start --help", |
| 87 | Cmd: []string{"exp", "sync", "start", "--help"}, |
| 88 | }, |
nothing calls this directly
no test coverage detected