Sha256: 57f0b48847ce26bc6c7dc0dd4a056100924fa3794afcd5edb3119546b9efb88d

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

# Copyright (c) 2015 VMware, Inc. All Rights Reserved.

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

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

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

  before do
    allow(machine).to receive(:communicate).and_return(comm)
    comm.stub_command("ifconfig | grep 'eth' | cut -f1 -d' '",
      stdout: "eth1\neth2")
  end

  after do
    comm.verify_expectations!
  end

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

    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[1]).to match(/ifconfig eth1/)
      expect(comm.received_commands[1]).to match(/ifconfig eth2 33.33.33.10 netmast 255.255.0.0/)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-unbundled-1.8.5.2 test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-unbundled-1.8.5.1 test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-unbundled-1.8.4.2 test/unit/plugins/guests/photon/cap/configure_networks_test.rb
vagrant-unbundled-1.8.4.1 test/unit/plugins/guests/photon/cap/configure_networks_test.rb