Sha256: ff831e51d17e0cf81d528603482a66d6e8d07d26019569d19487695e11a0674d

Contents?: true

Size: 1.48 KB

Versions: 26

Compression:

Stored size: 1.48 KB

Contents

require_relative "../../../../base"

describe "VagrantPlugins::GuestSUSE::Cap::ConfigureNetworks" do
  let(:caps) do
    VagrantPlugins::GuestSUSE::Plugin
      .components
      .guest_capabilities[:suse]
  end

  let(:guest) { double("guest") }
  let(:machine) { double("machine", guest: guest) }
  let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) }

  before do
    allow(machine).to receive(:communicate).and_return(comm)
  end

  after do
    comm.verify_expectations!
  end

  describe ".configure_networks" do
    let(:cap) { caps.get(:configure_networks) }

    before do
      allow(guest).to receive(:capability).with(:network_scripts_dir)
        .and_return("/scripts")
      allow(guest).to receive(:capability).with(:network_interfaces)
        .and_return(["eth1", "eth2"])
    end

    let(:network_1) do
      {
        interface: 0,
        type: "dhcp",
      }
    end

    let(:network_2) do
      {
        interface: 1,
        type: "static",
        ip: "33.33.33.10",
        netmask: "255.255.0.0",
        gateway: "33.33.0.1",
      }
    end

    it "creates and starts the networks" do
      cap.configure_networks(machine, [network_1, network_2])
      expect(comm.received_commands[0]).to match(/\/sbin\/ifdown 'eth1'/)
      expect(comm.received_commands[0]).to match(/\/sbin\/ifup 'eth1'/)
      expect(comm.received_commands[0]).to match(/\/sbin\/ifdown 'eth2'/)
      expect(comm.received_commands[0]).to match(/\/sbin\/ifup 'eth2'/)
    end
  end
end

Version data entries

26 entries across 22 versions & 5 rubygems

Version Path
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-unbundled-2.0.2.0 test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-unbundled-2.0.1.0 test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-unbundled-2.0.0.1 test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-unbundled-1.9.8.1 test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-unbundled-1.9.7.1 test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/suse/cap/configure_networks_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/guests/suse/cap/configure_networks_test.rb