Fixed racy test: wait for the server to stop after being killed when we have async pushes turned on

This commit is contained in:
Zach Musgrave
2022-03-21 16:05:21 -07:00
parent efac61c263
commit 9c19de7f20
2 changed files with 22 additions and 2 deletions

View File

@@ -170,10 +170,20 @@ start_multi_db_server() {
wait_for_connection $PORT 5000
}
# stop_sql_server stops the SQL server. For cases where it's important
# to wait for the process to exit after the kill signal (e.g. waiting
# for an async replication push), pass 1.
stop_sql_server() {
wait=$1
if [ ! -z "$SERVER_PID" ]; then
kill $SERVER_PID
fi
if [ $wait ]; then
while ps -p $SERVER_PID > /dev/null; do
sleep .1;
done
fi;
SERVER_PID=
}

View File

@@ -84,8 +84,8 @@ teardown() {
multi_query repo1 1 "
SELECT DOLT_COMMIT('-am', 'Step 1');"
# threads guaranteed to flush after we stop server
stop_sql_server
# wait for the process to exit after we stop it
stop_sql_server 1
cd ../repo2
dolt pull remote1
@@ -255,3 +255,13 @@ teardown() {
server_query "repo2/feature-branch" 1 "SHOW Tables" "Table\ntest"
}
@test "remotes-sql-server: connect to hash works" {
skiponwindows "Has dependencies that are missing on the Jenkins Windows installation."
cd repo1
head_hash=$(get_head_commit)
}
get_head_commit() {
dolt log -n 1 | grep -m 1 commit | cut -c 13-44
}