Sha256: af11fddbc415e417990c5ea930c9a5ab5aac5f68a536a5e3f37b3907d31735da

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

require 'test_helper'

describe Landrush::Cap::Linux::RedirectDns do
  let(:machine) { fake_machine }

  describe 'redirect_dns' do
    it 'fetches the dns servers from the machine, and adds one iptables rule per server' do
      machine.guest.stubs(:capability).with(:configured_dns_servers).returns([
        '1.2.3.4',
        '4.5.6.7'
      ])

      machine.guest.expects(:capability).with(:add_iptables_rule, "OUTPUT -t nat -p tcp -d 1.2.3.4 --dport 53 -j DNAT --to-destination 2.3.4.5:4321").once
      machine.guest.expects(:capability).with(:add_iptables_rule, "OUTPUT -t nat -p udp -d 1.2.3.4 --dport 53 -j DNAT --to-destination 2.3.4.5:4321").once
      machine.guest.expects(:capability).with(:add_iptables_rule, "OUTPUT -t nat -p tcp -d 4.5.6.7 --dport 53 -j DNAT --to-destination 2.3.4.5:4321").once
      machine.guest.expects(:capability).with(:add_iptables_rule, "OUTPUT -t nat -p udp -d 4.5.6.7 --dport 53 -j DNAT --to-destination 2.3.4.5:4321").once

      Landrush::Cap::Linux::RedirectDns.redirect_dns(
        machine,
        host: '2.3.4.5',
        port: '4321',
      )
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
landrush-0.19.0 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.18.0 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.17.0 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.16.0 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.15.4 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.15.3 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.15.2 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.15.1 test/landrush/cap/linux/redirect_dns_test.rb
landrush-0.15.0 test/landrush/cap/linux/redirect_dns_test.rb