Documentation
¶
Index ¶
- func Cleanup(t *testing.T, fn func())
- func InitClient() error
- func IsConfigured() bool
- func LogCleanupError(t *testing.T, resourceType, id string, err error)
- func LogTestStage(t *testing.T, stage, message string, args ...any)
- func LogTestSuccess(t *testing.T, message string, args ...any)
- func LogTestWarning(t *testing.T, message string, args ...any)
- func NewContext() (context.Context, context.CancelFunc)
- func PollUntil(t *testing.T, timeout, interval time.Duration, fn func() bool) bool
- func RequireClient(t *testing.T)
- func RetryOnNotFound(t *testing.T, maxRetries int, initialDelay time.Duration, fn func() error) error
- func SkipIfNotConfigured(t *testing.T)
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
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 ¶
LogCleanupError logs the result of a cleanup delete. A 404 is treated as expected (already deleted); other errors are non-fatal warnings.
func LogTestStage ¶
LogTestStage logs a named stage with optional GitHub Actions ::notice annotation.
func LogTestSuccess ¶
LogTestSuccess logs a successful step.
func LogTestWarning ¶
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 RequireClient ¶
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 ¶
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 )