provisioners/ansible: full test coverage of winrm

At the moment, the vagrant ssh username is used as default username when
force_remote_user option is disabled, even for winrm-communiating
machines. This could be improved in the future, but people hitting this
problem can easily work around it by syncing `config.ssh.unsername` and
`config.winrm.username` in their Vagrantfile.

ref #5086
This commit is contained in:
Gilles Cornu 2015-11-23 09:05:36 +01:00
parent e2f0d2ebb7
commit de96b54272
1 changed files with 15 additions and 0 deletions

View File

@ -406,6 +406,21 @@ VF
expect(inventory_content).to include("machine1 ansible_connection=winrm ansible_ssh_host=127.0.0.1 ansible_ssh_port=55986 ansible_ssh_user='winner' ansible_ssh_pass='winword'\n")
}
end
describe "with force_remote_user option disabled" do
before do
config.force_remote_user = false
end
it "doesn't set ansiber user in inventory and use '--user' arguemnt with the vagrant ssh username" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args|
inventory_content = File.read(generated_inventory_file)
expect(inventory_content).to include("machine1 ansible_connection=winrm ansible_ssh_host=127.0.0.1 ansible_ssh_port=55986 ansible_ssh_pass='winword'\n")
expect(args).to include("--user=testuser")
}
end
end
end
describe "with inventory_path option" do