50 lines
1.6 KiB
Bash
Executable File
50 lines
1.6 KiB
Bash
Executable File
#!/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"
|
|
|
|
OCI_IMAGE="complement-conduit:main"
|
|
|
|
# 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)
|
|
SKIPPED_COMPLEMENT_TESTS='-skip=TestClientSpacesSummary.*|TestJoinFederatedRoomFromApplicationServiceBridgeUser.*|TestJumpToDateEndpoint.*'
|
|
|
|
toplevel="$(git rev-parse --show-toplevel)"
|
|
|
|
pushd "$toplevel" > /dev/null
|
|
|
|
bin/nix-build-and-cache just .#static-complement
|
|
|
|
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" \
|
|
go test -tags="conduwuit_blacklist" "$SKIPPED_COMPLEMENT_TESTS" -v -timeout 1h -json ./tests | tee "$LOG_FILE"
|
|
set -o pipefail
|
|
|
|
# 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 '
|
|
select(
|
|
(.Action == "pass" or .Action == "fail" or .Action == "skip")
|
|
and .Test != null
|
|
) | {Action: .Action, Test: .Test}
|
|
' > "$RESULTS_FILE"
|