Help us shape the future of Go! Take the 2026 Go Developer Survey

azdcli

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 25 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

func StartTestCredentialServer added in v1.36.0

func StartTestCredentialServer(t *testing.T) *httptest.Server

StartTestCredentialServer serves synthetic tokens using the remote credential protocol for local CLI and playback tests. The caller must close the server.

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)

RunCommandWithStdIn runs a command with the supplied input. An empty string produces EOF.

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.

type TestCredential

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

TestCredential Used to used the auth strategy already used to create the Cli instance

func NewTestCredential

func NewTestCredential(azCli *CLI) *TestCredential

NewTestCredential Creates a new TestCredential

func (*TestCredential) GetToken

GetToken Gets the token from the CLI instance

Jump to

Keyboard shortcuts

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