1.8 KiB
1.8 KiB
Integration Tests
Integration tests require a running Prefect server instance.
Running Integration Tests
1. Start a Prefect Server
prefect server start
This will start a Prefect server on http://localhost:4200.
2. Run the Integration Tests
go test -v -tags=integration ./pkg/client/
Or using make:
make test-integration
3. Custom Server URL
If your Prefect server is running on a different URL, set the PREFECT_API_URL environment variable:
export PREFECT_API_URL="http://your-server:4200/api"
go test -v -tags=integration ./pkg/client/
Test Coverage
The integration tests cover:
- Flow Lifecycle: Create, get, update, list, and delete flows
- Flow Run Lifecycle: Create, get, set state, and delete flow runs
- Deployment Lifecycle: Create, get, pause, resume, and delete deployments
- Pagination: Manual pagination and iterator-based pagination
- Variables: Create, get, update, and delete variables
- Admin Endpoints: Health check and version
- Flow Run Monitoring: Wait for flow run completion
Notes
- Integration tests use the
integrationbuild tag to separate them from unit tests - Each test creates and cleans up its own resources
- Tests use unique UUIDs in names to avoid conflicts
- Some tests may take several seconds to complete (e.g., flow run wait tests)
Troubleshooting
Connection Refused
If you see "connection refused" errors, make sure:
- Prefect server is running (
prefect server start) - The server is accessible at the configured URL
- No firewall is blocking the connection
Test Timeout
If tests timeout:
- Increase the test timeout:
go test -timeout 5m -tags=integration ./pkg/client/ - Check server logs for errors
- Ensure the server is not under heavy load