Skip to content

Commit 02e8c37

Browse files
committed
Fix cleanup
1 parent 15d947a commit 02e8c37

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/run_cli_tests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,12 @@ EOF
11521152

11531153
# Metadata disaster recovery: stop the server (final litestream sync),
11541154
# wipe the metadata directory, restart and verify the state was restored
1155-
# from the S3 replica
1155+
# from the S3 replica. `server stop` returns when shutdown STARTS; the
1156+
# final sync that carries the just-created entries runs as the process
1157+
# exits, so wait for the exit or the wipe below races the sync and the
1158+
# restore comes back stale
11561159
CL_CONFIG_FILE=config_litestream.toml GOCOVERDIR=$GOCOVERDIR/../client ../openrun server stop
1160+
wait "$SERVER_PID" 2>/dev/null || true
11571161
SERVER_PID=""
11581162
rm -rf metadata
11591163
start_litestream_test_server
@@ -1162,6 +1166,9 @@ EOF
11621166
fi
11631167

11641168
CL_CONFIG_FILE=config_litestream.toml GOCOVERDIR=$GOCOVERDIR/../client ../openrun server stop
1169+
# Wait for the process exit before deleting the metadata directory, so the
1170+
# shutdown's final litestream sync does not race the deletion
1171+
wait "$SERVER_PID" 2>/dev/null || true
11651172
SERVER_PID=""
11661173
rm -rf metadata run/openrun.sock
11671174
fi

0 commit comments

Comments
 (0)