guests/debian: more tests for hostname

This commit is contained in:
Mitchell Hashimoto 2014-05-05 09:31:54 -07:00
parent 8e334d2f24
commit 958684fd7e
1 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,17 @@ shared_examples "a debian-like host name change" do
RESULT
end
it "appends 127.0.1.1 if it isn't there" do
communicator.stub_command(grep_command, exit_code: 1)
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
sed = communicator.received_commands.find { |cmd| cmd =~ /^sed/ }
expect(sed).to be_nil
echo = communicator.received_commands.find { |cmd| cmd =~ /^echo/ }
expect(echo).to_not be_nil
end
context "when the old fqdn has a trailing dot" do
let(:old_hostname) { 'oldhostname.withtrailing.dot.' }