History

Report randomized test failures to zed.dev, to create issues in linear

Max Brunsfeld committed 3 years ago

Commit 5c3da911 parent c3295462 files · +31 −8Browse files

Unified · Split

2 files
  1. .github/workflows/randomized_tests.yml +3 −1
  2. script/randomized-test-ci +28 −7
.github/workflows/randomized_tests.yml+3−1
@@ -8,12 +8,14 @@ on: · 7 unmodified lines
88 - main
99 - randomized-tests-runner
1010 schedule:
11− - cron: '*/15 * * * *'
11+ - cron: '0 * * * *'
1212
1313 env:
1414 CARGO_TERM_COLOR: always
1515 CARGO_INCREMENTAL: 0
1616 RUST_BACKTRACE: 1
17+ ZED_SERVER_URL: https://zed.dev
18+ ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
1719
1820 jobs:
1921 tests:
script/randomized-test-ci+28−7
@@ -1,27 +1,48 @@
11 #!/bin/bash
22
3+set -u
4+
5+: $ZED_SERVER_URL
6+: $ZED_CLIENT_SECRET_TOKEN
7+
38 # Compile the tests first
49 mkdir -p target
5−cargo test --release --package collab --no-run
10+cargo test --release --lib --package collab --no-run
611 if [[ $? != 0 ]]; then
712 echo "Build failed"
813 exit 1
914 fi
1015
11−set -eu
12−
1316 LOG_FILE=target/randomized-tests.log
1417 export SAVE_PLAN=target/test-plan.json
1518 export OPERATIONS=200
16−export ITERATIONS=10000
19+export ITERATIONS=100000
1720 export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
1821
19−cargo test --release --package collab random -- --nocapture 2> >(tee $LOG_FILE)
22+echo "Starting seed: ${SEED}"
23+
24+cargo test --release --lib --package collab random 2>&1 > $LOG_FILE
2025 if [[ $? == 0 ]]; then
2126 echo "Tests passed"
2227 exit 0
2328 fi
2429
2530 # If the tests failed, find the failing seed in the logs
26−failing_seed=$(grep "failing seed" $LOG_FILE | cut -d: -f2 | xargs)
27−echo "Tests failed. seed: $failing_seed"
31+commit=$(git rev-parse HEAD)
32+failing_seed=$(grep "failing seed" $LOG_FILE | tail -n1 | cut -d: -f2 | xargs)
33+failing_plan=$(cat $SAVE_PLAN)
34+request="{
35+ \"seed\": \"${failing_seed}\",
36+ \"commit\": \"${commit}\",
37+ \"token\": \"${ZED_CLIENT_SECRET_TOKEN}\",
38+ \"plan\": ${failing_plan}
39+}"
40+
41+echo "Reporting test failure."
42+echo $request
43+
44+curl \
45+ -X POST \
46+ -H "Content-Type: application/json" \
47+ -d "${request}" \
48+ "${ZED_SERVER_URL}/api/randomized_test_failure"