"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
server-regress suffers from races
To:
gameoftrees@openbsd.org
Date:
Sun, 12 May 2024 14:17:07 +0200

Download raw body.

Thread
server-regress is failing for me because of race conditions:
notifications are sent to the http server before the latter is ready.
Inserting a delay the same way as in clone.sh etc. makes the tests
run successfully.

I guess email_notification.sh should have equivalent changes.

diff /home/naddy/got
commit - 50ccbcd9a6e4786d4eb726ac8bc3e8565fd7aa48
path + /home/naddy/got
blob - 4e84724b805fce88a8e881e5700e1c71b5b4fd5b
file + regress/gotd/http_notification.sh
--- regress/gotd/http_notification.sh
+++ regress/gotd/http_notification.sh
@@ -47,6 +47,8 @@ test_file_changed() {
 	timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -b main -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -116,6 +118,8 @@ test_file_changed() {
 	timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	git -C $testroot/repo-clone push -q origin main
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -205,6 +209,8 @@ test_bad_utf8() {
 	timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -b main -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -298,6 +304,8 @@ test_many_commits_not_summarized() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -b main -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -403,6 +411,8 @@ test_many_commits_summarized() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -b main -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -484,6 +494,8 @@ test_branch_created() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -b newbranch -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -570,6 +582,8 @@ test_branch_removed() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	local commit_id=`git_show_branch_head $testroot/repo-clone newbranch`
 
 	got send -d newbranch -q -r $testroot/repo-clone
@@ -626,6 +640,8 @@ test_tag_created() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    >$testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -t 1.0 -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -703,6 +719,8 @@ test_tag_changed() {
 	timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
 	    > $testroot/stdout &
 
+	sleep 1 # server starts up
+
 	got send -f -t 1.0 -q -r $testroot/repo-clone
 	ret=$?
 	if [ $ret -ne 0 ]; then

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de