summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/asset/artifact/minici.yaml14
-rw-r--r--test/asset/run/dependencies.yaml55
-rw-r--r--test/script/artifact.et24
-rw-r--r--test/script/run.et73
4 files changed, 156 insertions, 10 deletions
diff --git a/test/asset/artifact/minici.yaml b/test/asset/artifact/minici.yaml
index 065ae84..7204bb3 100644
--- a/test/asset/artifact/minici.yaml
+++ b/test/asset/artifact/minici.yaml
@@ -3,15 +3,23 @@ job generate:
shell:
- echo "content 1" > f1
- - mkdir subdir
- - echo "content 2" > subdir/f2
+ - mkdir -p dir/subdir
+ - echo "content 2" > dir/f2
+ - echo "content a" > dir/fa
+ - echo "content b" > dir/subdir/fb
- echo "content 3" > f3
artifact first:
path: f1
artifact second:
- path: subdir/f2
+ path: dir/f2
artifact third:
path: f3
+
+ artifact dir:
+ path: dir
+
+ artifact sdir:
+ path: dir/subdir
diff --git a/test/asset/run/dependencies.yaml b/test/asset/run/dependencies.yaml
new file mode 100644
index 0000000..7452b5a
--- /dev/null
+++ b/test/asset/run/dependencies.yaml
@@ -0,0 +1,55 @@
+job first:
+ shell:
+ - touch x
+
+ artifact out:
+ path: x
+
+
+job second:
+ uses:
+ - first.out
+
+ shell:
+ - mv x y
+
+ artifact out:
+ path: y
+
+
+job third:
+ uses:
+ - first.out
+
+ shell:
+ - mv x z
+
+ artifact out:
+ path: z
+
+
+job fourth:
+ uses:
+ - second.out
+
+ shell:
+ - mv y w
+
+ artifact out:
+ path: w
+
+
+job fifth:
+ uses:
+ - third.out
+ - fourth.out
+
+ shell:
+ - mv z z2
+ - mv w w2
+
+ artifact out1:
+ path: z2
+
+ artifact out2:
+ path: w2
diff --git a/test/script/artifact.et b/test/script/artifact.et
index f1fc74e..c2bfc30 100644
--- a/test/script/artifact.et
+++ b/test/script/artifact.et
@@ -7,21 +7,39 @@ asset scripts:
test ExtractArtifact:
node n
local:
- spawn on n as p args [ "${scripts.path}/minici.yaml", "run", "generate" ]
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "run", "generate" ]
expect /job-finish generate done/ from p
local:
- spawn on n as p args [ "${scripts.path}/minici.yaml", "extract", "generate.first", "extracted" ]
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.first", "extracted" ]
local:
shell on n as s:
cat ./extracted
expect /content 1/ from s
local:
- spawn on n as p args [ "${scripts.path}/minici.yaml", "extract", "generate.second", "generate.third", "." ]
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.second", "generate.third", "." ]
local:
shell on n as s:
cat ./f2
cat ./f3
expect /content 2/ from s
expect /content 3/ from s
+
+ local:
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.dir", "." ]
+ local:
+ shell on n as s:
+ cat ./dir/f2
+ cat ./dir/fa
+ cat ./dir/subdir/fb
+ expect /content 2/ from s
+ expect /content a/ from s
+ expect /content b/ from s
+
+ local:
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.sdir", "extracted_subdir" ]
+ local:
+ shell on n as s:
+ cat ./extracted_subdir/fb
+ expect /content b/ from s
diff --git a/test/script/run.et b/test/script/run.et
index b6dc1b0..08cee71 100644
--- a/test/script/run.et
+++ b/test/script/run.et
@@ -14,9 +14,9 @@ def expect_success from p of job:
expect_result from p of job result "done"
-test RunWithouRepo:
+test RunWithoutRepo:
node n
- spawn on n as p args [ "${scripts.path}/norepo-basic.yaml", "run", "success", "failure" ]
+ spawn on n as p args [ "--storage=.minici", "${scripts.path}/norepo-basic.yaml", "run", "success", "failure" ]
expect_result from p:
of "success" result "done"
of "failure" result "failed"
@@ -113,7 +113,7 @@ test RunExternalRepo:
# Explicit jobfile outside of any git repo
local:
- spawn on n as p args [ "--repo=first:./first", "--repo=second:./second", "${scripts.path}/external.yaml", "run", "single", "multiple", "combine" ]
+ spawn on n as p args [ "--repo=first:./first", "--repo=second:./second", "--storage=.minici", "${scripts.path}/external.yaml", "run", "single", "multiple", "combine" ]
for job in [ "single.$first_root", "multiple.$first_subtree.$second_subtree", "combine.$first_root.$second_subtree" ]:
expect_success from p of job
@@ -122,7 +122,7 @@ test RunExternalRepo:
# Explicit jobfile within a git repo
local:
- spawn on n as p args [ "--repo=first:./first", "--repo=second:./second", "${scripts.path}/external.yaml", "run", "single" ]
+ spawn on n as p args [ "--repo=first:./first", "--repo=second:./second", "--storage=.minici", "${scripts.path}/external.yaml", "run", "single" ]
expect_success from p of "single.$first_root"
expect /(.*)/ from p capture done
guard (done == "run-finish")
@@ -228,3 +228,68 @@ test RunExplicitJob:
cat list
rm list
expect /c d/ from s
+
+
+test RunExplicitDependentJob:
+ node n
+ shell on n as git_init:
+ mkdir -p main
+ git -C main -c init.defaultBranch=master init -q
+ cp "${scripts.path}/dependencies.yaml" main/minici.yaml
+ git -C main add minici.yaml
+ git -C main -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
+
+ mkdir -p main/subdir
+
+ touch main/subdir/a
+ git -C main add subdir
+ git -C main -c user.name=test -c user.email=test commit -q -m 'commit'
+ git -C main rev-parse HEAD^{commit}
+ git -C main rev-parse HEAD^{tree}
+
+ touch main/subdir/b
+ git -C main add subdir
+ git -C main -c user.name=test -c user.email=test commit -q -m 'commit'
+ git -C main rev-parse HEAD^{tree}
+
+ rm main/subdir/a
+ rm main/subdir/b
+ touch main/subdir/c
+ git -C main add subdir
+ git -C main -c user.name=test -c user.email=test commit -q -m 'commit'
+ git -C main rev-parse HEAD^{tree}
+
+ touch main/subdir/d
+ git -C main add subdir
+ git -C main -c user.name=test -c user.email=test commit -q -m 'commit'
+ git -C main rev-parse HEAD^{tree}
+
+ expect /([0-9a-f]+)/ from git_init capture c1
+ expect /([0-9a-f]+)/ from git_init capture t1
+ expect /([0-9a-f]+)/ from git_init capture t2
+ expect /([0-9a-f]+)/ from git_init capture t3
+ expect /([0-9a-f]+)/ from git_init capture t4
+
+ local:
+ spawn on n as p args [ "./main", "run", "$c1.first", "$t2.first", "$t3.fourth", "$c1.fifth", "$c1.fourth", "$c1.third", "$c1.second", "$t4.fifth" ]
+ expect_success from p of "$t1.first"
+ expect_success from p of "$t1.second"
+ expect_success from p of "$t1.third"
+ expect_success from p of "$t1.fourth"
+ expect_success from p of "$t1.fifth"
+
+ expect_success from p of "$t2.first"
+
+ expect_success from p of "$t3.first"
+ expect_success from p of "$t3.second"
+ expect_success from p of "$t3.fourth"
+
+ expect_success from p of "$t4.first"
+ expect_success from p of "$t4.second"
+ expect_success from p of "$t4.third"
+ expect_success from p of "$t4.fourth"
+ expect_success from p of "$t4.fifth"
+
+ flush from p matching /note .*/
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")