vagrant-serverspec 1.5.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf819c978e49dc770304f6e13a05114333290b9ffdb93d396cbf43586dabe825
4
- data.tar.gz: d5b709e909e1c0390ee0ce6150b7c8c24b6749b3cd0d9d8b03feb5b6ab757d14
3
+ metadata.gz: 8c288ccbd9b65da16a59f54f59cd12c3fa85425fa22821aae9162e2a3404f424
4
+ data.tar.gz: 541eaab6e7a32ce102d4c3b959fa7cf4f9c039959b6b31ae6e90e701587c6726
5
5
  SHA512:
6
- metadata.gz: 0f29e2e30ccfd2260dcd637afc6a653e2aa567a2c154240228c95c74abb24bbde9ff5aec3daeb0bd5a636e6ada3d814381316d2fd0b31294d41aa3fdf4688c46
7
- data.tar.gz: b6eae77de546da3570a0b3e30eb299ed2b78adf514adb5702b0aa0b35af721a7cbbc2c941ada26e807e51638a4a90ba6b7381c60be89b2d4c90d4a66a15b582b
6
+ metadata.gz: bd9a2765198cb98ac0f67d6c2abfbef1f8394ff79827f3088b3de6d5f7212d31a215c87910edc7f3a9e74cbf4681a7476dd07123252b4ce7be75bebdc0cd0f9e
7
+ data.tar.gz: 6f94bf95e45b0682f57d0f597248fb5163b3de0445635d6ad03d24695fe30dbe145acb0f9d709ae96f8faa4da221bedb6b6c0f10ec72f395c34e585adf1fc6cd
data/.gitignore CHANGED
@@ -9,4 +9,9 @@
9
9
  .bundle
10
10
  pkg
11
11
  tags
12
- Gemfile.lock
12
+ Gemfile.lock
13
+ vendor/
14
+
15
+ # test output
16
+ rspec_html_reports/
17
+ rspec.xml
@@ -1,2 +1,3 @@
1
+ --require spec_helper
1
2
  --color
2
3
  --format documentation
data/CHANGELOG.md CHANGED
@@ -1,17 +1,59 @@
1
- ### v 1.5.1 Mar 02, 2020
1
+
2
+ ### v 2.0.0 Nov 04, 2026
3
+
4
+ Major version: the plugin now targets Vagrant 2.4.x / Ruby 3.x. Closes all open
5
+ Dependabot alerts (bundler 1.x, activesupport 5.2).
6
+
7
+ **Breaking**
8
+ * Requires Ruby >= 3.0 (Vagrant 2.4.x supports Ruby 3.0 - 3.4).
9
+ * `html_output` now uses RSpec's built-in HTML formatter. The report is still
10
+ written to `rspec_html_reports/overview.html`, but it looks different from the
11
+ old `rspec_html_formatter` report. That gem is unmaintained and crashes on
12
+ Ruby >= 3.2 (`File.exists?` was removed), so it is dropped together with its
13
+ `activesupport` dependency.
14
+ * Dropped unused runtime dependencies: `activesupport`, `os`.
15
+ * Dropped `bundler ~> 1.17` development dependency.
16
+
17
+ **Dependencies**
18
+ * serverspec `~> 2.43`
19
+ * winrm `~> 2.3, >= 2.3.9` (range accepted by Vagrant 2.4.x)
20
+ * rspec_junit_formatter `~> 0.6`
21
+ * rake `~> 13.0` (development)
22
+ * Gemfile: Vagrant is installed from rubygems.org (`~> 2.4`) instead of `git://github.com/hashicorp/vagrant`
23
+
24
+ **Fixes**
25
+ * Docker provider: the SSH ProxyCommand through the host VM was never enabled
26
+ because the provider class name was compared with `'DockerProvider'` instead
27
+ of `VagrantPlugins::DockerProvider::Provider`.
28
+
29
+ **Tooling**
30
+ * Added an RSpec unit test suite (`spec/`) and a GitHub Actions workflow that
31
+ runs it on Ruby 3.1 - 3.4, builds the gem, installs it into Vagrant and
32
+ validates the sample Vagrantfile.
33
+ * Gem publish workflow now runs on `v*` tags, uses `ruby/setup-ruby`
34
+ (`actions/setup-ruby` is archived) and publishes through RubyGems trusted
35
+ publishing (OIDC) instead of a stored API key.
36
+
37
+ ### v 1.5.3 (unreleased)
38
+ * fix: SSH Proxy command with Docker is only used when the host VM is enabled
39
+
40
+ ### v 1.5.2 Oct 02, 2020
41
+ * Add 'exclude_pattern' option
42
+
43
+ ### v 1.5.1 Mar 02, 2020
2
44
  * Security, update rake build dependency version to 12.3.3
3
45
 
4
- ### v 1.5.0 Nov 25, 2019
5
- * Add a new junit formatter
46
+ ### v 1.5.0 Nov 25, 2019
47
+ * Add a new junit formatter
6
48
 
7
49
  ### v 1.4.0 Nov 1, 2019 (not released)
8
50
  * Fix vagrant-serverspec dependencies to work with Vagrant 2.2.6
9
51
 
10
52
  ### v 1.3.0 Sep 24, 2017
11
- * Add new options 'error_no_spec_files' to avoid error when no rspec conf files was found
53
+ * Add new options 'error_no_spec_files' to avoid error when no rspec conf files was found
12
54
 
13
55
  ### v 1.2.0 Mar 27, 2017
14
- * Provide compatibility with vagrant 1.9.2
56
+ * Provide compatibility with vagrant 1.9.2
15
57
  * Updated .gemspec to the recommended winrm version 2.x
16
58
  * Updated WinRM::Connection instead of WinRM::WebService
17
59
  * Updated `WINDOWS_README.md`
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gemspec
4
+
3
5
  group :development do
4
- gem 'vagrant', git: 'git://github.com/hashicorp/vagrant', tag: 'v2.2.6'
6
+ # Vagrant is published on rubygems.org since 2.3.x; no need to pull it from git anymore.
7
+ gem 'vagrant', '~> 2.4', '>= 2.4.0'
5
8
  end
