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
8 - main8 - main
9 - randomized-tests-runner9 - randomized-tests-runner
10 schedule:10 schedule:
11 - cron: '*/15 * * * *'11 - cron: '0 * * * *'
12 12
13env:13env:
14 CARGO_TERM_COLOR: always14 CARGO_TERM_COLOR: always
15 CARGO_INCREMENTAL: 015 CARGO_INCREMENTAL: 0
16 RUST_BACKTRACE: 116 RUST_BACKTRACE: 1
17 ZED_SERVER_URL: https://zed.dev
18 ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
17 19
18jobs:20jobs:
19 tests:21 tests:
script/randomized-test-ci+28−7
@@ -1,27 +1,48 @@
1#!/bin/bash1#!/bin/bash
2 2
3set -u
4
5: $ZED_SERVER_URL
6: $ZED_CLIENT_SECRET_TOKEN
7
3# Compile the tests first8# Compile the tests first
4mkdir -p target9mkdir -p target
5cargo test --release --package collab --no-run10cargo test --release --lib --package collab --no-run
6if [[ $? != 0 ]]; then11if [[ $? != 0 ]]; then
7 echo "Build failed"12 echo "Build failed"
8 exit 113 exit 1
9fi14fi
10 15
11set -eu
12
13LOG_FILE=target/randomized-tests.log16LOG_FILE=target/randomized-tests.log
14export SAVE_PLAN=target/test-plan.json17export SAVE_PLAN=target/test-plan.json
15export OPERATIONS=20018export OPERATIONS=200
16export ITERATIONS=1000019export ITERATIONS=100000
17export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)20export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
18 21
19cargo test --release --package collab random -- --nocapture 2> >(tee $LOG_FILE)22echo "Starting seed: ${SEED}"
23
24cargo test --release --lib --package collab random 2>&1 > $LOG_FILE
20if [[ $? == 0 ]]; then25if [[ $? == 0 ]]; then
21 echo "Tests passed"26 echo "Tests passed"
22 exit 027 exit 0
23fi28fi
24 29
25# If the tests failed, find the failing seed in the logs30# If the tests failed, find the failing seed in the logs
26failing_seed=$(grep "failing seed" $LOG_FILE | cut -d: -f2 | xargs)31commit=$(git rev-parse HEAD)
27echo "Tests failed. seed: $failing_seed"32failing_seed=$(grep "failing seed" $LOG_FILE | tail -n1 | cut -d: -f2 | xargs)
33failing_plan=$(cat $SAVE_PLAN)
34request="{
35 \"seed\": \"${failing_seed}\",
36 \"commit\": \"${commit}\",
37 \"token\": \"${ZED_CLIENT_SECRET_TOKEN}\",
38 \"plan\": ${failing_plan}
39}"
40
41echo "Reporting test failure."
42echo $request
43
44curl \
45 -X POST \
46 -H "Content-Type: application/json" \
47 -d "${request}" \
48 "${ZED_SERVER_URL}/api/randomized_test_failure"