From 1957e53875864a757cab440f406a73327d57efa9 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Sat, 19 Aug 2023 20:36:15 +0200 Subject: [PATCH] use inotifywait --- .forgejo/workflows/pr.yml | 8 ++++---- main_test.go | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/pr.yml b/.forgejo/workflows/pr.yml index 7d227bd..2f79e82 100644 --- a/.forgejo/workflows/pr.yml +++ b/.forgejo/workflows/pr.yml @@ -15,11 +15,11 @@ jobs: - name: run the fake API server id: test run: | - go test -c + touch delete_me_when_ready # keep server running in the background - ACTION_TESTING=1 ./ovh-dns-update.test & - # wait for the output to be written (OVH_ENDPOINT) - sleep 1 + ACTION_TESTING=1 go test . & + # wait for the OVH_ENDPOINT output to be written + inotifywait delete_me_when_ready - name: update the record uses: ./ with: diff --git a/main_test.go b/main_test.go index 204c028..ac2e4b3 100644 --- a/main_test.go +++ b/main_test.go @@ -89,6 +89,10 @@ func TestRun(t *testing.T) { })) t.Cleanup(s.Close) githubactions.SetOutput("OVH_ENDPOINT", "http://"+s.Listener.Addr().String()) + err = os.Remove("delete_me_when_ready") + if err != nil { + t.Fatal(err) + } select {} } }