6
-
7
- gemspec
data/README.md CHANGED
@@ -6,6 +6,10 @@
6
6
  > **vagrant-serverspec is a [vagrant][vagrant] plugin that implements
7
7
  > [serverspec][serverspec] as a provisioner.**
8
8
 
9
+ ## Requirements
10
+
11
+ * Vagrant 2.4.x (Ruby 3.0 - 3.4). For Vagrant 2.2.x use vagrant-serverspec 1.5.x.
12
+
9
13
  ## Installing
10
14
  ### Standard way
11
15
  First, install the plugin.
@@ -24,7 +28,7 @@ C:\HashiCorp\Vagrant\embedded\bin\gem.bat build vagrant-serverspec.gemspec
24
28
  ```
25
29
  after that install plugin from filesystem
26
30
  ```shell
27
- vagrant plugin install ./vagrant-serverspec-0.5.0.gem
31
+ vagrant plugin install ./vagrant-serverspec-2.0.0.gem
28
32
  ```
29
33
 
30
34
  ## Example Usage
@@ -48,7 +52,7 @@ Vagrant.configure('2') do |config|
48
52
  spec.exclude_pattern = 'but_not_*_spec.rb'
49
53
  # disable error if no specfile was found ( useful with dynamic specfile retrieving through another provisionner like Ansible Galaxy => specfiles can be saved into ansible role repository for example ). Default: true
50
54
  spec.error_no_spec_files = false
51
- # save result into html an report, saved into a 'rspec_html_reports' directory. Default: false
55
+ # save result into an html report (RSpec's built-in html formatter), written to 'rspec_html_reports/overview.html'. Default: false
52
56
  spec.html_output = true
53
57
  # save result into junit xml report, default file name is 'rspec.xml'
54
58
  spec.junit_output = true
@@ -65,7 +69,7 @@ You may want to override standard settings; a file named `spec_helper.rb` is usu
65
69
  # set :disable_sudo, true
66
70
 
67
71
  # Set environment variables
68
- # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
72
+ # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
69
73
 
70
74
  # Set PATH
71
75
  # set :path, '/sbin:/usr/local/sbin:$PATH'
@@ -90,8 +94,16 @@ describe port(22) do
90
94
  end
91
95
  ```
92
96
 
