clitest
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- func CreateTemplateVersionSource(t *testing.T, responses *echo.Responses) string
- func HandlersOK(t *testing.T, cmd *serpent.Command)
- func New(t testing.TB, args ...string) (*serpent.Invocation, config.Root)
- func NewWithCommand(t testing.TB, cmd *serpent.Command, args ...string) (*serpent.Invocation, config.Root)
- func Run(t *testing.T, inv *serpent.Invocation)
- func SetupConfig(t *testing.T, client *codersdk.Client, root config.Root)
- func Start(t *testing.T, inv *serpent.Invocation)
- func StartWithAssert(t *testing.T, inv *serpent.Invocation, ...)
- func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *serpent.Command, ...)
- func TestGoldenFile(t *testing.T, fileName string, actual []byte, replacements map[string]string)
- type CommandHelpCase
- type ErrorWaiter
- type FakeSignalNotifier
Constants¶
This section is empty.
Variables¶
var UpdateGoldenFiles =flag.Bool("update",false, "update .golden files")
UpdateGoldenFiles indicates golden files should be updated.To update the golden files:make gen/golden-files
Functions¶
funcCreateTemplateVersionSource¶
CreateTemplateVersionSource writes the echo provisioner responses into anew temporary testing directory.
funcHandlersOK¶
HandlersOK asserts that all commands have a handler.Without a handler, the command has no default behavior. Even fornon-root commands (like 'groups' or 'users'), a handler is required.These handlers are likely just the 'help' handler, but this must beexplicitly set.
funcNewWithCommand¶
funcRun¶
func Run(t *testing.T, inv *serpent.Invocation)
Run runs the command and asserts that there is no error.
funcSetupConfig¶
SetupConfig applies the URL and SessionToken of the client to the config.
funcStart¶
func Start(t *testing.T, inv *serpent.Invocation)
Start runs the command in a goroutine and cleans it up when the testcompleted.
funcStartWithAssert¶added inv2.9.0
funcTestCommandHelp¶
func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *serpent.Command, cases []CommandHelpCase)
TestCommandHelp will test the help output of the given commandsusing golden files.
Types¶
typeCommandHelpCase¶
funcDefaultCases¶
func DefaultCases() []CommandHelpCase
typeErrorWaiter¶
type ErrorWaiter struct {// contains filtered or unexported fields}
funcStartWithWaiter¶
func StartWithWaiter(t *testing.T, inv *serpent.Invocation) *ErrorWaiter
StartWithWaiter runs the command in a goroutine but returns the error insteadof asserting it. This is useful for testing error cases.
func (*ErrorWaiter)Cancel¶
func (w *ErrorWaiter) Cancel()
func (*ErrorWaiter)RequireAs¶
func (w *ErrorWaiter) RequireAs(want interface{})
func (*ErrorWaiter)RequireContains¶
func (w *ErrorWaiter) RequireContains(sstring)
func (*ErrorWaiter)RequireError¶
func (w *ErrorWaiter) RequireError()
func (*ErrorWaiter)RequireIs¶
func (w *ErrorWaiter) RequireIs(wanterror)
func (*ErrorWaiter)RequireSuccess¶
func (w *ErrorWaiter) RequireSuccess()
func (*ErrorWaiter)Wait¶
func (w *ErrorWaiter) Wait()error
typeFakeSignalNotifier¶added inv2.4.0
funcNewFakeSignalNotifier¶added inv2.4.0
func NewFakeSignalNotifier(t *testing.T) *FakeSignalNotifier
func (*FakeSignalNotifier)AssertStopped¶added inv2.4.0
func (f *FakeSignalNotifier) AssertStopped()
func (*FakeSignalNotifier)Notify¶added inv2.4.0
func (f *FakeSignalNotifier) Notify()
func (*FakeSignalNotifier)NotifyContext¶added inv2.4.0
func (f *FakeSignalNotifier) NotifyContext(parentcontext.Context, signals ...os.Signal) (ctxcontext.Context, stopcontext.CancelFunc)
func (*FakeSignalNotifier)Stop¶added inv2.4.0
func (f *FakeSignalNotifier) Stop()