Fixed bugginess in server shutdown wait for bats

This commit is contained in:
Zach Musgrave
2023-02-09 10:06:11 -08:00
parent 60b87d3f54
commit 10049193ba
3 changed files with 8 additions and 5 deletions

View File

@@ -112,15 +112,13 @@ stop_sql_server() {
wait=$1
if [ ! -z "$SERVER_PID" ]; then
serverpidinuse=$(lsof -i -P -n | grep LISTEN | grep $SERVER_PID | wc -l)
if [ $serverpidinuse -gt 0 ]; then
kill $SERVER_PID
# ignore failures of kill command in the case the server is already dead
run kill $SERVER_PID
if [ $wait ]; then
while ps -p $SERVER_PID > /dev/null; do
sleep .1;
done
fi;
fi
fi
SERVER_PID=
}

View File

@@ -82,6 +82,8 @@ teardown() {
cd repo1
dolt config --local --add sqlserver.global.dolt_replicate_to_remote remote1
dolt config --local --add sqlserver.global.dolt_async_replication 1
dolt config --local --add sqlserver.global.dolt_replicate_all_heads 1
start_sql_server repo1
dolt sql-client --use-db repo1 -P $PORT -u dolt -q "CALL DOLT_COMMIT('-am', 'Step 1');"
@@ -91,7 +93,8 @@ teardown() {
cd ../repo2
dolt pull remote1
dolt sql -q "select * from test" -r csv
run dolt sql -q "select * from test" -r csv
[ "$status" -eq 0 ]
[[ "${lines[0]}" =~ "pk" ]]
[[ "${lines[1]}" =~ "0" ]]

View File

@@ -723,6 +723,8 @@ SQL
cd repo1
dolt config --local --add sqlserver.global.dolt_replicate_to_remote remote1
dolt config --local --add sqlserver.global.dolt_async_replication 1
dolt config --local --add sqlserver.global.dolt_replicate_all_heads 1
dolt sql -q "create table t1 (a int primary key)"
dolt sql -q "call dolt_add('.')"
dolt sql -q "call dolt_commit('-am', 'cm')"