clitest

package
v0.23.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTemplateVersionSource added in v0.4.0

func CreateTemplateVersionSource(t *testing.T, responses *echo.Responses) string

CreateTemplateVersionSource writes the echo provisioner responses into a new temporary testing directory.

func New

func New(t *testing.T, args ...string) (*clibase.Invocation, config.Root)

New creates a CLI instance with a configuration pointed to a temporary testing directory.

func NewWithCommand added in v0.21.0

func NewWithCommand(
	t *testing.T, cmd *clibase.Cmd, args ...string,
) (*clibase.Invocation, config.Root)

func Run added in v0.21.0

func Run(t *testing.T, inv *clibase.Invocation)

Run runs the command and asserts that there is no error.

func SetupConfig

func SetupConfig(t *testing.T, client *codersdk.Client, root config.Root)

SetupConfig applies the URL and SessionToken of the client to the config.

func Start added in v0.19.0

func Start(t *testing.T, inv *clibase.Invocation)

Start runs the command in a goroutine and cleans it up when the test completed.

Types

type ErrorWaiter added in v0.21.0

type ErrorWaiter struct {
	// contains filtered or unexported fields
}

func StartWithWaiter added in v0.21.0

func StartWithWaiter(t *testing.T, inv *clibase.Invocation) *ErrorWaiter

StartWithWaiter runs the command in a goroutine but returns the error instead of asserting it. This is useful for testing error cases.

func (*ErrorWaiter) Cancel added in v0.23.5

func (w *ErrorWaiter) Cancel()

func (*ErrorWaiter) RequireAs added in v0.21.0

func (w *ErrorWaiter) RequireAs(want interface{})

func (*ErrorWaiter) RequireContains added in v0.21.0

func (w *ErrorWaiter) RequireContains(s string)

func (*ErrorWaiter) RequireError added in v0.21.0

func (w *ErrorWaiter) RequireError()

func (*ErrorWaiter) RequireIs added in v0.21.0

func (w *ErrorWaiter) RequireIs(want error)

func (*ErrorWaiter) RequireSuccess added in v0.21.0

func (w *ErrorWaiter) RequireSuccess()

func (*ErrorWaiter) Wait added in v0.21.0

func (w *ErrorWaiter) Wait() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL