diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-04-04 16:38:53 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-06-23 22:42:37 +0200 |
| commit | 26abedba2417ef166a3dfe2370736ec337ed7dfd (patch) | |
| tree | ff26ffd3527a8660138b217d212271d2e6bba59f | |
| parent | 5aacb05027deb842123b1f74f004531a055d26ae (diff) | |
| -rw-r--r-- | test/asset/run/cancel.yaml | 28 | ||||
| -rw-r--r-- | test/script/run.et | 100 |
2 files changed, 128 insertions, 0 deletions
diff --git a/test/asset/run/cancel.yaml b/test/asset/run/cancel.yaml new file mode 100644 index 0000000..25b807a --- /dev/null +++ b/test/asset/run/cancel.yaml @@ -0,0 +1,28 @@ +job first: + shell: | + mkfifo wait + realpath wait + cat wait + touch x + + artifact out: + path: x + + +job second: + uses: + - first.out + + shell: | + mv x y + + artifact out: + path: y + + +job third: + shell: | + touch z + + artifact out: + path: z diff --git a/test/script/run.et b/test/script/run.et index 3e13ca1..4944f13 100644 --- a/test/script/run.et +++ b/test/script/run.et @@ -630,3 +630,103 @@ test RunWithManyRepos: expect_success from p of "combined_transitive.$mt.$r1t.$r2t.$r3t.$r4t.$r5t" expect /(.*)/ from p capture done guard (done == "run-finish") + + +test WatchBranchAndCancel: + 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' + + 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} + + git reset --hard HEAD~2 + + 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} + + touch e + git add e + git -c user.name=test -c user.email=test commit -q -m e + git rev-parse HEAD + git rev-parse HEAD^{tree} + + git reset --hard HEAD~3 + git rev-parse HEAD + + 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 ce + expect /([0-9a-f]+)/ from git_init capture te + expect /([0-9a-f]+)/ from git_init capture cbase + + local: + spawn on n as p args [ "--jobs=2", "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-start $ta.first/ + /job-start $ta.third/ + /job-finish $ta.third done/ + + shell on n: + git reset --hard $cc + + expect from p: + /job-start .*/ + + shell on n: + git reset --hard $ce + + expect from p: + /job-finish $tb.first cancelled/ + /job-finish $tb.second cancelled/ + /job-finish $tc.first cancelled/ + /job-finish $tc.second cancelled/ + /job-finish $tc.third cancelled/ + + for commit in [ ta ]: + spawn on n as log args [ "log", "$commit.first" ] + expect from log /msg (.*)/ capture path + shell on n: + echo -n > $path + expect from p /job-finish $commit.first done/ + + for commit in [ td, te ]: + expect from p /job-start $commit.first/ + spawn on n as log args [ "log", "$commit.first" ] + expect from log /msg (.*)/ capture path + shell on n: + echo -n > $path + expect from p /job-finish $commit.first done/ |