streamling-e2e
End-to-end test framework for Streamling pipelines.
Overview
This crate provides a lightweight e2e testing framework that runs Streamling pipelines against real services (PostgreSQL, Kafka, ClickHouse) in a local k3s cluster. This framework:
- Runs the Streamling binary as an external process (no internal crate dependencies)
- Uses a persistent k3s cluster (no container startup per test)
- Isolates tests via unique databases/topics per test run
- Builds once, runs many - the binary is built once before all tests
Prerequisites
- k3d - Lightweight Kubernetes in Docker
- kubectl - Kubernetes CLI
- cargo-nextest - Fast test runner (
cargo install cargo-nextest)
Quick Start
# 1. Set up the k3s cluster with all services
# 2. Run e2e tests
# 3. (Optional) Tear down when done
Commands
Environment Management
Running Tests
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ k3s Cluster │
│ ┌──────────┐ ┌──────────┐ ┌────────────┐ ┌──────────────┐ │
│ │PostgreSQL│ │ Redpanda │ │ ClickHouse │ │ Prometheus │ │
│ │ :30432 │ │ :30092 │ │ :30123 │ │ :30090 │ │
│ └──────────┘ │ :30081 │ └────────────┘ └──────────────┘ │
│ │ (schema) │ │
│ └──────────┘ │
└─────────────────────────────────────────────────────────────────┘
▲
│ NodePort
│
┌─────────────────────────────┼───────────────────────────────────┐
│ E2E Test │ │
│ ┌──────────────────────────┴───────────────────────────────┐ │
│ │ TestContext │ │
│ │ • Creates isolated DB/topic per test (UUID-based) │ │
│ │ • Produces test data to Kafka │ │
│ │ • Runs streamling binary with pipeline YAML │ │
│ │ • Verifies results in PostgreSQL/ClickHouse │ │
│ │ • Cleans up resources on drop │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ target/release/streamling │ │
│ │ (executed as subprocess with pipeline YAML + env vars) │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Writing Tests
use ;
use Serialize;
const SCHEMA: &str = r#"{
"type": "record",
"name": "MyRecord",
"fields": [
{"name": "id", "type": "long"},
{"name": "value", "type": "string"}
]
}"#;
async
Environment Variables
The test framework reads these from the k3s setup:
| Variable | Description | Default |
|---|---|---|
E2E_POSTGRES_URL |
PostgreSQL connection string | postgres://postgres:postgres@localhost:30432/postgres?sslmode=disable |
E2E_KAFKA_BROKER |
Kafka broker address | localhost:30092 |
E2E_SCHEMA_REGISTRY_URL |
Schema Registry URL | http://localhost:30081 |
E2E_CLICKHOUSE_URL |
ClickHouse HTTP URL | http://localhost:30123 |
E2E_PROMETHEUS_URL |
Prometheus URL | http://localhost:30090 |
E2E_STREAMLING_BIN |
Path to streamling binary | Set by just e2e-test |
Debugging
# Run a single test with full output
# Inspect resources for a failed test
# Check k3s services
# Watch logs from a service
Design Principles
- No internal dependencies - Tests execute the streamling binary, not internal crate code
- Resource isolation - Each test gets unique database/topic names via UUIDs
- Automatic cleanup - Resources are cleaned up when
TestContextis dropped - Fast iteration - Build binary once, run many tests against persistent services
- Real services - Tests run against actual PostgreSQL, Kafka, ClickHouse (not mocks)