Skip to content

Commit 2e439b3

Browse files
committed
(PA-5781) Update stdout and stderr methods for Beaker 5
This commit updates stderr and stdout methods to be called on Result objects and removes _ in front of variables that are used. Previously in Beaker, you could use standalone stdout and stderr methods to access output from remote machines. These methods were deprecated in 2013 with voxpupuli/beaker@28b2510 and dropped entirely in voxpupuli/beaker@73a31c7.
1 parent ba6baa3 commit 2e439b3

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

spec/acceptance/tests/resource/ssh_authorized_key/create_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"key='mykey'"]
3131
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
3232

33-
on(agent, "cat #{auth_keys}") do |_res|
34-
fail_test "didn't find the ssh_authorized_key for #{name}" unless stdout.include? name.to_s
33+
on(agent, "cat #{auth_keys}") do |res|
34+
fail_test "didn't find the ssh_authorized_key for #{name}" unless res.stdout.include? name.to_s
3535
end
3636
end
3737

@@ -44,8 +44,8 @@
4444
"target='#{custom_key}'"]
4545
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
4646

47-
on(agent, "cat #{custom_key}") do |_res|
48-
fail_test "didn't find the ssh_authorized_key for #{name}" unless stdout.include? name.to_s
47+
on(agent, "cat #{custom_key}") do |res|
48+
fail_test "didn't find the ssh_authorized_key for #{name}" unless res.stdout.include? name.to_s
4949
end
5050
on(agent, "rm -rf #{custom_key_directory}")
5151
end
@@ -64,8 +64,8 @@
6464
"key='mykey'",
6565
'drop_privileges=false',
6666
"target=/home/testuser/tmp/ssh_authorized_keys_#{name}/authorized_keys_#{name}"]
67-
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args)) do |_res|
68-
fail_test unless stderr.include?('the target path is not trusted')
67+
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args)) do |res|
68+
fail_test unless res.stderr.include?('the target path is not trusted')
6969
end
7070
on(agent, "rm -rf #{custom_key_directory}")
7171

@@ -80,8 +80,8 @@
8080
"key='mykey'",
8181
'drop_privileges=false',
8282
"target='#{custom_key}'"]
83-
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args), acceptable_exit_codes: [0, 1]) do |_res|
84-
fail_test unless stderr.include?('the target path is not trusted')
83+
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args), acceptable_exit_codes: [0, 1]) do |res|
84+
fail_test unless res.stderr.include?('the target path is not trusted')
8585
end
8686
end
8787
end

spec/acceptance/tests/resource/ssh_authorized_key/destroy_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"key='mykey'"]
3232
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
3333

34-
on(agent, "cat #{auth_keys}") do |_res|
35-
expect(stdout).not_to include(name.to_s)
34+
on(agent, "cat #{auth_keys}") do |res|
35+
expect(res.stdout).not_to include(name.to_s)
3636
end
3737
end
3838

@@ -46,8 +46,8 @@
4646
"target='#{custom_key}'"]
4747
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
4848

49-
on(agent, "cat #{custom_key}") do |_res|
50-
expect(stdout).not_to include(name.to_s)
49+
on(agent, "cat #{custom_key}") do |res|
50+
expect(res.stdout).not_to include(name.to_s)
5151
end
5252
on(agent, "rm -rf #{custom_key_directory}")
5353
end

spec/acceptance/tests/resource/ssh_authorized_key/modify_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"key='mynewshinykey'"]
3030
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
3131

32-
on(agent, "cat #{auth_keys}") do |_res|
33-
expect(stdout).to include("mynewshinykey #{name}")
34-
expect(stdout).not_to include("mykey #{name}")
32+
on(agent, "cat #{auth_keys}") do |res|
33+
expect(res.stdout).to include("mynewshinykey #{name}")
34+
expect(res.stdout).not_to include("mykey #{name}")
3535
end
3636
end
3737

@@ -45,9 +45,9 @@
4545
"target='#{custom_key}'"]
4646
on(agent, puppet_resource('ssh_authorized_key', name.to_s, args))
4747

48-
on(agent, "cat #{custom_key}") do |_res|
49-
expect(stdout).to include("mynewshinykey #{name}")
50-
expect(stdout).not_to include("mykey #{name}")
48+
on(agent, "cat #{custom_key}") do |res|
49+
expect(res.stdout).to include("mynewshinykey #{name}")
50+
expect(res.stdout).not_to include("mykey #{name}")
5151
end
5252
on(agent, "rm -rf #{custom_key_directory}")
5353
end

