Run outbound transport tests in a dependency-free fixture lane

This commit is contained in:
ms2k 2026-07-17 03:22:15 +09:00
commit 3088aa439e
6 changed files with 97 additions and 3 deletions

View file

@ -145,6 +145,26 @@ COPY --from=kind-target-build /tmp/remora-target-tests.tar.zst /tests/remora-tar
# versions afterward. Serial threads avoid concurrent writes during that window. # versions afterward. Serial threads avoid concurrent writes during that window.
CMD ["bash", "-ec", "test -s /run/remora-fixture/profile.env && test -n \"$REMORA_TARGET_ENDPOINT\" && test -n \"$REMORA_TARGET_BUCKET\" && test -n \"$REMORA_TARGET_ACCESS_KEY\" && test -n \"$REMORA_TARGET_SECRET_KEY\" && case $REMORA_TARGET_PROVIDER in garage|versitygw) ;; *) exit 1 ;; esac && export REMORA_TARGET_REQUIRE=1 && cargo-nextest nextest run --archive-file /tests/remora-target-tests.tar.zst --workspace-remap /workspace --test-threads=1 -E 'not test(version_addressed_and_stale_version_matrix)' && cargo-nextest nextest run --archive-file /tests/remora-target-tests.tar.zst --workspace-remap /workspace --test-threads=1 -E 'test(version_addressed_and_stale_version_matrix)'"] CMD ["bash", "-ec", "test -s /run/remora-fixture/profile.env && test -n \"$REMORA_TARGET_ENDPOINT\" && test -n \"$REMORA_TARGET_BUCKET\" && test -n \"$REMORA_TARGET_ACCESS_KEY\" && test -n \"$REMORA_TARGET_SECRET_KEY\" && case $REMORA_TARGET_PROVIDER in garage|versitygw) ;; *) exit 1 ;; esac && export REMORA_TARGET_REQUIRE=1 && cargo-nextest nextest run --archive-file /tests/remora-target-tests.tar.zst --workspace-remap /workspace --test-threads=1 -E 'not test(version_addressed_and_stale_version_matrix)' && cargo-nextest nextest run --archive-file /tests/remora-target-tests.tar.zst --workspace-remap /workspace --test-threads=1 -E 'test(version_addressed_and_stale_version_matrix)'"]
FROM rust-tools AS kind-outbound-build
WORKDIR /workspace
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY .config .config
COPY contracts contracts
COPY crates crates
COPY docs/api docs/api
RUN cargo nextest archive \
--package remora-outbound \
--build-jobs 4 \
--locked \
--archive-file /tmp/remora-outbound-tests.tar.zst
FROM rust-tools AS kind-outbound-runner
WORKDIR /workspace
COPY Cargo.toml ./
COPY crates crates
COPY --from=kind-outbound-build /tmp/remora-outbound-tests.tar.zst /tests/remora-outbound-tests.tar.zst
CMD ["cargo-nextest", "nextest", "run", "--archive-file", "/tests/remora-outbound-tests.tar.zst", "--workspace-remap", "/workspace"]
FROM ${NODE_IMAGE} AS node-runtime FROM ${NODE_IMAGE} AS node-runtime
FROM ${PLAYWRIGHT_IMAGE} AS web-dependencies FROM ${PLAYWRIGHT_IMAGE} AS web-dependencies

View file

@ -1,4 +1,4 @@
.PHONY: check-dependencies check-fixture-lib check-kind-sample check-durable check-coordination check-identity check-credentials check-stream check-target check-fast check-full check-fast-host check-full-host rust-check web-install web-check web-test-fast web-test-full .PHONY: check-dependencies check-fixture-lib check-kind-sample check-durable check-coordination check-identity check-credentials check-stream check-target check-outbound check-fast check-full check-fast-host check-full-host rust-check web-install web-check web-test-fast web-test-full
CONTAINER_ENGINE ?= nerdctl CONTAINER_ENGINE ?= nerdctl
CONTAINER_RUN_FLAGS ?= --memory=16g --memory-swap=24g --cpus=4 CONTAINER_RUN_FLAGS ?= --memory=16g --memory-swap=24g --cpus=4
@ -76,3 +76,6 @@ check-stream:
check-target: check-target:
./tests/kind/run-target-job.sh ./tests/kind/run-target-job.sh
check-outbound:
./tests/kind/run-outbound-job.sh

View file

