Skip to content

Commit

Permalink
Mock DNS result in SSH spec
Browse files Browse the repository at this point in the history
Fixes #3370
  • Loading branch information
ytti committed Jan 15, 2025
1 parent c7f0bdc commit 5a30576
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec/input/ssh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_input)
Oxidized::Node.any_instance.stubs(:resolve_output)
Resolv.any_instance.stubs(:getaddress).with('example.com').returns('192.0.2.2')
end

describe "#connect" do
it "should use proxy command when proxy host given and connect by ip if resolve_dns is true" do
# If this test fails, check it exemple.com still resolves to 93.184.215.14
# If not, update Net::SSH.expects(:start).with('93.184.215.14'... below
Oxidized.config.resolve_dns = true
@node = Oxidized::Node.new(name: 'example.com',
input: 'ssh',
Expand Down Expand Up @@ -46,7 +45,7 @@
auth_methods: %w[none publickey password],
proxy: proxy
}
Net::SSH.expects(:start).with('93.184.215.14', 'alma', ssh_options)
Net::SSH.expects(:start).with('192.0.2.2', 'alma', ssh_options)

ssh.instance_variable_set("@exec", true)
ssh.connect(@node)
Expand Down

0 comments on commit 5a30576

Please sign in to comment.