Skip to content

Commit 8090e4b

Browse files
authored
Merge pull request uyuni-project#435 from nodeg/aruba
2 parents e7873b0 + 51e4588 commit 8090e4b

8 files changed

Lines changed: 232 additions & 175 deletions

Gemfile.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ PATH
33
specs:
44
tetra (2.0.7)
55
clamp (~> 1.3.2)
6-
erb (~> 4.0.3)
6+
erb (~> 6.0)
77
json_pure (>= 2.6.3, < 2.9.0)
88
open4 (~> 1.3.4)
99
rexml (>= 3.2.9, < 3.5.0)
10-
rubyzip (>= 2.3.2, < 2.5.0)
10+
rubyzip (~> 3.2)
1111
text (~> 1.3.1)
1212

1313
GEM
1414
remote: https://rubygems.org/
1515
specs:
16-
aruba (0.6.2)
17-
childprocess (>= 0.3.6)
18-
cucumber (>= 1.1.1)
19-
rspec-expectations (>= 2.7.0)
16+
aruba (2.3.3)
17+
bundler (>= 1.17)
18+
contracts (>= 0.16.0, < 0.18.0)
19+
cucumber (>= 8.0, < 11.0)
20+
rspec-expectations (>= 3.4, < 5.0)
21+
thor (~> 1.0)
2022
ast (2.4.3)
2123
base64 (0.3.0)
2224
bigdecimal (4.0.1)
2325
builder (3.3.0)
24-
cgi (0.5.1)
25-
childprocess (5.1.0)
26-
logger (~> 1.5)
2726
clamp (1.3.2)
27+
contracts (0.17.3)
2828
cucumber (10.2.0)
2929
base64 (~> 0.2)
3030
builder (~> 3.2)
@@ -52,8 +52,7 @@ GEM
5252
cucumber-tag-expressions (8.1.0)
5353
diff-lcs (1.6.2)
5454
docile (1.4.1)
55-
erb (4.0.4)
56-
cgi (>= 0.3.3)
55+
erb (6.0.1)
5756
ffi (1.17.3)
5857
ffi (1.17.3-aarch64-linux-gnu)
5958
ffi (1.17.3-aarch64-linux-musl)
@@ -75,7 +74,7 @@ GEM
7574
multi_test (1.1.0)
7675
open4 (1.3.4)
7776
parallel (1.27.0)
78-
parser (3.3.10.0)
77+
parser (3.3.10.1)
7978
ast (~> 2.4.1)
8079
racc
8180
prism (1.8.0)
@@ -118,7 +117,7 @@ GEM
118117
lint_roller (~> 1.1)
119118
rubocop (~> 1.81)
120119
ruby-progressbar (1.13.0)
121-
rubyzip (2.4.1)
120+
rubyzip (3.2.2)
122121
simplecov (0.22.0)
123122
docile (~> 1.1)
124123
simplecov-html (~> 0.11)
@@ -129,6 +128,7 @@ GEM
129128
ffi (~> 1.1)
130129
memoist3 (~> 1.0.0)
131130
text (1.3.1)
131+
thor (1.5.0)
132132
unicode-display_width (3.2.0)
133133
unicode-emoji (~> 4.1)
134134
unicode-emoji (4.2.0)
@@ -147,24 +147,23 @@ PLATFORMS
147147
x86_64-linux-musl
148148

149149
DEPENDENCIES
150-
aruba (~> 0.6.2)
151-
rake (~> 13.3.0)
152-
rspec (~> 3.13.0)
150+
aruba (~> 2.3)
151+
rake (~> 13.3)
152+
rspec (~> 3.13)
153153
rubocop (~> 1.82.1)
154154
rubocop-rake (~> 0.7.1)
155155
rubocop-rspec (~> 3.9.0)
156-
simplecov (~> 0.22.0)
156+
simplecov (~> 0.22)
157157
tetra!
158158

159159
CHECKSUMS
160-
aruba (0.6.2) sha256=7c518ca72da37dc966c6a2f589d9953ab7576a43332b7bac38949d06f5009842
160+
aruba (2.3.3) sha256=837a2f023368a75a38ad9be227e9738ab9af7df3b3f35afd8fb5fc5f7a93f1d4
161161
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
162162
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
163163
bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
164164
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
165-
cgi (0.5.1) sha256=e93fcafc69b8a934fe1e6146121fa35430efa8b4a4047c4893764067036f18e9
166-
childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec
167165
clamp (1.3.2) sha256=4f6a99a8678d51abbf1650263a74d1ac50939edc11986271431d2e03a0d7a022
166+
contracts (0.17.3) sha256=e72e626413ea47099becb7b5683beb1c2ea902c69f5bad55c9258fe2b48314d7
168167
cucumber (10.2.0) sha256=fdedbd31ecf40858b60f04853f2aa15c44f5c30bbac29c6a227fa1e7005a8158
169168
cucumber-ci-environment (11.0.0) sha256=0df79a9e1d0b015b3d9def680f989200d96fef206f4d19ccf86a338c4f71d1e2
170169
cucumber-core (16.1.1) sha256=d3aaa80a1ee2865f63f1a21ef496129f675af9099993b9af9608c4ef8ae26b89
@@ -175,7 +174,7 @@ CHECKSUMS
175174
cucumber-tag-expressions (8.1.0) sha256=9bd8c4b6654f8e5bf2a9c99329b6f32136a75e50cd39d4cfb3927d0fa9f52e21
176175
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
177176
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
178-
erb (4.0.4) sha256=de116e106205c46bc01918789b611aaad1328dcc6e9f12cf8cd2cc60ef619717
177+
erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
179178
ffi (1.17.3) sha256=0e9f39f7bb3934f77ad6feab49662be77e87eedcdeb2a3f5c0234c2938563d4c
180179
ffi (1.17.3-aarch64-linux-gnu) sha256=28ad573df26560f0aedd8a90c3371279a0b2bd0b4e834b16a2baa10bd7a97068
181180
ffi (1.17.3-aarch64-linux-musl) sha256=020b33b76775b1abacc3b7d86b287cef3251f66d747092deec592c7f5df764b2
@@ -197,7 +196,7 @@ CHECKSUMS
197196
multi_test (1.1.0) sha256=e9e550cdd863fb72becfe344aefdcd4cbd26ebf307847f4a6c039a4082324d10
198197
open4 (1.3.4) sha256=a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1
199198
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
200-
parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
199+
parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
201200
prism (1.8.0) sha256=84453a16ef5530ea62c5f03ec16b52a459575ad4e7b9c2b360fd8ce2c39c1254
202201
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
203202
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
@@ -214,13 +213,14 @@ CHECKSUMS
214213
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
215214
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
216215
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
217-
rubyzip (2.4.1) sha256=8577c88edc1fde8935eb91064c5cb1aef9ad5494b940cf19c775ee833e075615
216+
rubyzip (3.2.2) sha256=c0ed99385f0625415c8f05bcae33fe649ed2952894a95ff8b08f26ca57ea5b3c
218217
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
219218
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
220219
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
221220
sys-uname (1.4.1) sha256=ed2278ec670ee8af5eb5420d3a98e22188051f6241180db7c779993db2739a16
222221
tetra (2.0.7)
223222
text (1.3.1) sha256=2fbbbc82c1ce79c4195b13018a87cbb00d762bda39241bb3cdc32792759dd3f4
223+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
224224
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
225225
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
226226

