2024-04-21 15:28:35 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Path to Complement's source code
|
|
|
|
#
|
|
|
|
# The `COMPLEMENT_SRC` environment variable is set in the Nix dev shell, which
|
|
|
|
# points to a store path containing the Complement source code. It's likely you
|
|
|
|
# want to just pass that as the first argument to use it here.
|
|
|
|
COMPLEMENT_SRC="$1"
|
|
|
|
|
|
|
|
# A `.jsonl` file to write test logs to
|
|
|
|
LOG_FILE="$2"
|
|
|
|
|
|
|
|
# A `.jsonl` file to write test results to
|
|
|
|
RESULTS_FILE="$3"
|
|
|
|
|
2024-05-12 00:22:10 -04:00
|
|
|
OCI_IMAGE="complement-conduit:main"
|
2024-04-21 15:28:35 -07:00
|
|
|
|
2024-05-21 20:59:45 -04:00
|
|
|
# Complement tests that are skipped due to flakiness/reliability issues (likely
|
|
|
|
# Complement itself induced based on various open issues)
|
|
|
|
#
|
|
|
|
# According to Go docs, these are separated by forward slashes and not pipes (why)
|
2024-07-04 01:51:32 -04:00
|
|
|
SKIPPED_COMPLEMENT_TESTS='-skip=TestClientSpacesSummary.*'
|
2024-05-21 20:59:45 -04:00
|
|
|
|
2024-05-01 23:30:49 -04:00
|
|
|
toplevel="$(git rev-parse --show-toplevel)"
|
|
|
|
|
|
|
|
pushd "$toplevel" > /dev/null
|
2024-05-06 01:09:51 -04:00
|
|
|
|
2024-05-23 20:53:13 -07:00
|
|
|
bin/nix-build-and-cache just .#static-complement
|
2024-05-06 01:09:51 -04:00
|
|
|
|
2024-04-21 15:28:35 -07:00
|
|
|
docker load < result
|
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
# It's okay (likely, even) that `go test` exits nonzero
|
|
|
|
set +o pipefail
|
|
|
|
env \
|
|
|
|
-C "$COMPLEMENT_SRC" \
|
|
|
|
COMPLEMENT_BASE_IMAGE="$OCI_IMAGE" \
|
2024-07-04 01:51:32 -04:00
|
|
|
go test -tags="conduwuit_blacklist" "$SKIPPED_COMPLEMENT_TESTS" -v -timeout 1h -json ./tests | tee "$LOG_FILE"
|
2024-04-21 15:28:35 -07:00
|
|
|
set -o pipefail
|
|
|
|
|
2024-05-02 10:32:30 -04:00
|
|
|
# Post-process the results into an easy-to-compare format, sorted by Test name for reproducible results
|
|
|
|
cat "$LOG_FILE" | jq -s -c 'sort_by(.Test)[]' | jq -c '
|
2024-04-21 15:28:35 -07:00
|
|
|
select(
|
|
|
|
(.Action == "pass" or .Action == "fail" or .Action == "skip")
|
|
|
|
and .Test != null
|
|
|
|
) | {Action: .Action, Test: .Test}
|
2024-05-02 10:32:30 -04:00
|
|
|
' > "$RESULTS_FILE"
|