1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
module publish
import common
asset scripts:
path: ../asset/publish
test PublishFromDependency:
node n
shell on n:
mkdir workdir
cp ${scripts.path}/from_dependency.yaml workdir/minici.yaml
spawn on n as p args [ "--destination=second:second_override", "--destination=third:./third", "--destination=fourth:fourth/with_dir", "--destination=fifth:fifth/with_dir", "workdir/minici.yaml", "run", "publish" ]
expect_result from p:
of "gen" result "done"
of "publish" result "done"
local:
expect /(.*)/ from p capture done
guard (done == "run-finish")
shell on n as listing:
find . -path ./workdir/.minici -prune -o -type f -print
echo DONE
expect from listing:
/.\/workdir\/minici.yaml/
/.\/workdir\/first\/dest\/x/
/.\/workdir\/first\/dest\/dir\/y/
/.\/second_override\/dir2\/subdir\/z/
/.\/third\/dir\/y/
/.\/third\/dir2\/subdir\/z/
/.\/fourth\/with_dir\/path\/for\/artifact/
/.\/fourth\/with_dir\/dir\/for\/artifact\/x/
/.\/fifth\/with_dir\/path\/for\/artifact\/z/
/.\/fifth\/with_dir\/dir\/for\/artifact\/subdir\/z/
/.\/fifth\/with_dir\/path2\/for\/artifact\/z2/
/.\/fifth\/with_dir\/path2\/for\/artifact\/subdir\/z/
/.\/fifth\/with_dir\/dir2\/for\/artifact\/dir2\/z2/
/.\/fifth\/with_dir\/dir2\/for\/artifact\/dir2\/subdir\/z/
/(.*)/ capture done
guard (done == "DONE")
test PublishFromSelf:
node n
shell on n:
mkdir workdir
cp ${scripts.path}/from_self.yaml workdir/minici.yaml
spawn on n as p args [ "--destination=dest:destination", "workdir/minici.yaml", "run", "gen_publish" ]
expect_result from p:
of "gen_publish" result "done"
local:
expect /(.*)/ from p capture done
guard (done == "run-finish")
shell on n as listing:
find . -path ./workdir/.minici -prune -o -type f -print
echo DONE
expect from listing:
/.\/workdir\/minici.yaml/
/.\/destination\/x/
/.\/destination\/y/
/(.*)/ capture done
guard (done == "DONE")
test PushRepo:
node n
let git = [ "git", "-C", "workdir" ]
let commit = git ++ [ "-c", "user.name=test", "-c", "user.email=test", "commit", "-q" ]
shell on n as git_init:
cp ${scripts.path}/push.yaml minici.yaml
mkdir workdir
$git -c init.defaultBranch=master init -q
$commit --allow-empty -m 'initial commit'
$git rev-parse HEAD
git clone --quiet --bare workdir target.git
git clone --quiet --bare workdir target3.git
touch workdir/a
$git add a
$commit -m a
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
touch workdir/b
$git add b
$commit -m b
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
touch workdir/c
$git add c
$commit -m c
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
touch workdir/d
$git add d
$commit -m d
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
touch workdir/e
$git add e
$commit -m e
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
$git reset --hard HEAD~5
$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 ce
expect /([0-9a-f]+)/ from git_init capture te
expect /([0-9a-f]+)/ from git_init capture c_end
guard (c_init == c_end)
let cmd_run = [ "--repo=source_repo:workdir", "--writable-repo=target_repo:target.git", "run" ]
local:
spawn on n as p args (cmd_run ++ [ "push_job:$cb" ]) killwith SIGINT
expect from p:
/job-enqueue push_job:$cb/
/job-start push_job:$cb/
/job-finish push_job:$cb done/
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == cb)
test PushRepoWritable:
node n
let git = [ "git", "-C", "workdir" ]
let commit = git ++ [ "-c", "user.name=test", "-c", "user.email=test", "commit", "-q" ]
shell on n as git_init:
cp ${scripts.path}/push.yaml minici.yaml
mkdir workdir
$git -c init.defaultBranch=master init -q
$commit --allow-empty -m 'initial commit'
$git rev-parse HEAD
git clone --quiet --bare workdir target1.git
git clone --quiet --bare workdir target2.git
git clone --quiet --bare workdir target3.git
git clone --quiet --bare workdir target4.git
touch workdir/a
$git add a
$commit -m a
$git rev-parse HEAD
$git rev-parse HEAD^{tree}
$git reset --hard HEAD~1
$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 c_end
guard (c_init == c_end)
local:
let cmd_run = [ "--repo=source_repo:workdir", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job:$ca/
/job-start push_job:$ca/
/job-finish push_job:$ca done/
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target2.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == ca)
local:
let cmd_run = [ "--repo=source_repo:workdir", "--repo=target_repo:target1.git", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job:$ca/
/job-start push_job:$ca/
/job-finish push_job:$ca error/
expect /note .*repo .*target1.git.* is not writable.*/ from p
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target1.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == c_init)
local:
let cmd_run = [ "--repo=source_repo:workdir", "--writable-repo=target_repo:target1.git", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job:$ca/
/job-start push_job:$ca/
/job-finish push_job:$ca done/
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target1.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == ca)
local:
let cmd_run = [ "--repo=source_repo:workdir", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job_ro:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job_ro:$ca/
/job-start push_job_ro:$ca/
/job-finish push_job_ro:$ca error/
expect /note .*repo .*target3.git.* is not writable.*/ from p
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target2.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == ca)
local:
let cmd_run = [ "--repo=source_repo:workdir", "--repo=target_repo_ro:target4.git", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job_ro:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job_ro:$ca/
/job-start push_job_ro:$ca/
/job-finish push_job_ro:$ca error/
expect /note .*repo .*target4.git.* is not writable.*/ from p
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target4.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == c_init)
local:
let cmd_run = [ "--repo=source_repo:workdir", "--writable-repo=target_repo_ro:target4.git", "run" ]
spawn on n as p args (cmd_run ++ [ "push_job_ro:$ca" ]) killwith SIGINT
expect from p:
/job-enqueue push_job_ro:$ca/
/job-start push_job_ro:$ca/
/job-finish push_job_ro:$ca done/
expect /(.*)/ from p capture finish
guard (finish == "run-finish")
shell on n as git_check:
git -C target4.git rev-parse HEAD
expect /([0-9a-f]+)/ from git_check capture cur_target
guard (cur_target == ca)
|