From eab07ba4d83ca99a75207f93581c4332f29c60e5 Mon Sep 17 00:00:00 2001 From: southerntofu Date: Mon, 21 Feb 2022 00:27:26 +0100 Subject: [PATCH] Prevent some race condition making test fail sometime Saving the webhook to /tmp was sometimes not finished before curl was caused, resulting in an empty payload -> validation error Passing via STDIN could be an alternative... --- tests/helper.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/helper.bash b/tests/helper.bash index 0e9be09..decf536 100755 --- a/tests/helper.bash +++ b/tests/helper.bash @@ -23,6 +23,8 @@ function gen_webhook() { function send_webhook { TMPFILE="$(mktemp)" echo -n "$2" > $TMPFILE + # To prevent race conditions where curl is started while $TMPFILE is still empty + sync # We can make a few attempts, just in case the webserver hasn't started yet n=0