From 2b9626f19c54a27fee0608f3504f767529fcc726 Mon Sep 17 00:00:00 2001 From: Max Lincoln Date: Tue, 22 Jul 2014 17:30:58 -0400 Subject: [PATCH] Use Winrm 1.2.0 and fix tests --- Gemfile | 2 - .../plugins/communicators/winrm/shell_test.rb | 2 +- test/unit/plugins/kernel_v2/config/vm_test.rb | 41 +++++++------------ vagrant.gemspec | 3 +- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index 7820e506f..15f245819 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source "https://rubygems.org" gemspec -# f4ece43: Allow the user to disable SSL peer verification. -gem 'winrm', git: 'https://github.com/WinRb/WinRM.git', ref: 'f4ece4384df2768bc7756c3c5c336db65b05c674' if File.exist?(File.expand_path("../../vagrant-spec", __FILE__)) gem 'vagrant-spec', path: "../vagrant-spec" diff --git a/test/unit/plugins/communicators/winrm/shell_test.rb b/test/unit/plugins/communicators/winrm/shell_test.rb index 477108b97..3948cf336 100644 --- a/test/unit/plugins/communicators/winrm/shell_test.rb +++ b/test/unit/plugins/communicators/winrm/shell_test.rb @@ -51,7 +51,7 @@ describe VagrantPlugins::CommunicatorWinRM::WinRMShell do it "should create endpoint options" do expect(subject.send(:endpoint_options)).to eq( { user: "username", pass: "password", host: "localhost", port: 5985, - operation_timeout: 60, basic_auth_only: true }) + operation_timeout: 60, basic_auth_only: true, no_ssl_peer_verification: true }) end end diff --git a/test/unit/plugins/kernel_v2/config/vm_test.rb b/test/unit/plugins/kernel_v2/config/vm_test.rb index 828753ad0..4683b01b7 100644 --- a/test/unit/plugins/kernel_v2/config/vm_test.rb +++ b/test/unit/plugins/kernel_v2/config/vm_test.rb @@ -23,6 +23,13 @@ describe VagrantPlugins::Kernel_V2::VMConfig do end end + def find_network(name) + network_definitions = subject.networks.map do |n| + n[1] + end + network_definitions.find {|n| n[:id] == name} + end + before do env = double("env") env.stub(root_path: nil) @@ -121,28 +128,6 @@ describe VagrantPlugins::Kernel_V2::VMConfig do end end - describe "#define" do - it "should allow regular names" do - subject.define "foo" - subject.finalize! - - assert_valid - end - - [ - "foo [1]", - "bar {2}", - "foo/bar", - ].each do |name| - it "should disallow names with brackets" do - subject.define name - subject.finalize! - - assert_invalid - end - end - end - describe "#guest" do it "is nil by default" do subject.finalize! @@ -183,16 +168,20 @@ describe VagrantPlugins::Kernel_V2::VMConfig do subject.finalize! n = subject.networks expect(n.length).to eq(2) + + # WinRM HTTP expect(n[0][0]).to eq(:forwarded_port) expect(n[0][1][:guest]).to eq(5985) expect(n[0][1][:host]).to eq(55985) expect(n[0][1][:host_ip]).to eq("127.0.0.1") expect(n[0][1][:id]).to eq("winrm") + # WinRM HTTPS expect(n[1][0]).to eq(:forwarded_port) - expect(n[1][1][:guest]).to eq(22) - expect(n[1][1][:host]).to eq(2222) - expect(n[1][1][:id]).to eq("ssh") + expect(n[1][1][:guest]).to eq(5986) + expect(n[1][1][:host]).to eq(55986) + expect(n[1][1][:host_ip]).to eq("127.0.0.1") + expect(n[1][1][:id]).to eq("winrmssl") end it "allows overriding SSH" do @@ -215,7 +204,7 @@ describe VagrantPlugins::Kernel_V2::VMConfig do subject.finalize! n = subject.networks - expect(n.length).to eq(2) + expect(n.length).to eq(1) expect(n[0][0]).to eq(:forwarded_port) expect(n[0][1][:guest]).to eq(22) expect(n[0][1][:host]).to eq(14100) diff --git a/vagrant.gemspec b/vagrant.gemspec index 4c4beebf6..4198452c4 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -28,8 +28,7 @@ Gem::Specification.new do |s| s.add_dependency "rb-kqueue", "~> 0.2.0" s.add_dependency "rest-client", ">= 1.6.0", "< 2.0" s.add_dependency "wdm", "~> 0.1.0" - # 1.1.4 (Unreleased) - #s.add_dependency "winrm", "~> 1.1.3" + s.add_dependency "winrm", "~> 1.2" # We lock this down to avoid compilation issues. s.add_dependency "nokogiri", "= 1.6.3.1"