spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-2.22.0 vs spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-2.23.0
- old
+ new
@@ -46,20 +46,18 @@
allow( subject ).to receive( :hosts ).and_return( hosts )
expect( master ).to receive( :exec ).once
subject.on( 'master', 'echo hello')
-
end
it 'if the host is a Symbol Object, finds the matching hsots with that Symbol as role' do
allow( subject ).to receive( :hosts ).and_return( hosts )
expect( master ).to receive( :exec ).once
subject.on( :master, 'echo hello')
-
end
it 'delegates to itself for each host passed' do
allow( subject ).to receive( :hosts ).and_return( hosts )
expected = []
@@ -157,11 +155,10 @@
subject.on host, command do
expect( subject.exit_code ).to be == 0
end
end
end
-
end
describe "#retry_on" do
it 'fails correctly when command never succeeds' do
result.stdout = 'stdout'
@@ -335,11 +332,10 @@
expect(host).to receive(:tmpdir).with(/\/tmp\/bogus.*/).and_return("/tmp/bogus")
expect(subject).to receive(:on).with(host, /chown puppet.puppet \/tmp\/bogus.*/)
subject.create_tmpdir_on(host, "/tmp/bogus")
end
end
-
end
context 'with an valid user argument' do
it 'executes chown once' do
expect(subject).to receive(:on).with(host, /^getent passwd curiousgeorge/).and_return(result)
@@ -356,11 +352,10 @@
expect{
subject.create_tmpdir_on(host, "/tmp/bogus", "curiousgeorge")
}.to raise_error(RuntimeError, /User curiousgeorge does not exist on/)
end
end
-
end
describe '#run_script_on' do
it 'scps the script to a tmpdir and executes it on host(s)' do
expect( subject ).to receive( :scp_to )
@@ -376,38 +371,6 @@
expect( subject ).to receive( :run_script_on ).with( master, "/tmp/test.sh", {}).once
subject.run_script( '/tmp/test.sh' )
end
end
-
- describe '#add_system32_hosts_entry' do
- before do
- allow( subject ).to receive(:on).and_return(Beaker::Result.new({},''))
- end
- context 'on debian' do
- let(:platform) { 'debian-7-amd64' }
- let(:host) { make_host('testbox.test.local', :platform => 'debian-7-amd64') }
- it 'logs message - nothing to do on this host' do
- expect( Beaker::Command ).to receive( :new ).never
-
- expect {
- subject.add_system32_hosts_entry(host, {})
- }.to raise_error
- end
- end
- context 'on windows' do
- let(:platform) { 'windows-2008R2-amd64' }
- let(:host) { make_host('testbox.test.local', :platform => 'windows-2008R2-amd64') }
- it 'it add an entry into the /etc/hosts file' do
- entry = { 'ip' => '23.251.154.122', 'name' => 'forge.puppetlabs.com' }
- expect(subject).to receive(:on) do |host, command|
- expect(command.command).to eq('powershell.exe')
- expect(command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $text = \\\"23.251.154.122`t`tforge.puppetlabs.com\\\"; Add-Content -path 'C:\\Windows\\System32\\Drivers\\etc\\hosts' -value $text"])
- end
-
-
- subject.add_system32_hosts_entry(host, entry)
- end
- end
- end
-
end