@ -14,7 +14,7 @@ The fixture owns an isolated kubeconfig at `tests/kind/.runtime/kubeconfig` and
Each work package owns its test code, test-runner image, Job manifest, acceptance command, and required compatibility families. Its all-in-one runner follows [`run-sample-job.sh`](../../tests/kind/run-sample-job.sh): acquire the fixture lock, install a cleanup trap, call `setup_fixture <families...>`, load any package-owned image with `load_local_image <image> [containerd-namespace]`, and call `run_job_matrix <job-name> <manifest> <image> <families...>`. The image namespace defaults to `default`. A retained failure prints the isolated kubeconfig and context. Each work package owns its test code, test-runner image, Job manifest, acceptance command, and required compatibility families. Its all-in-one runner follows [`run-sample-job.sh`](../../tests/kind/run-sample-job.sh): acquire the fixture lock, install a cleanup trap, call `setup_fixture <families...>`, load any package-owned image with `load_local_image <image> [containerd-namespace]`, and call `run_job_matrix <job-name> <manifest> <image> <families...>`. The image namespace defaults to `default`. A retained failure prints the isolated kubeconfig and context.
The selectable families are `durable`, `coordination`, `oidc`, `target`, `secret`, and `all`. Individual implementations are not selectors. A suite that requests `coordination`, `oidc`, and `target` runs the unchanged cargo-nextest archive against the full Redis/DragonflyDB × Keycloak/ZITADEL × Garage/VersityGW Cartesian product. Lanes run sequentially and stop on the first failure. The selectable families are `base`, `durable`, `coordination`, `oidc`, `target`, `secret`, and `all`. `base` provisions only the cluster and common namespace for suites whose controlled fixtures run inside their test pod. Individual implementations are not selectors. A suite that requests `coordination`, `oidc`, and `target` runs the unchanged cargo-nextest archive against the full Redis/DragonflyDB × Keycloak/ZITADEL × Garage/VersityGW Cartesian product. Lanes run sequentially and stop on the first failure.
Before each lane, the runner recreates a lane database, allocates unique coordination keys, provisions an OIDC tenant/client/user/role grant, creates a target bucket and prefix, and allocates a Vault path as required by the selected families. The resulting environment is exposed both through environment variables and a ConfigMap-mounted `/run/remora-fixture/profile.env`. Package manifests use `@@JOB_NAME@@`, `@@PROFILE_NAME@@`, and `@@TEST_IMAGE@@` placeholders so only the profile and lane identity vary between Jobs. Before each lane, the runner recreates a lane database, allocates unique coordination keys, provisions an OIDC tenant/client/user/role grant, creates a target bucket and prefix, and allocates a Vault path as required by the selected families. The resulting environment is exposed both through environment variables and a ConfigMap-mounted `/run/remora-fixture/profile.env`. Package manifests use `@@JOB_NAME@@`, `@@PROFILE_NAME@@`, and `@@TEST_IMAGE@@` placeholders so only the profile and lane identity vary between Jobs.

View file

@ -248,7 +248,7 @@ select_fixture_families() {
all) all)
use_all=true use_all=true
;; ;;
durable | coordination | oidc | target | secret) ;; base | durable | coordination | oidc | target | secret) ;;
*) *)
printf 'unknown fixture family: %s\n' "$family" >&2 printf 'unknown fixture family: %s\n' "$family" >&2
return 1 return 1

View file

@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: @@JOB_NAME@@
namespace: remora-testbed
spec:
activeDeadlineSeconds: 300
backoffLimit: 0
ttlSecondsAfterFinished: 300
template:
spec:
automountServiceAccountToken: false
enableServiceLinks: false
restartPolicy: Never
containers:
- name: tests
image: @@TEST_IMAGE@@
imagePullPolicy: Never
resources:
requests: {cpu: 100m, memory: 128Mi}
limits: {cpu: "1", memory: 512Mi}

50
tests/kind/run-outbound-job.sh Executable file
View file

@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
source "$ROOT/tests/kind/lib.sh"
USER_KUBECONFIG_BEFORE="$(user_kubeconfig_digest)"
SUCCEEDED=false
OWNS_FIXTURE=false
cleanup() {
local status=$?
trap - EXIT INT TERM
if [[ "${REMORA_TESTBED_RETAIN:-0}" = 1 ]] && [[ "$SUCCEEDED" != true ]]; then
printf 'retained kubeconfig: %s\n' "$KUBECONFIG_PATH"
printf 'retained context: %s\n' "$CONTEXT"
exit "$status"
fi
if [[ "$OWNS_FIXTURE" = true ]]; then
destroy_fixture || status=1
fi
if [[ "$(user_kubeconfig_digest)" != "$USER_KUBECONFIG_BEFORE" ]]; then
printf 'user kubeconfig changed unexpectedly\n' >&2
status=1
fi
exit "$status"
}
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
acquire_fixture_lock
REMORA_REAL_NERDCTL="$(command -v nerdctl)"
export REMORA_REAL_NERDCTL
"$REMORA_REAL_NERDCTL" --namespace default build \
--file "$ROOT/Dockerfile.test" \
--target kind-outbound-runner \
--tag remora-kind-outbound:local \
"$ROOT"
OWNS_FIXTURE=true
setup_fixture base
load_local_image remora-kind-outbound:local
run_job_matrix \
outbound-policy \
"$TESTBED/outbound-job.yaml.in" \
remora-kind-outbound:local \
base
SUCCEEDED=true
printf 'outbound policy transport package test Job passed\n'