Sha256: 25051ede9101a58010ea55ba0a6d37a5ee7af988702c7ca20287630f7494bb9a
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require_relative "../../../../base" describe "VagrantPlugins::GuestSmartos::Cap::ChangeHostName" do let(:caps) do VagrantPlugins::GuestSmartos::Plugin .components .guest_capabilities[:smartos] end let(:machine) { double("machine") } let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) } let(:config) { double("config", smartos: VagrantPlugins::GuestSmartos::Config.new) } before do machine.stub(:communicate).and_return(comm) machine.stub(:config).and_return(config) end after do comm.verify_expectations! end describe ".change_host_name" do let(:cap) { caps.get(:change_host_name) } it "changes the hostname if appropriate" do cap.change_host_name(machine, "testhost") expect(comm.received_commands[0]).to match(/if hostname | grep 'testhost' ; then/) expect(comm.received_commands[0]).to match(/exit 0/) expect(comm.received_commands[0]).to match(/fi/) expect(comm.received_commands[0]).to match(/if \[ -d \/usbkey \] && \[ "\$\(zonename\)" == "global" \] ; then/) expect(comm.received_commands[0]).to match(/pfexec sed -i '' 's\/hostname=\.\*\/hostname=testhost\/' \/usbkey\/config/) expect(comm.received_commands[0]).to match(/fi/) expect(comm.received_commands[0]).to match(/pfexec echo 'testhost' > \/etc\/nodename/) expect(comm.received_commands[0]).to match(/pfexec hostname testhost/) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-unbundled-1.9.7.1 | test/unit/plugins/guests/smartos/cap/change_host_name_test.rb |