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

apcli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package apcli drives the ap CLI binary. It owns the session every CLI step package runs the binary through, and the steps for the CLI's gateway commands, which run against the topology's platform gateway.

Each scenario owns an isolated CLI HOME and scratch workspace, created on first use and removed by the cleanup registry, so the gateways a scenario adds to the CLI configuration are private to it. Resources the CLI deploys to the platform gateway are registered for cleanup as soon as the CLI reports them applied.

Index

Constants

View Source
const (
	// EnvBinary overrides the location of the ap binary under test.
	EnvBinary = "AP_CLI_BINARY"
)

Variables

This section is empty.

Functions

func Register

func Register(sc *godog.ScenarioContext, topo *runtime.Topology, featureRoot string)

Register binds the ap CLI steps.

func ResolveBinary

func ResolveBinary() (string, error)

ResolveBinary locates the ap binary: AP_CLI_BINARY when set, otherwise the build output of 'make -C cli/src build-skip-tests' in this checkout.

Types

type Result

type Result struct {
	Stdout string
	Stderr string
	Exit   int
}

Result captures one ap invocation.

func (Result) Combined

func (r Result) Combined() string

Combined returns stdout followed by stderr.

type Session

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

Session runs the ap binary with an isolated HOME, so its configuration never touches the developer's real ~/.wso2ap, and from a scratch workspace that relative paths resolve against.

func NewSession

func NewSession(ctx context.Context, bin string) (*Session, error)

NewSession creates the isolated HOME and workspace and registers them for cleanup, so a failing scenario still removes them.

func (*Session) Home

func (s *Session) Home() string

Home returns the HOME directory ap keeps its configuration under.

func (*Session) Run

func (s *Session) Run(ctx context.Context, extraEnv []string, args ...string) (Result, error)

Run executes ap with extraEnv appended to the process environment. A non-zero exit is returned in the result; an error means the process could not run at all.

func (*Session) Workspace

func (s *Session) Workspace() string

Workspace returns the directory ap runs from.

type Steps

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

Steps holds one scenario's CLI session. Register builds a fresh instance for every scenario, so nothing here is shared between scenarios or runners.

Jump to

Keyboard shortcuts

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