Documentation
¶
Index ¶
- func TestRun(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_AdminAddressPath(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_CtrlCs(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_InvalidConfig(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_LegacyHomeDir(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_LogWarn(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRun_RunDir(ctx context.Context, t *testing.T, factory FuncEFactory, stateDir string)
- func TestRun_StaticFile(ctx context.Context, t *testing.T, factory FuncEFactory)
- type FuncE
- type FuncEFactory
- type RunTestFunc
- type RunTestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestRun ¶
func TestRun(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun tests the basic "func-e run" command with a minimal configuration.
func TestRun_AdminAddressPath ¶ added in v1.3.0
func TestRun_AdminAddressPath(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_AdminAddressPath tests we do not assume the admin address path is in the run directory.
func TestRun_CtrlCs ¶
func TestRun_CtrlCs(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_CtrlCs tests the "Ctrl+C twice" behavior where multiple interrupts are handled gracefully without causing issues.
func TestRun_InvalidConfig ¶
func TestRun_InvalidConfig(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_InvalidConfig tests "func-e run" with an invalid configuration.
func TestRun_LegacyHomeDir ¶ added in v1.3.0
func TestRun_LegacyHomeDir(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_LegacyHomeDir tests "func-e run" with FUNC_E_HOME (legacy mode) to ensure: 1. Files are created in legacy directory structure (versions/, runs/, version) 2. RunID is in epoch format (not ISO timestamp) Note: Deprecation warning is tested separately in CLI tests (internal/cmd/app_test.go)
func TestRun_LogWarn ¶ added in v1.3.0
func TestRun_LogWarn(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_LogWarn tests we do not depend on any log messages written to info level.
func TestRun_RunDir ¶ added in v1.3.0
TestRun_RunDir tests that runtime-generated files (logs, config_dump.json) are properly created in the state directory. This test uses api.StateHome() library option to override where state files are written, without affecting the data directory (envoy versions). The factory must be configured with the provided stateDir, and the test will verify files are created in the expected location (stateDir/envoy-runs/{runID}/).
func TestRun_StaticFile ¶
func TestRun_StaticFile(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRun_StaticFile tests "func-e run" runs envoy in the right directory, and can read files in it.
Types ¶
type FuncE ¶
type FuncE interface {
// Run starts func-e with the given arguments and block until completion
// The implementation should stop func-e if the context is canceled.
// The returned error might be a process exit or context cancellation.
Run(ctx context.Context, args []string) error
// EnvoyPid is non-zero when the process launched.
EnvoyPid() int
// Interrupt signals the running func-e process to terminate gracefully
Interrupt(context.Context) error
// OnStart is called to get the Envoy admin client and run directory.
// This method polls until Envoy's admin API is ready before returning.
OnStart(ctx context.Context) (internalapi.AdminClient, error)
}
FuncE abstracts func-e, so that the same tests can run for library calls and a compiled func-e binary.
type FuncEFactory ¶
type RunTestFunc ¶
type RunTestFunc func(ctx context.Context, interruptFuncE func(context.Context) error, adminClient internalapi.AdminClient)
RunTestFunc is a test function called once Envoy is started.
type RunTestOptions ¶
type RunTestOptions struct {
ExpectFail bool
TestFunc RunTestFunc
Args []string
}