diff --git a/integration-tests/bats/helper/query-server-common.bash b/integration-tests/bats/helper/query-server-common.bash index ee10fa3285..1af3ad706e 100644 --- a/integration-tests/bats/helper/query-server-common.bash +++ b/integration-tests/bats/helper/query-server-common.bash @@ -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= } diff --git a/integration-tests/bats/remotes-sql-server.bats b/integration-tests/bats/remotes-sql-server.bats index c6edbc536d..1410d47dff 100644 --- a/integration-tests/bats/remotes-sql-server.bats +++ b/integration-tests/bats/remotes-sql-server.bats @@ -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 +}