azdcli

package
v0.0.0-...-6117bb9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartbeatInterval = 10 * time.Second
)

Variables

This section is empty.

Functions

func GetOutputFlagValue

func GetOutputFlagValue(args []string) string

GetOutputFlagValue returns the value specified by --output. If --output is not specified, it returns an empty string

func GetSourcePath

func GetSourcePath() string

Types

type CLI

type CLI struct {
	T                *testing.T
	WorkingDirectory string
	Env              []string
	// Path to the azd binary
	AzdPath string
}

The azd CLI.

Consumers should use the NewCLI constructor to initialize this struct.

func NewCLI

func NewCLI(t *testing.T, opts ...Options) *CLI

Constructs the CLI. On a local developer machine, this also ensures that the azd binary is up-to-date before running.

By default, the path to the default source location is used, see GetSourcePath. Environment variable CLI_TEST_AZD_PATH can be used to set the path to the azd binary. This can be done in CI to run the tests against a specific azd binary.

When CI is detected, no automatic build is performed. To disable automatic build behavior, CLI_TEST_SKIP_BUILD can be set to a truthy value.

func (*CLI) RunCommand

func (cli *CLI) RunCommand(ctx context.Context, args ...string) (*CliResult, error)

func (*CLI) RunCommandWithStdIn

func (cli *CLI) RunCommandWithStdIn(ctx context.Context, stdin string, args ...string) (*CliResult, error)

type CliResult

type CliResult struct {
	ExitCode int
	Stdout   string
	Stderr   string
}

The result of calling an azd CLI command

type Options

type Options interface {
	Apply(o *option)
}

func WithSession

func WithSession(session *recording.Session) Options

WithSession sets a recording session to use for the test.

Jump to

Keyboard shortcuts

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