test

package
v0.144.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCompletedTurnResult

func AssertCompletedTurnResult(t testing.TB, label string, result *codex.TurnResult)

AssertCompletedTurnResult checks the stable public effects of a completed turn.

func AssertJSONContains

func AssertJSONContains(t testing.TB, label string, value any, want string)

AssertJSONContains marshals value and checks that it contains want.

func AssertNoSecretLeak

func AssertNoSecretLeak(t testing.TB, stderr *LockedBuffer, secrets ...string)

AssertNoSecretLeak fails if captured output contains any provided secret.

func CollectTurnStream

func CollectTurnStream(ctx context.Context, stream *codex.TurnStream) (*codex.TurnResult, error)

CollectTurnStream consumes a turn stream and returns a public TurnResult.

func IsExpectedTurnControlStateError

func IsExpectedTurnControlStateError(err error) bool

IsExpectedTurnControlStateError reports whether a control call raced turn completion.

func IsExpectedUnmaterializedArchiveError

func IsExpectedUnmaterializedArchiveError(err error) bool

IsExpectedUnmaterializedArchiveError identifies expected empty archive state errors.

func IsExpectedUnmaterializedThreadError

func IsExpectedUnmaterializedThreadError(err error) bool

IsExpectedUnmaterializedThreadError identifies expected empty-thread state errors.

func LiveTurnOptions

func LiveTurnOptions(t testing.TB) *codex.TurnOptions

LiveTurnOptions returns conservative defaults for credential-backed live turns.

func RequireLoginParams

func RequireLoginParams(t testing.TB) (any, string)

RequireLoginParams reads CODEX_E2E_LOGIN_PARAMS_JSON or skips the test.

func StartThread

func StartThread(t testing.TB, client *codex.Codex, ctx context.Context, stderr *LockedBuffer, cwd string) *codex.Thread

StartThread starts a real Codex thread and fails the test if no id is returned.

func WaitForKnownTurnID

func WaitForKnownTurnID(ctx context.Context, handle *codex.TurnHandle) error

WaitForKnownTurnID advances a handle until the SDK has observed a turn id.

Types

type LockedBuffer

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

LockedBuffer is a concurrency-safe buffer for app-server stderr capture.

func NewRealClient

func NewRealClient(t testing.TB, opts RealClientOptions) (*codex.Codex, context.Context, *LockedBuffer)

NewRealClient starts a real codex app-server with an isolated CODEX_HOME.

func (*LockedBuffer) String

func (b *LockedBuffer) String() string

func (*LockedBuffer) Write

func (b *LockedBuffer) Write(p []byte) (int, error)

type RealClientOptions

type RealClientOptions struct {
	Timeout          time.Duration
	DisableAutoClose bool
	Secrets          []string
}

RealClientOptions configures a real codex app-server test client.

Jump to

Keyboard shortcuts

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