93
- ##Testing Docker Containers on OSX
94
- On OSX the Vagrant docker provider runs a Boot2Docker VM, then launches your docker container on that VM. Vagrant does SSH Proxying to send the commands through that VM and have them reach the Docker Container. Vagrant serverspec handles this the same way by getting the container host VM infromation and proxying the commands to the machine through an SSH Proxy. This functionality was introduced in this [PR](https://github.com/vvchik/vagrant-serverspec/pull/17)
97
+ ## Docker Provider
98
+
99
+ When using the [Docker provider](https://www.vagrantup.com/docs/providers/docker), Vagrant allows to either use the local Docker Engine
100
+ or to spin up an [Host VM](https://www.vagrantup.com/docs/providers/docker/basics#host-vm) to host the Docker Engine.
101
+
102
+ Vagrant serverspec handles both cases, in particular the Host VM by getting its informations and proxying the commands to the container through an SSH Proxy.
103
+ This functionality was introduced in this [PR](https://github.com/vvchik/vagrant-serverspec/pull/17).
104
+
105
+ The SSH Proxy is used when the attribute [`force_host_vm`](https://www.vagrantup.com/docs/providers/docker/configuration#force_host_vm) is set to true
106
+ (auto-detected by Vagrant by default, or defined in your `Vagrantfile`).
95
107
 
96
108
  ## Additional informations
97
109
 
@@ -124,6 +136,17 @@ vagrant-serverspec aims to adhere to [Semantic Versioning 2.0.0][semver].
124
136
  * Source hosted at [GitHub][repo]
125
137
  * Report issues/questions/feature requests on [GitHub Issues][issues]
126
138
 
139
+ Running the test suite:
140
+
141
+ ```shell
142
+ bundle install
143
+ bundle exec rspec
144
+ ```
145
+
146
+ Releasing: bump `lib/vagrant-serverspec/version.rb` and `CHANGELOG.md`, merge to
147
+ `master`, then push a `vX.Y.Z` tag. GitHub Actions publishes the gem to
148
+ rubygems.org via trusted publishing and creates the GitHub release.
149
+
127
150
  Pull requests are very welcome! Make sure your patches are well tested.
128
151
  Ideally create a topic branch for every separate change you make. For
129
152
  example:
@@ -136,8 +159,8 @@ example:
136
159
 
137
160
  ## Authors
138
161
 
139
- Original Idea [Jeremy Voorhis][jvoorhis] (<jvoorhis@gmail.com>).
140
- Current version author and maintainer [Vladimir Babchynskyy][vvchik] (<vvchik@gmail.com>)
162
+ Original Idea [Jeremy Voorhis][jvoorhis] (<jvoorhis@gmail.com>).
163
+ Current version author and maintainer [Vladimir Babchynskyy][vvchik] (<vvchik@gmail.com>)
141
164
  and a growing community of [contributors][contributors].
142
165
 
143
166
  ## License
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
- require 'bundler/gem_helper'
1
+ require 'bundler/gem_tasks' # build, install, release (used by rubygems/release-gem in CI)
2
+ require 'rspec/core/rake_task'
2
3
 
3
- namespace :gem do
4
- Bundler::GemHelper.install_tasks
5
- end
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -4,8 +4,8 @@ require 'pathname'
4
4
  require 'winrm'
5
5
  require 'net/ssh'
6
6
  require 'net/ssh/proxy/command'
7
- require 'os'
8
- module VagrantPlugins
7
+
8
+ module VagrantPlugins
9
9
  module ServerSpec
10
10
  class Plugin < Vagrant.plugin('2')
11
11
  name 'serverspec'
@@ -4,6 +4,8 @@
4
4
  module VagrantPlugins
5
5
  module ServerSpec
6
6
  class Provisioner < Vagrant.plugin('2', :provisioner)
7
+ HTML_REPORT_DIR = 'rspec_html_reports'.freeze
8
+
7
9
  def initialize(machine, config)
8
10
  super
9
11
  @spec_files = config.spec_files
@@ -15,7 +17,6 @@ module VagrantPlugins
15
17
 
16
18
  def provision
17
19
  if machine.config.vm.communicator == :winrm
18
- username = machine.config.winrm.username
19
20
  winrm_info = VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(@machine)
20
21
  set :backend, :winrm
21
22
  set :os, :family => 'windows'
@@ -55,7 +56,7 @@ module VagrantPlugins
55
56
  host = machine.ssh_info[:host]
56
57
  options = Net::SSH::Config.for(host)
57
58
 
58
- options[:proxy] = setup_provider_proxy if use_jump_provider?
59
+ options[:proxy] = setup_provider_proxy if use_proxy?
59
60
  options[:user] = machine.ssh_info[:username]
60
61
  options[:port] = machine.ssh_info[:port]
61
62
  options[:keys] = machine.ssh_info[:private_key_path]
@@ -80,9 +81,12 @@ module VagrantPlugins
80
81
  require 'rspec'
81
82
 
82
83
  if config.html_output_format
83
- require 'rspec_html_formatter'
84
+ # RSpec's built-in HTML formatter. The third-party rspec_html_formatter
85
+ # gem used before 2.0 is unmaintained and does not run on Ruby >= 3.2.
86
+ require 'fileutils'
87
+ FileUtils.mkdir_p(HTML_REPORT_DIR)
84
88
 
85
- rconfig.add_formatter "RspecHtmlFormatter"
89
+ rconfig.add_formatter 'html', File.join(HTML_REPORT_DIR, 'overview.html')
86
90
  end
87
91
 
88
92
  if config.junit_output_format
@@ -124,22 +128,11 @@ module VagrantPlugins
124
128
  Net::SSH::Proxy::Command.new("ssh #{proxy_options} -i #{key_path} -p #{port} #{username}@#{host} nc %h %p")
125
129
  end
126
130
 
127
- def use_jump_provider?
128
- jump_providers = [
129
- {
130
- name: "DockerProvider",
131
- platforms: ["mac"]
132
- }
133
- ]
134
- current_provider_class = machine.provider.class.name.to_s
131
+ def use_proxy?
132
+ # Vagrant's Docker provider class is VagrantPlugins::DockerProvider::Provider
133
+ return false unless machine.provider.class.name.to_s.include?('DockerProvider')
135
134
 
136
- jump_providers.any? do |jump_provider|
137
- if current_provider_class.include? jump_provider[:name]
138
- jump_provider[:platforms].any? do |platform|
139
- OS.send("#{platform}?")
140
- end
141
- end
142
- end
135
+ machine.provider.config.force_host_vm ? true : false
143
136
  end
144
137
  end
145
138
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ServerSpec
3
- VERSION = '1.5.2'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
@@ -0,0 +1,121 @@
1
+ require 'spec_helper'
2
+ require 'tmpdir'
3
+
4
+ describe VagrantPlugins::ServerSpec::Config do
5
+ subject(:config) { described_class.new }
6
+
7
+ let(:machine) { double('machine') }
8
+
9
+ around do |example|
10
+ Dir.mktmpdir('vagrant-serverspec') do |dir|
11
+ Dir.chdir(dir) do
12
+ FileUtils.mkdir_p('spec')
13
+ File.write('spec/a_spec.rb', '')
14
+ File.write('spec/b_spec.rb', '')
15
+ File.write('spec/skip_me_spec.rb', '')
16
+ example.run
17
+ end
18
+ end
19
+ end
20
+
21
+ describe 'defaults' do
22
+ before { config.finalize! }
23
+
24
+ it 'has no spec files' do
25
+ expect(config.spec_files).to eq([])
26
+ end
27
+
28
+ it 'enables error_no_spec_files' do
29
+ expect(config.error_no_spec_files_found).to be(true)
30
+ end
31
+
32
+ it 'disables html and junit output' do
33
+ expect(config.html_output_format).to be(false)
34
+ expect(config.junit_output_format).to be(false)
35
+ expect(config.junit_output_format_file_name).to be(false)
36
+ end
37
+
38
+ it 'fails validation because there are no spec files' do
39
+ result = config.validate(machine)
40
+ expect(result['serverspec provisioner']).to include('You must list at least one spec file')
41
+ end
42
+ end
43
+
44
+ describe '#pattern=' do
45
+ it 'globs the matching files' do
46
+ config.pattern = 'spec/*_spec.rb'
47
+ config.finalize!
48
+
49
+ expect(config.spec_pattern).to eq('spec/*_spec.rb')
50
+ expect(config.spec_files).to contain_exactly('spec/a_spec.rb', 'spec/b_spec.rb', 'spec/skip_me_spec.rb')
51
+ end
52
+
53
+ it 'passes validation when files exist' do
54
+ config.pattern = 'spec/*_spec.rb'
55
+ config.finalize!
56
+
57
+ expect(config.validate(machine)).to eq('serverspec provisioner' => [])
58
+ end
59
+
60
+ it 'reports missing files' do
61
+ config.spec_files = ['spec/does_not_exist_spec.rb']
62
+ config.finalize!
63
+
64
+ errors = config.validate(machine)['serverspec provisioner']
65
+ expect(errors.join).to include('spec/does_not_exist_spec.rb')
66
+ end
67
+ end
68
+
69
+ describe '#exclude_pattern=' do
70
+ it 'removes excluded files from the list' do
71
+ config.pattern = 'spec/*_spec.rb'
72
+ config.exclude_pattern = 'spec/skip_*_spec.rb'
73
+ config.finalize!
74
+
75
+ expect(config.spec_excluded_files).to eq(['spec/skip_me_spec.rb'])
76
+ expect(config.spec_files).to contain_exactly('spec/a_spec.rb', 'spec/b_spec.rb')
77
+ end
78
+ end
79
+
80
+ describe '#error_no_spec_files=' do
81
+ it 'accepts booleans only' do
82
+ config.error_no_spec_files = false
83
+ config.error_no_spec_files = 'yes'
84
+ config.finalize!
85
+ expect(config.error_no_spec_files_found).to be(false)
86
+ end
87
+
88
+ it 'returns nil from validate when disabled' do
89
+ config.error_no_spec_files = false
90
+ config.finalize!
91
+ expect(config.validate(machine)).to be_nil
92
+ end
93
+ end
94
+
95
+ describe 'output formats' do
96
+ it 'accepts html_output and junit_output flags' do
97
+ config.html_output = true
98
+ config.junit_output = true
99
+ config.finalize!
100
+ expect(config.html_output_format).to be(true)
101
+ expect(config.junit_output_format).to be(true)
102
+ end
103
+
104
+ it 'ignores non-boolean values' do
105
+ config.html_output = 'true'
106
+ config.junit_output = 1
107
+ config.finalize!
108
+ expect(config.html_output_format).to be(false)
109
+ expect(config.junit_output_format).to be(false)
110
+ end
111
+
112
+ it 'accepts only .xml junit file names' do
113
+ config.junit_output_file = 'report.txt'
114
+ config.finalize!
115
+ expect(config.junit_output_format_file_name).to be(false)
116
+
117
+ config.junit_output_file = 'report.xml'
118
+ expect(config.junit_output_format_file_name).to eq('report.xml')
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,241 @@
1
+ require 'spec_helper'
2
+ require 'tmpdir'
3
+
4
+ describe VagrantPlugins::ServerSpec::Provisioner do
5
+ let(:ssh_info) do
6
+ {
7
+ host: '192.0.2.10',
8
+ port: 2222,
9
+ username: 'vagrant',
10
+ private_key_path: ['/tmp/insecure_private_key'],
11
+ password: nil,
12
+ }
13
+ end
14
+
15
+ let(:provider_config) { double('provider_config', force_host_vm: false) }
16
+ let(:provider) { double('provider', config: provider_config) }
17
+ let(:vm_config) { double('vm_config', communicator: :ssh) }
18
+ let(:machine_config) { double('machine_config', vm: vm_config) }
19
+ let(:machine) do
20
+ double('machine', config: machine_config, ssh_info: ssh_info, provider: provider)
21
+ end
22
+
23
+ let(:config) do
24
+ VagrantPlugins::ServerSpec::Config.new.tap do |c|
25
+ c.pattern = 'spec/*_spec.rb'
26
+ c.finalize!
27
+ end
28
+ end
29
+
30
+ let(:rspec_config) { double('rspec_config') }
31
+ let(:runner_status) { 0 }
32
+
33
+ subject(:provisioner) { described_class.new(machine, config) }
34
+
35
+ around do |example|
36
+ Dir.mktmpdir('vagrant-serverspec') do |dir|
37
+ Dir.chdir(dir) do
38
+ FileUtils.mkdir_p('spec')
39
+ File.write('spec/one_spec.rb', '')
40
+ File.write('spec/two_spec.rb', '')
41
+ File.write('spec/exclude_me_spec.rb', '')
42
+ example.run
43
+ end
44
+ end
45
+ end
46
+
47
+ before do
48
+ # Never let the provisioner touch the RSpec runtime that executes this suite.
49
+ allow(RSpec).to receive(:clear_examples)
50
+ allow(RSpec).to receive(:configure).and_yield(rspec_config)
51
+ allow(RSpec::Core::Runner).to receive(:run).and_return(runner_status)
52
+ allow(rspec_config).to receive(:add_formatter)
53
+
54
+ # Start from a clean Specinfra ssh connection state.
55
+ Specinfra::Backend::Ssh.instance.set_config(:ssh, nil)
56
+ end
57
+
58
+ def provider_class(name)
59
+ klass = Class.new
60
+ allow(klass).to receive(:name).and_return(name)
61
+ klass
62
+ end
63
+
64
+ describe 'ssh backend' do
65
+ before { allow(provider).to receive(:class).and_return(provider_class('VagrantPlugins::ProviderVirtualBox::Provider')) }
66
+
67
+ it 'configures specinfra from machine.ssh_info and runs the spec files' do
68
+ provisioner.provision
69
+
70
+ expect(Specinfra.configuration.backend).to eq(:ssh)
71
+ expect(Specinfra.configuration.host).to eq('192.0.2.10')
72
+
73
+ opts = Specinfra.configuration.ssh_options
74
+ expect(opts[:user]).to eq('vagrant')
75
+ expect(opts[:port]).to eq(2222)
76
+ expect(opts[:keys]).to eq(['/tmp/insecure_private_key'])
77
+ expect(opts).not_to have_key(:proxy)
78
+
79
+ expect(RSpec::Core::Runner).to have_received(:run)
80
+ .with(a_collection_containing_exactly('spec/one_spec.rb', 'spec/two_spec.rb', 'spec/exclude_me_spec.rb'))
81
+ end
82
+
83
+ it 'honours exclude_pattern' do
84
+ config.exclude_pattern = 'spec/exclude_*_spec.rb'
85
+ config.finalize!
86
+
87
+ provisioner.provision
88
+
89
+ expect(RSpec::Core::Runner).to have_received(:run)
90
+ .with(a_collection_containing_exactly('spec/one_spec.rb', 'spec/two_spec.rb'))
91
+ end
92
+
93
+ it 'clears the examples before running' do
94
+ provisioner.provision
95
+ expect(RSpec).to have_received(:clear_examples)
96
+ end
97
+
98
+ it 'closes a stale specinfra ssh connection' do
99
+ stale = double('ssh', close: nil)
100
+ Specinfra::Backend::Ssh.instance.set_config(:ssh, stale)
101
+
102
+ provisioner.provision
103
+
104
+ expect(stale).to have_received(:close)
105
+ expect(Specinfra::Backend::Ssh.instance.get_config(:ssh)).to be_nil
106
+ end
107
+
108
+ it 'uses SUDO_PASSWORD from the environment' do
109
+ begin
110
+ ENV['SUDO_PASSWORD'] = 's3cret'
111
+ provisioner.provision
112
+ expect(Specinfra.configuration.sudo_password).to eq('s3cret')
113
+ ensure
114
+ ENV.delete('SUDO_PASSWORD')
115
+ set :sudo_password, nil
116
+ end
117
+ end
118
+
119
+ context 'when the suite fails' do
120
+ let(:runner_status) { 1 }
121
+
122
+ it 'raises ServerSpecFailed' do
123
+ expect { provisioner.provision }.to raise_error(Vagrant::Errors::ServerSpecFailed)
124
+ end
125
+
126
+ it 'raises ServerSpecFailedHtml with html output' do
127
+ config.html_output = true
128
+ expect { provisioner.provision }.to raise_error(Vagrant::Errors::ServerSpecFailedHtml)
129
+ end
130
+
131
+ it 'raises ServerSpecFailedJunit with junit output' do
132
+ config.junit_output = true
133
+ expect { provisioner.provision }.to raise_error(Vagrant::Errors::ServerSpecFailedJunit)
134
+ end
135
+
136
+ it 'raises ServerSpecFailedHtmlJunit with both outputs' do
137
+ config.html_output = true
138
+ config.junit_output = true
139
+ expect { provisioner.provision }.to raise_error(Vagrant::Errors::ServerSpecFailedHtmlJunit)
140
+ end
141
+ end
142
+
143
+ context 'formatters' do
144
+ it 'adds the built-in html formatter writing to rspec_html_reports/overview.html' do
145
+ config.html_output = true
146
+ provisioner.provision
147
+ expect(rspec_config).to have_received(:add_formatter).with('html', 'rspec_html_reports/overview.html')
148
+ expect(File).to be_directory('rspec_html_reports')
149
+ end
150
+
151
+ it 'adds the junit formatter with the default file name' do
152
+ config.junit_output = true
153
+ provisioner.provision
154
+ expect(rspec_config).to have_received(:add_formatter).with('RSpecJUnitFormatter', 'rspec.xml')
155
+ end
156
+
157
+ it 'adds the junit formatter with a custom file name' do
158
+ config.junit_output = true
159
+ config.junit_output_file = 'reports/out.xml'
160
+ provisioner.provision
161
+ expect(rspec_config).to have_received(:add_formatter).with('RSpecJUnitFormatter', 'reports/out.xml')
162
+ end
163
+ end
164
+
165
+ context 'no spec files' do
166
+ it 'raises ServerSpecFilesNotFound when the pattern matches nothing' do
167
+ config.pattern = 'spec/nothing_here_*.rb'
168
+ config.finalize!
169
+ expect { provisioner.provision }.to raise_error(Vagrant::Errors::ServerSpecFilesNotFound)
170
+ end
171
+
172
+ it 'does not raise when error_no_spec_files is false' do
173
+ config.pattern = 'spec/nothing_here_*.rb'
174
+ config.error_no_spec_files = false
175
+ config.finalize!
176
+ expect { provisioner.provision }.not_to raise_error
177
+ expect(RSpec::Core::Runner).to have_received(:run).with([])
178
+ end
179
+ end
180
+ end
181
+
182
+ describe 'docker provider with host VM' do
183
+ let(:host_vm_ssh_info) do
184
+ { host: '10.0.0.5', port: 22, username: 'docker', private_key_path: ['/tmp/host_vm_key'] }
185
+ end
186
+ let(:host_vm) { double('host_vm', ssh_info: host_vm_ssh_info) }
187
+
188
+ before do
189
+ allow(provider).to receive(:class).and_return(provider_class('VagrantPlugins::DockerProvider::Provider'))
190
+ allow(provider).to receive(:host_vm).and_return(host_vm)
191
+ end
192
+
193
+ it 'adds an ssh ProxyCommand through the host VM when force_host_vm is set' do
194
+ allow(provider_config).to receive(:force_host_vm).and_return(true)
195
+
196
+ provisioner.provision
197
+
198
+ proxy = Specinfra.configuration.ssh_options[:proxy]
199
+ expect(proxy).to be_a(Net::SSH::Proxy::Command)
200
+ expect(proxy.command_line_template).to include('-i /tmp/host_vm_key -p 22 docker@10.0.0.5 nc %h %p')
201
+ end
202
+
203
+ it 'does not use a proxy when force_host_vm is false' do
204
+ provisioner.provision
205
+ expect(Specinfra.configuration.ssh_options).not_to have_key(:proxy)
206
+ end
207
+ end
208
+
209
+ describe 'winrm backend' do
210
+ let(:vm_config) { double('vm_config', communicator: :winrm) }
211
+ let(:winrm_config) { double('winrm', username: 'vagrant', password: 'vagrant', timeout: 1800) }
212
+ let(:machine_config) { double('machine_config', vm: vm_config, winrm: winrm_config) }
213
+
214
+ before do
215
+ allow(provider).to receive(:class).and_return(provider_class('VagrantPlugins::HyperV::Provider'))
216
+ allow(VagrantPlugins::CommunicatorWinRM::Helper).to receive(:winrm_info)
217
+ .with(machine).and_return(host: '192.0.2.20', port: 5985)
218
+ end
219
+
220
+ after do
221
+ # Leave a clean ssh backend for the other examples.
222
+ set :backend, :ssh
223
+ Specinfra.configuration.winrm = nil
224
+ end
225
+
226
+ it 'configures a WinRM connection for specinfra' do
227
+ provisioner.provision
228
+
229
+ expect(Specinfra.configuration.backend).to eq(:winrm)
230
+ expect(Specinfra.configuration.os).to include(family: 'windows')
231
+
232
+ conn = Specinfra.configuration.winrm
233
+ expect(conn).to be_a(WinRM::Connection)
234
+ opts = conn.instance_variable_get(:@connection_opts)
235
+ expect(opts[:endpoint]).to eq('http://192.0.2.20:5985/wsman')
236
+ expect(opts[:user]).to eq('vagrant')
237
+ expect(opts[:password]).to eq('vagrant')
238
+ expect(opts[:operation_timeout]).to eq(1800)
239
+ end
240
+ end
241
+ end
@@ -0,0 +1,22 @@
1
+ require 'vagrant'
2
+ require 'vagrant-serverspec'
3
+ # Vagrant loads these lazily from the plugin's config/provisioner blocks.
4
+ require 'vagrant-serverspec/config'
5
+ require 'vagrant-serverspec/provisioner'
6
+
7
+ RSpec.configure do |config|
8
+ config.expect_with :rspec do |expectations|
9
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
10
+ end
11
+
12
+ config.mock_with :rspec do |mocks|
13
+ mocks.verify_partial_doubles = true
14
+ end
15
+
16
+ config.order = :random
17
+ Kernel.srand config.seed
18
+ end
19
+
20
+ # Vagrant's communicators are only loaded when a machine is created;
21
+ # the provisioner's winrm code path needs the real helper.
22
+ require Vagrant.source_root.join('plugins/communicators/winrm/helper').to_s
@@ -12,19 +12,26 @@ Gem::Specification.new do |gem|
12
12
  gem.description = "vagrant-serverspec is a Vagrant plugin that integrates serverspec into your workflow."
13
13
  gem.license = 'MIT'
14
14
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.metadata = {
16
+ 'homepage_uri' => gem.homepage,
17
+ 'source_code_uri' => gem.homepage,
18
+ 'changelog_uri' => "#{gem.homepage}/blob/master/CHANGELOG.md",
19
+ 'bug_tracker_uri' => "#{gem.homepage}/issues",
20
+ }
21
+
22
+ # Vagrant 2.4.x supports Ruby 3.0 - 3.4
23
+ gem.required_ruby_version = '>= 3.0'
24
+
25
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('test/', '.github/') }
17
26
  gem.require_paths = ['lib']
18
27
 
19
- gem.add_runtime_dependency 'serverspec', '~> 2.30', '>= 2.30'
28
+ gem.add_runtime_dependency 'serverspec', '~> 2.43'
20
29
 
21
- #add only dependencies for winrm without nokogiri
22
- gem.add_runtime_dependency 'winrm', '~> 2.1', '>= 2.1'
23
- gem.add_runtime_dependency 'os', '~> 0.9.6'
24
- gem.add_runtime_dependency 'rspec_html_formatter', '~> 0.3', '>= 0.3.1'
25
- gem.add_runtime_dependency 'rspec_junit_formatter', '~> 0.4'
26
- gem.add_runtime_dependency 'activesupport', '~> 5.2.3', '>= 5.2'
30
+ # Keep winrm in the range accepted by Vagrant 2.4.x (>= 2.3.9, < 3.0)
31
+ gem.add_runtime_dependency 'winrm', '~> 2.3', '>= 2.3.9'
32
+ # HTML output uses RSpec's built-in html formatter (no extra gem needed).
33
+ gem.add_runtime_dependency 'rspec_junit_formatter', '~> 0.6'
27
34
 
28
- gem.add_development_dependency 'bundler', '~> 1.17.3', '>= 1.17'
29
- gem.add_development_dependency "rake", ">= 12.3.3"
35
+ gem.add_development_dependency 'rake', '~> 13.0'
36
+ gem.add_development_dependency 'rspec', '~> 3.12'
30
37
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Voorhis
8
8
  - Vladimir Babchynskyy
9
9
  - 'community contributors: https://github.com/vvchik/vagrant-serverspec/graphs/contributors'
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-02 00:00:00.000000000 Z
13
+ date: 2026-11-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: serverspec
@@ -18,142 +18,76 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '2.30'
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: '2.30'
21
+ version: '2.43'
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
26
  - - "~>"
30
27
  - !ruby/object:Gem::Version
31
- version: '2.30'
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '2.30'
28
+ version: '2.43'
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: winrm
37
31
  requirement: !ruby/object:Gem::Requirement
38
32
  requirements:
39
33
  - - "~>"
40
34
  - !ruby/object:Gem::Version
41
- version: '2.1'
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: '2.1'
45
- type: :runtime
46
- prerelease: false
47
- version_requirements: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - "~>"
50
- - !ruby/object:Gem::Version
51
- version: '2.1'
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '2.1'
55
- - !ruby/object:Gem::Dependency
56
- name: os
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.9.6
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.9.6
69
- - !ruby/object:Gem::Dependency
70
- name: rspec_html_formatter
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.3'
35
+ version: '2.3'
76
36
  - - ">="
77
37
  - !ruby/object:Gem::Version
78
- version: 0.3.1
38
+ version: 2.3.9
79
39
  type: :runtime
80
40
  prerelease: false
81
41
  version_requirements: !ruby/object:Gem::Requirement
82
42
  requirements:
83
43
  - - "~>"
84
44
  - !ruby/object:Gem::Version
85
- version: '0.3'
45
+ version: '2.3'
86
46
  - - ">="
87
47
  - !ruby/object:Gem::Version
88
- version: 0.3.1
48
+ version: 2.3.9
89
49
  - !ruby/object:Gem::Dependency
90
50
  name: rspec_junit_formatter
91
51
  requirement: !ruby/object:Gem::Requirement
92
52
  requirements:
93
53
  - - "~>"
94
54
  - !ruby/object:Gem::Version
95
- version: '0.4'
55
+ version: '0.6'
96
56
  type: :runtime
97
57
  prerelease: false
98
58
  version_requirements: !ruby/object:Gem::Requirement
99
59
  requirements:
100
60
  - - "~>"
101
61
  - !ruby/object:Gem::Version
102
- version: '0.4'
62
+ version: '0.6'
103
63
  - !ruby/object:Gem::Dependency
104
- name: activesupport
64
+ name: rake
105
65
  requirement: !ruby/object:Gem::Requirement
106
66
  requirements:
107
67
  - - "~>"
108
68
  - !ruby/object:Gem::Version
109
- version: 5.2.3
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '5.2'
113
- type: :runtime
69
+ version: '13.0'
70
+ type: :development
114
71
  prerelease: false
115
72
  version_requirements: !ruby/object:Gem::Requirement
116
73
  requirements:
117
74
  - - "~>"
118
75
  - !ruby/object:Gem::Version
119
- version: 5.2.3
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '5.2'
76
+ version: '13.0'
123
77
  - !ruby/object:Gem::Dependency
124
- name: bundler
78
+ name: rspec
125
79
  requirement: !ruby/object:Gem::Requirement
126
80
  requirements:
127
81
  - - "~>"
128
82
  - !ruby/object:Gem::Version
129
- version: 1.17.3
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '1.17'
83
+ version: '3.12'
133
84
  type: :development
134
85
  prerelease: false
135
86
  version_requirements: !ruby/object:Gem::Requirement
136
87
  requirements:
137
88
  - - "~>"
138
89
  - !ruby/object:Gem::Version
139
- version: 1.17.3
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: '1.17'
143
- - !ruby/object:Gem::Dependency
144
- name: rake
145
- requirement: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: 12.3.3
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: 12.3.3
90
+ version: '3.12'
157
91
  description: vagrant-serverspec is a Vagrant plugin that integrates serverspec into
158
92
  your workflow.
159
93
  email:
@@ -162,8 +96,8 @@ executables: []
162
96
  extensions: []
163
97
  extra_rdoc_files: []
164
98
  files:
165
- - ".github/workflows/gempush.yml"
166
99
  - ".gitignore"
100
+ - ".rspec"
167
101
  - CHANGELOG.md
168
102
  - Gemfile
169
103
  - LICENSE
@@ -177,26 +111,19 @@ files:
177
111
  - lib/vagrant-serverspec/provisioner.rb
178
112
  - lib/vagrant-serverspec/version.rb
179
113
  - locales/en.yml
180
- - test/Docker/.rspec
181
- - test/Docker/Docker_Vagrantfile
182
- - test/Docker/Vagrantfile
183
- - test/Docker/sample_spec.rb
184
- - test/Docker/spec_helper.rb
185
- - test/ubuntu/.rspec
186
- - test/ubuntu/Vagrantfile
187
- - test/ubuntu/exclude_this_spec.rb
188
- - test/ubuntu/sample_spec.rb
189
- - test/ubuntu/spec_helper.rb
190
- - test/windows/.rspec
191
- - test/windows/sample_spec.rb
192
- - test/windows/spec_helper.rb
193
- - test/windows/vagrantfile
114
+ - spec/config_spec.rb
115
+ - spec/provisioner_spec.rb
116
+ - spec/spec_helper.rb
194
117
  - vagrant-serverspec.gemspec
195
118
  homepage: https://github.com/vvchik/vagrant-serverspec
196
119
  licenses:
197
120
  - MIT
198
- metadata: {}
199
- post_install_message:
121
+ metadata:
122
+ homepage_uri: https://github.com/vvchik/vagrant-serverspec
123
+ source_code_uri: https://github.com/vvchik/vagrant-serverspec
124
+ changelog_uri: https://github.com/vvchik/vagrant-serverspec/blob/master/CHANGELOG.md
125
+ bug_tracker_uri: https://github.com/vvchik/vagrant-serverspec/issues
126
+ post_install_message:
200
127
  rdoc_options: []
201
128
  require_paths:
202
129
  - lib
@@ -204,29 +131,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
131
  requirements:
205
132
  - - ">="
206
133
  - !ruby/object:Gem::Version
207
- version: '0'
134
+ version: '3.0'
208
135
  required_rubygems_version: !ruby/object:Gem::Requirement
209
136
  requirements:
210
137
  - - ">="
211
138
  - !ruby/object:Gem::Version
212
139
  version: '0'
213
140
  requirements: []
214
- rubygems_version: 3.1.2
215
- signing_key:
141
+ rubygems_version: 3.5.22
142
+ signing_key:
216
143
  specification_version: 4
217
144
  summary: A Vagrant plugin that executes serverspec
218
- test_files:
219
- - test/Docker/.rspec
220
- - test/Docker/Docker_Vagrantfile
221
- - test/Docker/Vagrantfile
222
- - test/Docker/sample_spec.rb
223
- - test/Docker/spec_helper.rb
224
- - test/ubuntu/.rspec
225
- - test/ubuntu/Vagrantfile
226
- - test/ubuntu/exclude_this_spec.rb
227
- - test/ubuntu/sample_spec.rb
228
- - test/ubuntu/spec_helper.rb
229
- - test/windows/.rspec
230
- - test/windows/sample_spec.rb
231
- - test/windows/spec_helper.rb
232
- - test/windows/vagrantfile
145
+ test_files: []
@@ -1,44 +0,0 @@
1
- name: Ruby Gem
2
-
3
- on:
4
- #pull_request:
5
- # branches:
6
- # - master
7
- push:
8
- branches:
9
- - master
10
-
11
- jobs:
12
- build:
13
- name: Build + Publish
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - uses: actions/checkout@master
18
- - name: Set up Ruby 2.7
19
- uses: actions/setup-ruby@v1
20
- with:
21
- ruby-version: 2.7
22
-
23
- # - name: Publish to GPR
24
- # run: |
25
- # mkdir -p $HOME/.gem
26
- # touch $HOME/.gem/credentials
27
- # chmod 0600 $HOME/.gem/credentials
28
- # printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
29
- # gem build *.gemspec
30
- # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
31
- # env:
32
- # GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
33
- # OWNER: username
34
-
35
- - name: Publish to RubyGems
36
- run: |
37
- mkdir -p $HOME/.gem
38
- touch $HOME/.gem/credentials
39
- chmod 0600 $HOME/.gem/credentials
40
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
41
- gem build *.gemspec
42
- gem push *.gem
43
- env:
44
- GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
data/test/Docker/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format documentation
@@ -1,13 +0,0 @@
1
- Vagrant.configure("2") do |config|
2
- config.vm.box = "mitchellh/boot2docker"
3
-
4
- config.vm.provider "virtualbox" do |v|
5
- # On VirtualBox, we don't have guest additions or a functional vboxsf
6
- # in TinyCore Linux, so tell Vagrant that so it can be smarter.
7
- v.check_guest_additions = false
8
- v.functional_vboxsf = false
9
- v.customize ["modifyvm", :id, "--memory", "1024"]
10
- end
11
-
12
- config.nfs.functional = false
13
- end
@@ -1,17 +0,0 @@
1
- Vagrant.configure('2') do |config|
2
- config.vm.provider "docker" do |d|
3
- d.vagrant_vagrantfile = "./Docker_Vagrantfile"
4
- d.image = "jjhughes57/docker-vagrant-ubuntu"
5
- d.has_ssh = true
6
- end
7
-
8
- config.vm.provision :shell, inline: <<-EOF
9
- sudo apt-get install -y vim
10
- touch /tmp/testfile
11
- EOF
12
-
13
- config.vm.provision :serverspec do |spec|
14
- spec.pattern = '*_spec.rb'
15
- #Specinfra.configuration.sudo_password = 'vagrant'
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe package('vim') do
4
- it { should be_installed }
5
- end
6
-
7
- describe file('/tmp/testfile') do
8
- it { should be_file }
9
- end
@@ -1,13 +0,0 @@
1
- #require 'serverspec'
2
- #require 'net/ssh'
3
-
4
- #set :backend, :ssh
5
-
6
- # Disable sudo
7
- # set :disable_sudo, true
8
-
9
- # Set environment variables
10
- # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
11
-
12
- # Set PATH
13
- # set :path, '/sbin:/usr/local/sbin:$PATH'
@@ -1,15 +0,0 @@
1
- Vagrant.configure('2') do |config|
2
- config.vm.box = 'precise64'
3
- config.vm.box_url = 'http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box'
4
-
5
- config.vm.provision :shell, inline: <<-EOF
6
- sudo ufw allow 22
7
- yes | sudo ufw enable
8
- EOF
9
-
10
- config.vm.provision :serverspec do |spec|
11
- spec.pattern = '*_spec.rb'
12
- spec.exclude_pattern = 'exclude_*_spec.rb'
13
- #Specinfra.configuration.sudo_password = 'vagrant'
14
- end
15
- end
@@ -1,6 +0,0 @@
1
- context 'excluded spec file' do
2
- it 'should not run' do
3
- raise
4
- end
5
- end
6
-
@@ -1,14 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe package('ufw') do
4
- it { should be_installed }
5
- end
6
-
7
- describe service('ufw') do
8
- it { should be_enabled }
9
- it { should be_running }
10
- end
11
-
12
- describe port(22) do
13
- it { should be_listening }
14
- end
@@ -1,13 +0,0 @@
1
- #require 'serverspec'
2
- #require 'net/ssh'
3
-
4
- #set :backend, :ssh
5
-
6
- # Disable sudo
7
- # set :disable_sudo, true
8
-
9
- # Set environment variables
10
- # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
11
-
12
- # Set PATH
13
- # set :path, '/sbin:/usr/local/sbin:$PATH'
data/test/windows/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format documentation
@@ -1,36 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- #describe file('C:\\programdata\\chocolatey\\bin\\console.exe') do
4
- # it { should be_file }
5
- #end
6
-
7
- describe windows_feature('Web-Server') do
8
- it{ should be_installed.by("powershell") }
9
- end
10
-
11
- #describe windows_registry_key(
12
- # 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\advanced') do
13
- # it { should have_property_value('Hidden', :type_dword,'1') }
14
- #end
15
-
16
- describe command('Get-ExecutionPolicy') do
17
- its(:stdout) { should match /RemoteSigned/ }
18
- #its(:stderr) { should match /stderr/ }
19
- its(:exit_status) { should eq 0 }
20
- end
21
-
22
- #describe iis_website('Default Website') do
23
- # it{ should have_site_bindings(80) }
24
- #end
25
-
26
- describe port(80) do
27
- it { should be_listening }
28
- end
29
-
30
- describe file('C:\Windows\system32\telnet.exe') do
31
- it { should be_file }
32
- end
33
-
34
- describe windows_feature('TelnetClient') do
35
- it{ should be_installed.by("powershell") }
36
- end
@@ -1,13 +0,0 @@
1
- #require 'serverspec'
2
- #require 'pathname'
3
- #require 'winrm'
4
- #set :backend, :winrm
5
- #set :os, :family => 'windows'
6
-
7
- #user = 'vagrant'
8
- #pass = 'vagrant'
9
- ##endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
10
- #endpoint = "http://10.128.139.116:5985/wsman"
11
- #winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
12
- #winrm.set_timeout 300 # 5 minutes max timeout for any operation
13
- #Specinfra.configuration.winrm = winrm
@@ -1,58 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.require_version ">= 1.6.2"
5
-
6
- Vagrant.configure("2") do |config|
7
- config.vm.define "windows"
8
- config.vm.box = "windows"
9
- config.vm.communicator = "winrm"
10
-
11
- # Admin user name and password
12
- config.winrm.username = "vagrant"
13
- config.winrm.password = "vagrant"
14
-
15
- config.vm.guest = :windows
16
- config.vm.communicator = "winrm"
17
- config.windows.halt_timeout = 15
18
-
19
- config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
20
- config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true
21
-
22
- config.vm.provider "hyperv" do |v, override|
23
-
24
- end
25
-
26
- config.vm.provider :virtualbox do |v, override|
27
- #v.gui = true
28
- v.customize ["modifyvm", :id, "--memory", 2048]
29
- v.customize ["modifyvm", :id, "--cpus", 2]
30
- v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
31
- end
32
-
33
- config.vm.provider :vmware_fusion do |v, override|
34
- #v.gui = true
35
- v.vmx["memsize"] = "2048"
36
- v.vmx["numvcpus"] = "2"
37
- v.vmx["ethernet0.virtualDev"] = "vmxnet3"
38
- v.vmx["RemoteDisplay.vnc.enabled"] = "false"
39
- v.vmx["RemoteDisplay.vnc.port"] = "5900"
40
- v.vmx["scsi0.virtualDev"] = "lsisas1068"
41
- end
42
-
43
- config.vm.provider :vmware_workstation do |v, override|
44
- #v.gui = true
45
- v.vmx["memsize"] = "2048"
46
- v.vmx["numvcpus"] = "2"
47
- v.vmx["ethernet0.virtualDev"] = "vmxnet3"
48
- v.vmx["RemoteDisplay.vnc.enabled"] = "false"
49
- v.vmx["RemoteDisplay.vnc.port"] = "5900"
50
- v.vmx["scsi0.virtualDev"] = "lsisas1068"
51
- end
52
-
53
-
54
- config.vm.provision :serverspec do |spec|
55
- spec.pattern = '*_spec.rb'
56
- end
57
-
58
- end