Sha256: 6f204c087453df942f1d3297de85951e3db9f715927a3cf2190372a7eed5af46

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path("../../../../../base", __FILE__)
require File.expand_path("../../../support/shared/debian_like_host_name_examples", __FILE__)

describe "VagrantPlugins::GuestUbuntu::Cap::ChangeHostName" do
  let(:described_class) do
    VagrantPlugins::GuestUbuntu::Plugin.components.guest_capabilities[:ubuntu].get(:change_host_name)
  end
  let(:machine) { double("machine") }
  let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
  let(:old_hostname) {'oldhostname.olddomain.tld' }

  before do
    allow(machine).to receive(:communicate).and_return(communicator)
    communicator.stub_command('hostname -f', stdout: old_hostname)
  end

  after do
    communicator.verify_expectations!
  end

  describe ".change_host_name" do
    it_behaves_like "a debian-like host name change"

    it "refreshes the hostname service with upstart" do
      communicator.expect_command(%q(service hostname start))
      described_class.change_host_name(machine, 'newhostname.newdomain.tld')
    end

    it "renews dhcp on the system with the new hostname (with hotplug allowed)" do
      communicator.expect_command(%q(ifdown -a; ifup -a; ifup -a --allow=hotplug))
      described_class.change_host_name(machine, 'newhostname.newdomain.tld')
    end
  end
end

Version data entries

7 entries across 4 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.1.2 test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-unbundled-1.8.1.1 test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/test/unit/plugins/guests/ubuntu/cap/change_host_name_test.rb