e2e

package module
v0.0.0-...-23cecd9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

E2E Tests & Benchmarks

End-to-end tests and benchmarks that run against a live OpenMeter stack over HTTP. Both skip unless OPENMETER_ADDRESS is set.

Run the local stack

make env-local-up      # build + start openmeter + infra (docker compose)
make env-local-down    # tear down

Server listens on http://localhost:38888. config.yaml is bind-mounted, so config changes need only make env-local-up (force-recreate), not a full down/up. View service logs from this directory with

docker compose -f docker-compose.infra.yaml -f docker-compose.openmeter.yaml -f docker-compose.openmeter-local.yaml logs -f

The local E2E build stamps the checked-out Git SHA and version v0.0.0-e2e. When running TestLedgerWriterBuild against a separately built server, set OPENMETER_E2E_EXPECTED_COMMIT_SHA and OPENMETER_E2E_EXPECTED_VERSION to its build inputs. Set the expected version to an empty string for an unversioned build.

RTE client

The opt-in RTE scenario runs against separate API and RTE processes. It creates grants over the API, publishes calculation requests to Kafka and reads the worker's stored results through the RTE client. Run these commands from the e2e directory in the repository's development shell.

export OPENMETER_E2E_EXTRA_COMPOSE_FILES="-f docker-compose.rte.yaml"
make env-local-up
make wait-local
make test-rte
make env-local-down

The overlay enables RTE and exposes the local Kafka broker at localhost:39092. The default suite omits the rte_e2e build tag. For service-backed tests and the worker scenario that also exercises metered entitlements and late usage, see the RTE test guide.

Benchmarks

BenchmarkEntitlementAccessQuery measures POST /api/v3/openmeter/entitlement-access/query latency across a customers × features grid. Seeds boolean entitlements (no usage events).

make bench-entitlement-access          # 1x1 baseline + 10/50/100 diagonal
make bench-entitlement-access-matrix   # full 3x3 customers x features matrix

Overridable vars (defaults shown):

Var Default Purpose
OPENMETER_ADDRESS http://localhost:38888 target server
BENCHTIME 20x iterations per sub-benchmark
COUNT 1 repeat count (use >1 for benchstat variance)

For variance / before-after comparison:

make bench-entitlement-access COUNT=10 | tee baseline.txt
benchstat baseline.txt                 # mean ± %CV
benchstat baseline.txt after.txt       # delta + p-value

ns/op = mean of sequential request latencies (no concurrency, no tail percentiles). Boolean entitlements skip the metered/ClickHouse balance path — a relative algorithmic baseline, not a production-latency oracle.

Traces (optional)

OpenMeter runs in a container, so OTLP must target the host, not container loopback. Point the OTLP exporters in e2e/config.yaml at host.docker.internal:4317 and run a collector on the host (e.g. grafana/otel-lgtm). Then query per-size latency percentiles in Grafana (Tempo, TraceQL metrics):

{ name = "entitlement_access.Query" && span.customer_key_count = 100 && span.feature_key_count = 100 }
  | quantile_over_time(duration, 0.5, 0.9, 0.95, 0.99)

High-fan-out requests emit thousands of SQL spans; bump Tempo's max_bytes_per_trace (default 5MB) or traces get dropped at ingest.

Standard e2e tests

make test-http-errors runs the shared error handling contract through real HTTP/1, HTTP/2, gRPC, and PostgreSQL connections. The test handlers provide controlled failures without adding fault injection to production endpoints. These scenarios start their own HTTP/gRPC servers and run as part of make test-base.

For an existing PostgreSQL instance, override OPENMETER_E2E_POSTGRES_URL; the default is the local compose instance. Without that variable, direct go test ./httperrors runs the protocol scenarios and skips the SQL scenario.

make test-local        # full down → up → go test ./... → down

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCustomerWithSubject

func CreateCustomerWithSubject(t *testing.T, client *api.ClientWithResponses, customerKey string, subjectKey string) *api.Customer

This will not be needed once we get rid of subjects. Cloud middleware already handles subject / customer creation.

func GetMeterIDBySlug

func GetMeterIDBySlug(t *testing.T, client *api.ClientWithResponses, meterSlug string) string

Types

This section is empty.

Directories

Path Synopsis
internal
taxconfigv1
Package taxconfigv1 holds the helpers the v1 taxConfig characterization tests in e2e and e2e/creditsdisabled share: tax code and customer fixtures, invoice line builders, and the assertions that pin the rendered tax configs.
Package taxconfigv1 holds the helpers the v1 taxConfig characterization tests in e2e and e2e/creditsdisabled share: tax code and customer fixtures, invoice line builders, and the assertions that pin the rendered tax configs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL