diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-05 11:25:41 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-05 14:03:27 +0200 |
| commit | 439481ad37868c732fa68fc31b65c581d0dcd7fa (patch) | |
| tree | b000f79cfc453b39f5c32af7daaca039f92d5c8d /test | |
| parent | 26abedba2417ef166a3dfe2370736ec337ed7dfd (diff) | |
Restart cancelled jobs when needed
Diffstat (limited to 'test')
| -rw-r--r-- | test/script/run.et | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/test/script/run.et b/test/script/run.et index 4944f13..104562e 100644 --- a/test/script/run.et +++ b/test/script/run.et @@ -730,3 +730,133 @@ test WatchBranchAndCancel: shell on n: echo -n > $path expect from p /job-finish $commit.first done/ + + +test RestartCancelledJobs: + node n + shell on n as git_init: + git -c init.defaultBranch=master init -q + git -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit' + cp "${scripts.path}/cancel.yaml" minici.yaml + git add minici.yaml + git -c user.name=test -c user.email=test commit -q -m 'minici.yaml' + git rev-parse HEAD + + touch a + git add a + git -c user.name=test -c user.email=test commit -q -m a + git rev-parse HEAD + git rev-parse HEAD^{tree} + + touch b + git add b + git -c user.name=test -c user.email=test commit -q -m b + git rev-parse HEAD + git rev-parse HEAD^{tree} + + touch c + git add c + git -c user.name=test -c user.email=test commit -q -m c + git rev-parse HEAD + git rev-parse HEAD^{tree} + + touch d + git add d + git -c user.name=test -c user.email=test commit -q -m d + git rev-parse HEAD + git rev-parse HEAD^{tree} + + git reset --hard HEAD~4 + git rev-parse HEAD + + expect /([0-9a-f]+)/ from git_init capture c_init + expect /([0-9a-f]+)/ from git_init capture ca + expect /([0-9a-f]+)/ from git_init capture ta + expect /([0-9a-f]+)/ from git_init capture cb + expect /([0-9a-f]+)/ from git_init capture tb + expect /([0-9a-f]+)/ from git_init capture cc + expect /([0-9a-f]+)/ from git_init capture tc + expect /([0-9a-f]+)/ from git_init capture cd + expect /([0-9a-f]+)/ from git_init capture td + expect /([0-9a-f]+)/ from git_init capture c_end + + guard (c_init == c_end) + + local: + spawn on n as p args [ "--jobs=20", "run", "--new-commits-on=master" ] killwith SIGINT + expect from p /watch-branch-started master/ + + shell on n: + git reset --hard $ca + + expect from p: + /job-enqueue $ta.first/ + /job-enqueue $ta.second/ + /job-enqueue $ta.third/ + /job-start $ta.first/ + /job-start $ta.third/ + /job-finish $ta.third done/ + + shell on n: + git reset --hard $cc + + expect from p: + /job-enqueue $tb.first/ + /job-enqueue $tb.second/ + /job-enqueue $tb.third/ + /job-enqueue $tc.first/ + /job-enqueue $tc.second/ + /job-enqueue $tc.third/ + /job-start $tb.first/ + /job-start $tb.third/ + /job-start $tc.first/ + /job-start $tc.third/ + /job-finish $tb.third done/ + /job-finish $tc.third done/ + + shell on n: + git reset --hard $ca + + expect from p: + /job-finish $tb.first cancelled/ + /job-finish $tb.second cancelled/ + /job-finish $tc.first cancelled/ + /job-finish $tc.second cancelled/ + + shell on n: + git reset --hard $cb + + expect from p: + /job-enqueue $tb.first/ + /job-enqueue $tb.second/ + /job-duplicate $tb.third done/ + /job-start $tb.first/ + + shell on n: + git reset --hard $ca + + expect from p: + /job-finish $tb.first cancelled/ + /job-finish $tb.second cancelled/ + + shell on n: + git reset --hard $cd + + expect from p: + /job-enqueue $tb.first/ + /job-enqueue $tb.second/ + /job-duplicate $tb.third done/ + /job-start $tb.first/ + + /job-enqueue $tc.first/ + /job-enqueue $tc.second/ + /job-duplicate $tc.third done/ + /job-start $tc.first/ + + /job-enqueue $td.first/ + /job-enqueue $td.second/ + /job-enqueue $td.third/ + /job-start $td.first/ + /job-start $td.third/ + /job-(.*)/ capture final_job + guard (final_job == "finish $td.third done") |