Exercise result inventories across target peers

This commit is contained in:
ms2k 2026-07-17 03:27:08 +09:00
commit b00946625d
4 changed files with 108 additions and 1 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-result-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-result \
--build-jobs 4 \
--locked \
--archive-file /tmp/remora-result-tests.tar.zst
FROM rust-tools AS kind-result-runner
WORKDIR /workspace
COPY Cargo.toml ./
COPY crates crates
COPY --from=kind-result-build /tmp/remora-result-tests.tar.zst /tests/remora-result-tests.tar.zst
CMD ["bash", "-ec", "test -s /run/remora-fixture/profile.env && test -n \"$DATABASE_URL\" && test -n \"$REMORA_TARGET_ENDPOINT\" && case $REMORA_TARGET_PROVIDER in garage|versitygw) ;; *) exit 1 ;; esac && export REMORA_RESULT_REQUIRE=1 && cargo-nextest nextest run --archive-file /tests/remora-result-tests.tar.zst --workspace-remap /workspace --test-threads=1"]
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-result 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-result:
./tests/kind/run-result-job.sh

View file

@ -0,0 +1,34 @@
apiVersion: batch/v1
kind: Job
metadata:
name: @@JOB_NAME@@
namespace: remora-testbed
spec:
activeDeadlineSeconds: 900
backoffLimit: 0
ttlSecondsAfterFinished: 300
template:
spec:
automountServiceAccountToken: false
enableServiceLinks: false
restartPolicy: Never
containers:
- name: tests
image: @@TEST_IMAGE@@
imagePullPolicy: Never
envFrom:
- configMapRef: {name: @@PROFILE_NAME@@}
env:
- name: REMORA_RESULT_REQUIRE
value: "1"
volumeMounts:
- {name: fixture-profile, mountPath: /run/remora-fixture, readOnly: true}
resources:
requests: {cpu: 250m, memory: 512Mi}
limits: {cpu: "2", memory: 2Gi}
volumes:
- name: fixture-profile
configMap:
name: @@PROFILE_NAME@@-file
items:
- {key: profile.env, path: profile.env}

50
tests/kind/run-result-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-result-runner \
--tag remora-kind-result:local \
"$ROOT"
OWNS_FIXTURE=true
setup_fixture durable target
load_local_image remora-kind-result:local
run_job_matrix \
result-inventory \
"$TESTBED/result-job.yaml.in" \
remora-kind-result:local \
durable target
SUCCEEDED=true
printf 'result inventory package test Job passed\n'