From f48fa029169d05e04f2a7fe13fbf099ffd9ed3e7 Mon Sep 17 00:00:00 2001 From: Kwonunn Date: Sun, 6 Oct 2024 16:53:11 +0200 Subject: [PATCH] WIP: Add test for schedule not being cancelled --- .../.forgejo/workflows/test.yml | 8 ++++++++ actions/example-schedule-noncancel/run.sh | 18 ++++++++++++++++++ actions/example-schedule-noncancel/teardown.sh | 4 ++++ 3 files changed, 30 insertions(+) create mode 100644 actions/example-schedule-noncancel/.forgejo/workflows/test.yml create mode 100755 actions/example-schedule-noncancel/run.sh create mode 100644 actions/example-schedule-noncancel/teardown.sh diff --git a/actions/example-schedule-noncancel/.forgejo/workflows/test.yml b/actions/example-schedule-noncancel/.forgejo/workflows/test.yml new file mode 100644 index 0000000..e0015c3 --- /dev/null +++ b/actions/example-schedule-noncancel/.forgejo/workflows/test.yml @@ -0,0 +1,8 @@ +on: + schedule: + - cron: "* * * * *" +jobs: + test: + runs-on: docker + steps: + - run: sleep 15 diff --git a/actions/example-schedule-noncancel/run.sh b/actions/example-schedule-noncancel/run.sh new file mode 100755 index 0000000..9fa275d --- /dev/null +++ b/actions/example-schedule-noncancel/run.sh @@ -0,0 +1,18 @@ +repo=root/example-$example +# +# push the repository +# +forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token +sha=$(forgejo-test-helper.sh branch_tip $url $repo main) +# +# wait for the workflow (sleep infinity) to start running +# +forgejo-test-helper.sh wait_running $url $repo $sha +# +# push to the same branch +# +forgejo-test-helper.sh push_workflow actions/example-echo $url root example-$example setup-forgejo $token +# +# wait for the workflow to be canceled as a result of the previous push +# +forgejo-test-helper.sh wait_success $url $repo $sha diff --git a/actions/example-schedule-noncancel/teardown.sh b/actions/example-schedule-noncancel/teardown.sh new file mode 100644 index 0000000..ae9987a --- /dev/null +++ b/actions/example-schedule-noncancel/teardown.sh @@ -0,0 +1,4 @@ +# +# this will effectively discard any linger workflow so they do not interfere with other tests +# +forgejo-runner.sh reload