Documentation
¶
Index ¶
- func TestRun(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunAdminAddressPath(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunCtrlCs(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunInvalidConfig(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunLegacyHomeDir(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunLogWarn(ctx context.Context, t *testing.T, factory FuncEFactory)
- func TestRunRunDir(ctx context.Context, t *testing.T, factory FuncEFactory, stateDir string)
- func TestRunStaticFile(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 TestRunAdminAddressPath ¶ added in v1.5.0
func TestRunAdminAddressPath(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunAdminAddressPath tests we do not assume the admin address path is in the run directory.
func TestRunCtrlCs ¶ added in v1.5.0
func TestRunCtrlCs(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunCtrlCs tests the "Ctrl+C twice" behavior where multiple interrupts are handled gracefully without causing issues.
func TestRunInvalidConfig ¶ added in v1.5.0
func TestRunInvalidConfig(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunInvalidConfig tests "func-e run" with an invalid configuration.
func TestRunLegacyHomeDir ¶ added in v1.5.0
func TestRunLegacyHomeDir(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunLegacyHomeDir 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 TestRunLogWarn ¶ added in v1.5.0
func TestRunLogWarn(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunLogWarn tests we do not depend on any log messages written to info level.
func TestRunRunDir ¶ added in v1.5.0
TestRunRunDir 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 TestRunStaticFile ¶ added in v1.5.0
func TestRunStaticFile(ctx context.Context, t *testing.T, factory FuncEFactory)
TestRunStaticFile 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 FuncEFactory interface {
New(ctx context.Context, t *testing.T, stdout, stderr io.Writer) (FuncE, error)
}
FuncEFactory creates FuncE instances under test.
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
}
RunTestOptions configures executeRunTest invocations.