spec/acceptance/tests/resource/sshkey/create_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
]
6767
on(agent, puppet_resource('sshkey', keyname.to_s, args))
6868

69-
on(agent, "cat #{ssh_known_hosts}") do |_rc|
70-
expect(stdout).to include(keyname.to_s)
69+
on(agent, "cat #{ssh_known_hosts}") do |res|
70+
expect(res.stdout).to include(keyname.to_s)
7171
end
7272
end
7373
end
@@ -98,9 +98,9 @@
9898
}
9999
MANIFEST
100100

101-
on(agent, "cat #{ssh_known_hosts}") do |_rc|
102-
expect(stdout).to include("#{keyname} ssh-rsa")
103-
expect(stdout).to include("#{keyname} ssh-dss")
101+
on(agent, "cat #{ssh_known_hosts}") do |res|
102+
expect(res.stdout).to include("#{keyname} ssh-rsa")
103+
expect(res.stdout).to include("#{keyname} ssh-dss")
104104
end
105105
end
106106
end

spec/acceptance/tests/resource/sshkey/destroy_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"type='rsa'"]
5757
on(agent, puppet_resource('sshkey', keyname.to_s, args))
5858

59-
on(agent, "cat #{ssh_known_hosts}") do |_res|
60-
expect(stdout).not_to include('how_about_the_initial_rsa_key_of_c')
59+
on(agent, "cat #{ssh_known_hosts}") do |res|
60+
expect(res.stdout).not_to include('how_about_the_initial_rsa_key_of_c')
6161
end
6262
end
6363

@@ -66,8 +66,8 @@
6666
"type='ssh-dss'"]
6767
on(agent, puppet_resource('sshkey', keyname.to_s, args))
6868

69-
on(agent, "cat #{ssh_known_hosts}") do |_res|
70-
expect(stdout).not_to include('how_about_the_initial_dss_key_of_c')
69+
on(agent, "cat #{ssh_known_hosts}") do |res|
70+
expect(res.stdout).not_to include('how_about_the_initial_dss_key_of_c')
7171
end
7272
end
7373
end

spec/acceptance/tests/resource/sshkey/modify_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
"key='how_about_the_updated_rsa_key_of_c'"]
5858
on(agent, puppet_resource('sshkey', keyname.to_s, args))
5959

60-
on(agent, "cat #{ssh_known_hosts}") do |_res|
61-
expect(stdout).to include('how_about_the_updated_rsa_key_of_c')
62-
expect(stdout).not_to include('how_about_the_initial_rsa_key_of_c')
60+
on(agent, "cat #{ssh_known_hosts}") do |res|
61+
expect(res.stdout).to include('how_about_the_updated_rsa_key_of_c')
62+
expect(res.stdout).not_to include('how_about_the_initial_rsa_key_of_c')
6363
end
6464
end
6565

@@ -69,9 +69,9 @@
6969
"key='how_about_the_updated_dss_key_of_c'"]
7070
on(agent, puppet_resource('sshkey', keyname.to_s, args))
7171

72-
on(agent, "cat #{ssh_known_hosts}") do |_res|
73-
expect(stdout).to include('how_about_the_updated_dss_key_of_c')
74-
expect(stdout).not_to include('how_about_the_initial_dss_key_of_c')
72+
on(agent, "cat #{ssh_known_hosts}") do |res|
73+
expect(res.stdout).to include('how_about_the_updated_dss_key_of_c')
74+
expect(res.stdout).not_to include('how_about_the_initial_dss_key_of_c')
7575
end
7676
end
7777
end

spec/acceptance/tests/resource/sshkey/purge_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
# expect purging to be idempotent
6666
apply_manifest_on(agent, purge_manifest, catch_changes: true)
6767

68-
on(agent, "cat #{ssh_known_hosts}") do |_res|
69-
expect(stdout).not_to include('how_about_the_initial')
68+
on(agent, "cat #{ssh_known_hosts}") do |res|
69+
expect(res.stdout).not_to include('how_about_the_initial')
7070
end
7171
end
7272
end

0 commit comments

Comments
 (0)