step

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAllDetails

func ValidateAllDetails(code string, details []DeploymentErrorDetail) func(*testing.T, *radcli.CLIError)

ValidateAllDetails reports success if all of the provided error details are found in the error response.

func ValidateAnyDetails

func ValidateAnyDetails(code string, details []DeploymentErrorDetail) func(*testing.T, *radcli.CLIError)

ValidateAnyDetails reports success if any of the provided error details are found in the error response.

func ValidateSingleDetail

func ValidateSingleDetail(code string, detail DeploymentErrorDetail) func(*testing.T, *radcli.CLIError)

ValidateSingleDetail reports success if the error code matches the expected code and the detail item is found in the error response..

Types

type DeployErrorExecutor

type DeployErrorExecutor struct {
	Description string
	Template    string
	Parameters  []string

	// ValidateError is a function that can be used to validate the error when it occurs.
	ValidateError func(*testing.T, *radcli.CLIError)

	// Application sets the `--application` command-line parameter. This is needed in cases where
	// the application is not defined in bicep.
	Application string

	// Environment sets the `--environment` command-line parameter. This is needed in cases where
	// the environment is not defined in bicep.
	Environment string
}

func NewDeployErrorExecutor

func NewDeployErrorExecutor(template string, validateError func(*testing.T, *radcli.CLIError), parameters ...string) *DeployErrorExecutor

NewDeployErrorExecutor creates a new DeployErrorExecutor instance with the given template, error code and parameters.

func (*DeployErrorExecutor) Execute

func (d *DeployErrorExecutor) Execute(ctx context.Context, t *testing.T, options test.TestOptions)

Execute deploys an application from a template file and checks that the deployment fails with the expected error code.

func (*DeployErrorExecutor) GetDescription

func (d *DeployErrorExecutor) GetDescription() string

GetDescription returns the Description field of the DeployErrorExecutor instance.

func (*DeployErrorExecutor) WithApplication

func (d *DeployErrorExecutor) WithApplication(application string) *DeployErrorExecutor

WithApplication sets the application name for the DeployErrorExecutor instance and returns the instance.

func (*DeployErrorExecutor) WithEnvironment

func (d *DeployErrorExecutor) WithEnvironment(environment string) *DeployErrorExecutor

WithEnvironment sets the environment name for the DeployExecutor instance and returns the same instance.

type DeployExecutor

type DeployExecutor struct {
	Description string
	Template    string
	Parameters  []string

	// Application sets the `--application` command-line parameter. This is needed in cases where
	// the application is not defined in bicep.
	Application string

	// Environment sets the `--environment` command-line parameter. This is needed in cases where
	// the environment is not defined in bicep.
	Environment string
}

func NewDeployExecutor

func NewDeployExecutor(template string, parameters ...string) *DeployExecutor

NewDeployExecutor creates a new DeployExecutor instance with the given template and parameters.

func (*DeployExecutor) Execute

func (d *DeployExecutor) Execute(ctx context.Context, t *testing.T, options test.TestOptions)

Execute deploys an application from a template file using the provided parameters and logs the deployment process.

func (*DeployExecutor) GetDescription

func (d *DeployExecutor) GetDescription() string

GetDescription returns the Description field of the DeployExecutor instance.

func (*DeployExecutor) WithApplication

func (d *DeployExecutor) WithApplication(application string) *DeployExecutor

WithApplication sets the application name for the DeployExecutor instance and returns the same instance.

func (*DeployExecutor) WithEnvironment

func (d *DeployExecutor) WithEnvironment(environment string) *DeployExecutor

WithEnvironment sets the environment name for the DeployExecutor instance and returns the same instance.

type DeploymentErrorDetail

type DeploymentErrorDetail struct {
	// The error code to match.
	Code string

	// The message to match. If provided, this will be matched against a substring of the error.
	MessageContains string

	// The details to match. If provided, this will be matched against the details of the error.
	Details []DeploymentErrorDetail
}

DeploymentErrorDetail describes an error that can be matched against the output.

func (DeploymentErrorDetail) Matches

func (detail DeploymentErrorDetail) Matches(candidate v1.ErrorDetails) bool

type Executor

type Executor interface {
	GetDescription() string
	Execute(ctx context.Context, t *testing.T, options test.TestOptions)
}

Jump to

Keyboard shortcuts

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