Documentation
¶
Index ¶
Constants ¶
const ( // DefaultHealthPath is the built-in health endpoint exposed by the Celerity // runtime. It is always registered unless the developer sets // CELERITY_USE_CUSTOM_HEALTH_CHECK=true in the runtime environment. DefaultHealthPath = "/runtime/health/check" )
Variables ¶
var ValidSuites = []TestSuite{SuiteUnit, SuiteIntegration, SuiteAPI}
ValidSuites are the accepted values for the --suite flag. Multiple suites can be comma-separated: --suite unit,integration
Functions ¶
func WaitForHealth ¶
func WaitForHealth( ctx context.Context, baseURL string, healthPath string, timeout time.Duration, output *devrun.Output, ) error
WaitForHealth polls the given base URL + health path until the server responds with a 2xx status code or the timeout expires.
healthPath overrides the endpoint to poll. When empty, DefaultHealthPath is used. Developers who set CELERITY_USE_CUSTOM_HEALTH_CHECK=true can pass their custom path via --health-path.
Types ¶
type InfraLevel ¶
type InfraLevel int
InfraLevel describes the infrastructure needed for a set of test suites.
const ( // InfraLevelNone means no Docker infrastructure is needed (unit tests only). InfraLevelNone InfraLevel = iota // InfraLevelCompose starts compose dependencies (databases, caches, etc.) // but not the app container. Used for integration tests. InfraLevelCompose // InfraLevelFull starts compose dependencies AND the app container. // Used for API tests. InfraLevelFull )
func InfraLevelForSuites ¶
func InfraLevelForSuites(suites []TestSuite) InfraLevel
InfraLevelForSuites determines the highest infrastructure level needed for the given set of test suites.
type NodeRunner ¶
type NodeRunner struct {
// contains filtered or unexported fields
}
NodeRunner executes tests for Node.js projects.
func NewNodeRunner ¶
func NewNodeRunner(logger *zap.Logger) *NodeRunner
NewNodeRunner creates a new Node.js test runner.
type PythonRunner ¶
type PythonRunner struct {
// contains filtered or unexported fields
}
PythonRunner executes tests for Python projects.
func NewPythonRunner ¶
func NewPythonRunner(logger *zap.Logger) *PythonRunner
NewPythonRunner creates a new Python test runner.
type RunConfig ¶
type RunConfig struct {
// AppDir is the absolute path to the application root directory.
AppDir string
// Runtime is the detected runtime string (e.g. "nodejs22.x", "python3.12.x").
Runtime string
// Suites lists which test suites to execute.
Suites []TestSuite
// Coverage enables coverage reporting when true.
Coverage bool
// TestCommand is a user-provided override for the test command.
// When non-empty, auto-detection is skipped and this command is
// executed directly via the shell.
TestCommand string
// HostPort is the host port the app container is listening on.
// Used to construct CELERITY_TEST_BASE_URL for API tests.
HostPort string
// Verbose enables debug-level output from the test runner.
Verbose bool
// Env holds additional environment variables to pass to the test process.
// Typically contains infrastructure endpoints (databases, caches, etc.)
// rewritten for host access.
Env map[string]string
}
RunConfig holds configuration for a test run.
type RunResult ¶
type RunResult struct {
// ExitCode is the exit code from the test runner process.
// 0 means all tests passed.
ExitCode int
// CoveragePath is the path to the coverage report, if generated.
CoveragePath string
}
RunResult holds the outcome of a test run.
type RunnerFactory ¶
type RunnerFactory func(logger *zap.Logger) TestRunner
RunnerFactory creates a TestRunner for a given runtime.
type TestRunner ¶
type TestRunner interface {
// Run executes the configured test suites and returns the result.
// The runner streams output to stdout/stderr in real time.
Run(ctx context.Context, config RunConfig) (*RunResult, error)
}
TestRunner executes tests for a specific runtime.
func RunnerForRuntime ¶
func RunnerForRuntime(runtime string, logger *zap.Logger) (TestRunner, error)
RunnerForRuntime returns a TestRunner for the given runtime string, matching by prefix (e.g. "nodejs24.x" matches "nodejs").
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package detect provides pure detection and command-building logic for test runners, extracted so it can be unit-tested without executing shell commands.
|
Package detect provides pure detection and command-building logic for test runners, extracted so it can be unit-tested without executing shell commands. |