|
| 1 | +package cli_test |
| 2 | + |
| 3 | +import ( |
| 4 | +"testing" |
| 5 | + |
| 6 | +"github.com/stretchr/testify/assert" |
| 7 | + |
| 8 | +boundarycli"github.com/coder/boundary/cli" |
| 9 | +"github.com/coder/coder/v2/cli/clitest" |
| 10 | +"github.com/coder/coder/v2/pty/ptytest" |
| 11 | +"github.com/coder/coder/v2/testutil" |
| 12 | +) |
| 13 | + |
| 14 | +// Actually testing the functionality of coder/boundary takes place in the |
| 15 | +// coder/boundary repo, since it's a dependency of coder. |
| 16 | +// Here we want to test basically that integrating it as a subcommand doesn't break anything. |
| 17 | +funcTestBoundarySubcommand(t*testing.T) { |
| 18 | +t.Parallel() |
| 19 | +ctx:=testutil.Context(t,testutil.WaitShort) |
| 20 | + |
| 21 | +inv,_:=clitest.New(t,"exp","boundary","--help") |
| 22 | +pty:=ptytest.New(t).Attach(inv) |
| 23 | + |
| 24 | +gofunc() { |
| 25 | +err:=inv.WithContext(ctx).Run() |
| 26 | +assert.NoError(t,err) |
| 27 | +}() |
| 28 | + |
| 29 | +// Expect the --help output to include the short description. |
| 30 | +// We're simply confirming that `coder boundary --help` ran without a runtime error as |
| 31 | +// a good chunk of serpents self validation logic happens at runtime. |
| 32 | +pty.ExpectMatch(boundarycli.BaseCommand().Short) |
| 33 | +} |