Uptest supports two execution modes for running end-to-end tests: CLI Fork Mode and Library Mode. This document explains both modes, their differences, and when to use each one.
Starting with the introduction of dual execution modes, uptest provides flexibility in how it interacts with Chainsaw and Crossplane CLI tools:
- CLI Fork Mode (default): Uses external CLI binaries via shell commands
- Library Mode (opt-in): Uses Go libraries directly for better integration
CLI Fork Mode is the traditional execution method where uptest spawns external processes to run Chainsaw and Crossplane CLI commands. This mode maintains backward compatibility with existing deployments and tooling.
- Executes
"${CHAINSAW}" testcommands via shell - Runs
"${CROSSPLANE_CLI}" beta tracefor resource monitoring - Requires external binaries to be available in the environment
- Uses environment variables
CHAINSAWandCROSSPLANE_CLIto locate binaries
- Chainsaw CLI binary must be available in PATH or via
CHAINSAWenvironment variable - Crossplane CLI binary must be available in PATH or via
CROSSPLANE_CLIenvironment variable
- Backward compatibility: Works with existing CI/CD pipelines and scripts
- Tool flexibility: Can use different versions of CLI tools without recompiling uptest
- Environment control: Respects system PATH and environment configuration
- Isolation: Each test run uses fresh CLI processes
CLI Fork Mode is the default behavior. No additional flags are required:
# Default CLI fork mode
uptest e2e examples/s3/bucket.yaml
# With multiple manifests
uptest e2e examples/s3/bucket.yaml,examples/ec2/instance.yaml
# With environment variables set
export CHAINSAW=/usr/local/bin/chainsaw
export CROSSPLANE_CLI=/usr/local/bin/crossplane
uptest e2e examples/s3/bucket.yamlLibrary Mode integrates Chainsaw and Crossplane functionality directly as Go libraries, providing a more seamless and potentially performant execution experience.
- Imports
github.com/kyverno/chainsaw/pkg/runnerfor test execution - Uses
github.com/crossplane/crossplane/cmd/crank/beta/tracefor resource monitoring - No external binary dependencies required
- Direct Go API calls instead of shell command execution
- Go modules automatically handle dependencies
- No external CLI binaries required
- Better integration: Direct API usage provides better error handling and control
- No external dependencies: Self-contained execution without requiring CLI binaries
- Performance: Potentially faster execution due to elimination of process spawning overhead
- Consistency: Ensures consistent versions of Chainsaw and Crossplane libraries
Enable Library Mode using the --use-library-mode flag:
# Library mode execution
uptest e2e --use-library-mode examples/s3/bucket.yaml
# Library mode with additional flags
uptest e2e --use-library-mode --skip-delete examples/s3/bucket.yaml
# Library mode with timeout
uptest e2e --use-library-mode --default-timeout=1800s examples/s3/bucket.yaml