acceptance

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(t *testing.T, fn func())

Cleanup registers fn as a test cleanup function. When AXM_SKIP_CLEANUP=true the function is silently omitted so test data persists for debugging.

func InitClient

func InitClient() error

InitClient creates and stores the shared AXM client from environment variables.

func IsConfigured

func IsConfigured() bool

IsConfigured returns true when the minimum required credentials are present.

func LogCleanupError

func LogCleanupError(t *testing.T, resourceType, id string, err error)

LogCleanupError logs the result of a cleanup delete. A 404 is treated as expected (already deleted); other errors are non-fatal warnings.

func LogTestStage

func LogTestStage(t *testing.T, stage, message string, args ...any)

LogTestStage logs a named stage with optional GitHub Actions ::notice annotation.

func LogTestSuccess

func LogTestSuccess(t *testing.T, message string, args ...any)

LogTestSuccess logs a successful step.

func LogTestWarning

func LogTestWarning(t *testing.T, message string, args ...any)

LogTestWarning logs a non-fatal warning.

func NewContext

func NewContext() (context.Context, context.CancelFunc)

NewContext returns a context bound to the configured request timeout.

func PollUntil

func PollUntil(t *testing.T, timeout, interval time.Duration, fn func() bool) bool

PollUntil retries fn every interval until it returns true or timeout elapses.

func RequireClient

func RequireClient(t *testing.T)

RequireClient ensures the shared client is initialised, skipping the test when credentials are absent or initialisation fails.

func RetryOnNotFound

func RetryOnNotFound(t *testing.T, maxRetries int, initialDelay time.Duration, fn func() error) error

RetryOnNotFound retries fn when it returns a 404 error, with exponential back-off. Returns nil on success or the last error when retries are exhausted.

func SkipIfNotConfigured

func SkipIfNotConfigured(t *testing.T)

SkipIfNotConfigured skips the test when AXM credentials are not set.

Types

type TestConfig

type TestConfig struct {
	// Auth — mirrors the variables read by axm.NewClientFromEnv / axm/client.NewTransportFromEnv.
	// Supply exactly one of PrivateKeyPEM or PrivateKeyPath.
	KeyID          string
	IssuerID       string
	PrivateKeyPEM  string // APPLE_PRIVATE_KEY_PEM  — inline PEM content
	PrivateKeyPath string // APPLE_PRIVATE_KEY_PATH — path to .p8 file

	// Test behaviour
	RequestTimeout  time.Duration
	SkipCleanup     bool
	SkipDestructive bool // AXM_SKIP_DESTRUCTIVE — skip assign/unassign lifecycle tests
	Verbose         bool
}

TestConfig holds configuration for acceptance tests, driven by environment variables.

var (
	// Config is the global acceptance test configuration, initialised from env.
	Config *TestConfig
	// Client is the shared AXM SDK client for acceptance tests.
	Client *axm.Client
)

Jump to

Keyboard shortcuts

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