spec/lib/coarse/dry_run_subcommand_spec.rb

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,58 @@
22

33
describe "`tetra dry-run`", type: :aruba do
44
it "does not start a dry-run if init has not run yet" do
5-
run_simple("tetra dry-run")
5+
# Expecting failure, so we disable fail_on_error
6+
run_command_and_stop("tetra dry-run", fail_on_error: false)
67

7-
expect(stderr_from("tetra dry-run")).to include("is not a tetra project directory")
8+
expect(last_command_started.stderr).to include("is not a tetra project directory")
89
end
910

1011
it "does a dry-run build" do
11-
run_simple("tetra init --no-archive mypackage")
12+
run_command_and_stop("tetra init --no-archive mypackage")
1213
cd("mypackage")
1314

14-
run_interactive("tetra dry-run")
15+
# Interactive Step:
16+
# 1. Start the command asynchronously (don't wait yet)
17+
run_command("tetra dry-run")
18+
19+
# 2. Send input to the running process
1520
type("echo ciao")
1621
type("echo ciao > ciao.jar")
17-
type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0
22+
type("\u{0004}") # ^D (Ctrl+D) to exit the shell
23+
24+
# 3. Wait for the command to finish processing input and exit
25+
stop_all_commands
1826

19-
expect(all_output).to include("Dry-run started")
20-
expect(all_output).to include("bash shell")
21-
expect(all_output).to include("ciao")
22-
expect(all_output).to include("Dry-run finished")
27+
# Check output of the interactive session
28+
output = last_command_started.output
29+
expect(output).to include("Dry-run started")
30+
expect(output).to include("bash shell")
31+
expect(output).to include("ciao")
32+
expect(output).to include("Dry-run finished")
2333

2434
# check that markers were written in git repo
25-
run_simple("git rev-list --format=%B --max-count=1 HEAD~")
26-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD~")).to include("tetra: dry-run-started")
35+
run_command_and_stop("git rev-list --format=%B --max-count=1 HEAD~")
36+
expect(last_command_started.stdout).to include("tetra: dry-run-started")
2737

28-
run_simple("git rev-list --format=%B --max-count=1 HEAD")
29-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: dry-run-finished")
30-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: build-script-line: echo ciao")
38+
run_command_and_stop("git rev-list --format=%B --max-count=1 HEAD")
39+
expect(last_command_started.stdout).to include("tetra: dry-run-finished")
40+
expect(last_command_started.stdout).to include("tetra: build-script-line: echo ciao")
3141
end
3242

3343
it "does a scripted dry-run" do
34-
run_simple("tetra init --no-archive mypackage")
44+
run_command_and_stop("tetra init --no-archive mypackage")
3545
cd("mypackage")
3646

37-
run_interactive("tetra dry-run -s 'echo ciao > ciao.jar'")
47+
run_command_and_stop("tetra dry-run -s 'echo ciao > ciao.jar'")
3848

39-
expect(all_output).to include("Scripted dry-run started")
49+
expect(last_command_started.output).to include("Scripted dry-run started")
4050

4151
# check that markers were written in git repo
42-
run_simple("git rev-list --format=%B --max-count=1 HEAD~")
43-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD~")).to include("tetra: dry-run-started")
52+
run_command_and_stop("git rev-list --format=%B --max-count=1 HEAD~")
53+
expect(last_command_started.stdout).to include("tetra: dry-run-started")
4454

45-
run_simple("git rev-list --format=%B --max-count=1 HEAD")
46-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: dry-run-finished")
47-
expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: build-script-line: echo ciao > ciao.jar")
55+
run_command_and_stop("git rev-list --format=%B --max-count=1 HEAD")
56+
expect(last_command_started.stdout).to include("tetra: dry-run-finished")
57+
expect(last_command_started.stdout).to include("tetra: build-script-line: echo ciao > ciao.jar")
4858
end
4959
end

0 commit comments

Comments
 (0)