Documentation
¶
Index ¶
- Constants
- func NewS3Client(ctx context.Context, endpoint, region, accessKey, secretKey string) (*s3.Client, error)
- func SeedPostgres(ctx context.Context, db *sql.DB) error
- func UploadFileToS3(ctx context.Context, ...) error
- func WriteParquetFiles(ctx context.Context, duck *fedengine.DuckDBClient, outDir string) (string, string, error)
- type TestHarness
- func (h *TestHarness) ConnectPostgres(ctx context.Context, dsn string) error
- func (h *TestHarness) HaltPostgres(ctx context.Context) error
- func (h *TestHarness) HaltS3(ctx context.Context) error
- func (h *TestHarness) RestartPostgres(ctx context.Context) error
- func (h *TestHarness) RestartS3(ctx context.Context) error
- func (h *TestHarness) ResumePostgres(ctx context.Context) error
- func (h *TestHarness) StartDuckDB(cfg forma.DuckDBConfig) error
- func (h *TestHarness) StartPostgres(ctx context.Context) (string, error)
- func (h *TestHarness) StartS3(ctx context.Context) (string, error)
- func (h *TestHarness) StopDuckDB() error
- func (h *TestHarness) StopPostgres(ctx context.Context) error
- func (h *TestHarness) StopS3(ctx context.Context) error
Constants ¶
const ( RustFSAccessKey = "minioadmin" RustFSSecretKey = "minioadmin" )
RustFS credentials used by StartS3. They intentionally match the historical MinIO defaults so callers can switch S3 backends without touching client configuration.
Variables ¶
This section is empty.
Functions ¶
func NewS3Client ¶ added in v0.2.0
func NewS3Client(ctx context.Context, endpoint, region, accessKey, secretKey string) (*s3.Client, error)
NewS3Client creates an AWS S3 client configured for a MinIO-compatible endpoint (static credentials, path-style addressing). It is shared by the E2E harnesses so each does not duplicate client construction.
func SeedPostgres ¶
SeedPostgres creates minimal tables and inserts seed rows (row_id 1..5).
func UploadFileToS3 ¶
func UploadFileToS3(ctx context.Context, endpoint, accessKey, secretKey, bucket, objectName, filePath string) error
UploadFileToS3 is adapted for the E2E harness to support a RustFS/httpfs flow. It copies the local parquet file into ./e2e_artifacts/<bucket>/<objectName>, which can be served by a lightweight HTTP file server (e.g., a RustFS container mounted to the project). This avoids adding an S3 SDK dependency in the harness while keeping the artifacts accessible to DuckDB via httpfs or a mounted volume in CI.
func WriteParquetFiles ¶
func WriteParquetFiles(ctx context.Context, duck *fedengine.DuckDBClient, outDir string) (string, string, error)
WriteParquetFiles creates base.parquet and delta.parquet via DuckDB by loading CSV and exporting parquet. It returns local paths to generated parquet files.
Types ¶
type TestHarness ¶
type TestHarness struct {
PGContainer testcontainers.Container
PGDSN string
PGDB *sql.DB
S3Container testcontainers.Container
S3Endpoint string
Duck *fedengine.DuckDBClient
}
TestHarness holds lightweight runners for dependencies used by E2E tests.
func (*TestHarness) ConnectPostgres ¶ added in v0.1.0
func (h *TestHarness) ConnectPostgres(ctx context.Context, dsn string) error
ConnectPostgres opens a Postgres connection using an existing DSN.
func (*TestHarness) HaltPostgres ¶ added in v0.2.0
func (h *TestHarness) HaltPostgres(ctx context.Context) error
HaltPostgres stops the Postgres container in place (docker stop — the container and its data survive) and closes the harness DB handle, leaving the server really unreachable: queries through per-test pools and DuckDB's postgres attachment fail with genuine network errors, the only fault vector that exercises production connection-failure handling (#187). Resume with ResumePostgres.
func (*TestHarness) HaltS3 ¶ added in v0.2.0
func (h *TestHarness) HaltS3(ctx context.Context) error
HaltS3 stops the S3 container in place (docker stop — the container and its data survive, unlike StopS3, which terminates it). The endpoint becomes really unreachable for both the Go S3 client and DuckDB httpfs, which is the only fault vector that reaches DuckDB reads: client-level decorators cannot, because httpfs bypasses the Go S3 client entirely.
func (*TestHarness) RestartPostgres ¶ added in v0.2.0
func (h *TestHarness) RestartPostgres(ctx context.Context) error
RestartPostgres stops and restarts the Postgres container in place (docker stop/start — the writable layer and therefore all data survive, unlike StopPostgres, which terminates and destroys the container). The host-mapped port is not guaranteed stable across restarts, so the DSN is re-derived before reconnecting.
func (*TestHarness) RestartS3 ¶ added in v0.2.0
func (h *TestHarness) RestartS3(ctx context.Context) error
RestartS3 starts the S3 container again after HaltS3 (docker start — the container and its data survive a halt) and re-derives the endpoint: the host-mapped port is not guaranteed stable across restarts.
func (*TestHarness) ResumePostgres ¶ added in v0.2.0
func (h *TestHarness) ResumePostgres(ctx context.Context) error
ResumePostgres starts a previously halted Postgres container and reconnects. The host-mapped port is not guaranteed stable across restarts, so the DSN is re-derived before reconnecting.
func (*TestHarness) StartDuckDB ¶
func (h *TestHarness) StartDuckDB(cfg forma.DuckDBConfig) error
StartDuckDB creates a DuckDB client configured to optionally use S3/httpfs. It reuses NewDuckDBClient defined in internal/duckdb_conn.go.
func (*TestHarness) StartPostgres ¶
func (h *TestHarness) StartPostgres(ctx context.Context) (string, error)
StartPostgres starts a postgres container and returns a DSN. It waits until Postgres is reachable. Caller is responsible for calling StopPostgres.
func (*TestHarness) StartS3 ¶
func (h *TestHarness) StartS3(ctx context.Context) (string, error)
StartS3 starts an S3-compatible object store container (RustFS) and returns its endpoint. RustFS replaced the archived MinIO image, which no longer receives updates. The image is pinned by digest so CI and review results stay reproducible across upstream RustFS releases; deploy/docker-compose.yml deliberately tracks rustfs:latest instead, so the dev stack picks up upstream fixes without a manual digest bump (#262). Caller is responsible for calling StopS3.
func (*TestHarness) StopDuckDB ¶
func (h *TestHarness) StopDuckDB() error
StopDuckDB closes the duckdb client.
func (*TestHarness) StopPostgres ¶
func (h *TestHarness) StopPostgres(ctx context.Context) error
StopPostgres stops the Postgres container and closes DB handle.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package federated provides custom assertions for E2E testing.
|
Package federated provides custom assertions for E2E testing. |
|
Package production is the reusable E2E test harness that exercises the REAL production stack end to end (#173, epic #172):
|
Package production is the reusable E2E test harness that exercises the REAL production stack end to end (#173, epic #172): |