Report randomized test failures to zed.dev, to create issues in linear
This commit is contained in:
parent
c329546570
commit
5c3da91e15
2 changed files with 31 additions and 8 deletions
4
.github/workflows/randomized_tests.yml
vendored
4
.github/workflows/randomized_tests.yml
vendored
|
@ -8,12 +8,14 @@ on:
|
||||||
- main
|
- main
|
||||||
- randomized-tests-runner
|
- randomized-tests-runner
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '*/15 * * * *'
|
- cron: '0 * * * *'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
ZED_SERVER_URL: https://zed.dev
|
||||||
|
ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
|
|
@ -1,27 +1,48 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
|
: $ZED_SERVER_URL
|
||||||
|
: $ZED_CLIENT_SECRET_TOKEN
|
||||||
|
|
||||||
# Compile the tests first
|
# Compile the tests first
|
||||||
mkdir -p target
|
mkdir -p target
|
||||||
cargo test --release --package collab --no-run
|
cargo test --release --lib --package collab --no-run
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "Build failed"
|
echo "Build failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
LOG_FILE=target/randomized-tests.log
|
LOG_FILE=target/randomized-tests.log
|
||||||
export SAVE_PLAN=target/test-plan.json
|
export SAVE_PLAN=target/test-plan.json
|
||||||
export OPERATIONS=200
|
export OPERATIONS=200
|
||||||
export ITERATIONS=10000
|
export ITERATIONS=100000
|
||||||
export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
|
export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
|
||||||
|
|
||||||
cargo test --release --package collab random -- --nocapture 2> >(tee $LOG_FILE)
|
echo "Starting seed: ${SEED}"
|
||||||
|
|
||||||
|
cargo test --release --lib --package collab random 2>&1 > $LOG_FILE
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
echo "Tests passed"
|
echo "Tests passed"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the tests failed, find the failing seed in the logs
|
# If the tests failed, find the failing seed in the logs
|
||||||
failing_seed=$(grep "failing seed" $LOG_FILE | cut -d: -f2 | xargs)
|
commit=$(git rev-parse HEAD)
|
||||||
echo "Tests failed. seed: $failing_seed"
|
failing_seed=$(grep "failing seed" $LOG_FILE | tail -n1 | cut -d: -f2 | xargs)
|
||||||
|
failing_plan=$(cat $SAVE_PLAN)
|
||||||
|
request="{
|
||||||
|
\"seed\": \"${failing_seed}\",
|
||||||
|
\"commit\": \"${commit}\",
|
||||||
|
\"token\": \"${ZED_CLIENT_SECRET_TOKEN}\",
|
||||||
|
\"plan\": ${failing_plan}
|
||||||
|
}"
|
||||||
|
|
||||||
|
echo "Reporting test failure."
|
||||||
|
echo $request
|
||||||
|
|
||||||
|
curl \
|
||||||
|
-X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "${request}" \
|
||||||
|
"${ZED_SERVER_URL}/api/randomized_test_failure"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue