Sha256: 5fa34fdf0f4145d0e829bb89b60d596b319c4c5d837ecb4d6e8cf30ae16a4cb8

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require 'vagrant-guests-solaris11/cap/configure_networks'
require 'spec_helper'

describe VagrantPlugins::GuestSolaris11::Cap::ConfigureNetworks do
  include_context 'machine'

  it "should configure networks using hostname.in(5)" do
    networks = [
      {:type => :static, :ip => '192.168.10.10', :netmask => '255.255.255.0', :interface => 1},
      {:type => :dhcp, :interface => 2},
      {:type => :static, :ip => '10.168.10.10', :netmask => '255.255.0.0', :interface => 3},
    ]
    communicate.should_receive(:sudo).with("[ -f /etc/hostname.em0 ] && mv /etc/hostname.em0 /tmp")
    communicate.should_receive(:sudo).with("rm /etc/hostname.em* || :")
    communicate.should_receive(:sudo).with("[ -f /tmp/hostname.em0 ] && mv /tmp/hostname.em0 /etc")

    communicate.should_receive(:sudo).with(
      "su -m root -c 'echo inet #{networks[0][:ip]} #{networks[0][:netmask]} > /etc/hostname.em#{networks[0][:interface]}'")
    communicate.should_receive(:sudo).with("sh /etc/netstart em#{networks[0][:interface]}")
    communicate.should_receive(:sudo).with(
      "su -m root -c 'echo dhcp > /etc/hostname.em#{networks[1][:interface]}'")
    communicate.should_receive(:sudo).with("sh /etc/netstart em#{networks[1][:interface]}")
    communicate.should_receive(:sudo).with(
      "su -m root -c 'echo inet #{networks[2][:ip]} #{networks[2][:netmask]} > /etc/hostname.em#{networks[2][:interface]}'")
    communicate.should_receive(:sudo).with("sh /etc/netstart em#{networks[2][:interface]}")

    described_class.configure_networks(machine, networks)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-guests-solaris11-0.0.1.dev spec/cap/configure_networks_spec.rb