vagrant-serverspec 1.5.1 → 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 +4 -4
- data/.gitignore +6 -1
- data/{test/ubuntu/.rspec → .rspec} +1 -0
- data/CHANGELOG.md +47 -5
- data/Gemfile +4 -3
- data/README.md +33 -8
- data/Rakefile +5 -4
- data/lib/vagrant-serverspec/config.rb +12 -0
- data/lib/vagrant-serverspec/plugin.rb +2 -2
- data/lib/vagrant-serverspec/provisioner.rb +16 -19
- data/lib/vagrant-serverspec/version.rb +1 -1
- data/spec/config_spec.rb +121 -0
- data/spec/provisioner_spec.rb +241 -0
- data/spec/spec_helper.rb +22 -0
- data/vagrant-serverspec.gemspec +18 -11
- metadata +32 -117
- data/.github/workflows/gempush.yml +0 -44
- data/test/Docker/.rspec +0 -2
- data/test/Docker/Docker_Vagrantfile +0 -13
- data/test/Docker/Vagrantfile +0 -17
- data/test/Docker/sample_spec.rb +0 -9
- data/test/Docker/spec_helper.rb +0 -13
- data/test/ubuntu/Vagrantfile +0 -14
- data/test/ubuntu/sample_spec.rb +0 -14
- data/test/ubuntu/spec_helper.rb +0 -13
- data/test/windows/.rspec +0 -2
- data/test/windows/sample_spec.rb +0 -36
- data/test/windows/spec_helper.rb +0 -13
- data/test/windows/vagrantfile +0 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c288ccbd9b65da16a59f54f59cd12c3fa85425fa22821aae9162e2a3404f424
|
|
4
|
+
data.tar.gz: 541eaab6e7a32ce102d4c3b959fa7cf4f9c039959b6b31ae6e90e701587c6726
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd9a2765198cb98ac0f67d6c2abfbef1f8394ff79827f3088b3de6d5f7212d31a215c87910edc7f3a9e74cbf4681a7476dd07123252b4ce7be75bebdc0cd0f9e
|
|
7
|
+
data.tar.gz: 6f94bf95e45b0682f57d0f597248fb5163b3de0445635d6ad03d24695fe30dbe145acb0f9d709ae96f8faa4da221bedb6b6c0f10ec72f395c34e585adf1fc6cd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,59 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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.
|
|
31
|
+
vagrant plugin install ./vagrant-serverspec-2.0.0.gem
|
|
28
32
|
```
|
|
29
33
|
|
|
30
34
|
## Example Usage
|
|
@@ -44,9 +48,11 @@ Vagrant.configure('2') do |config|
|
|
|
44
48
|
config.vm.provision :serverspec do |spec|
|
|
45
49
|
# pattern for specfiles to search
|
|
46
50
|
spec.pattern = '*_spec.rb'
|
|
47
|
-
#
|
|
51
|
+
# pattern for specfiles to ignore, similar to rspec's --exclude-pattern option
|
|
52
|
+
spec.exclude_pattern = 'but_not_*_spec.rb'
|
|
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
|
|
48
54
|
spec.error_no_spec_files = false
|
|
49
|
-
# save result into html
|
|
55
|
+
# save result into an html report (RSpec's built-in html formatter), written to 'rspec_html_reports/overview.html'. Default: false
|
|
50
56
|
spec.html_output = true
|
|
51
57
|
# save result into junit xml report, default file name is 'rspec.xml'
|
|
52
58
|
spec.junit_output = true
|
|
@@ -63,7 +69,7 @@ You may want to override standard settings; a file named `spec_helper.rb` is usu
|
|
|
63
69
|
# set :disable_sudo, true
|
|
64
70
|
|
|
65
71
|
# Set environment variables
|
|
66
|
-
# set :env, :LANG => 'C', :LC_MESSAGES => 'C'
|
|
72
|
+
# set :env, :LANG => 'C', :LC_MESSAGES => 'C'
|
|
67
73
|
|
|
68
74
|
# Set PATH
|
|
69
75
|
# set :path, '/sbin:/usr/local/sbin:$PATH'
|
|
@@ -88,8 +94,16 @@ describe port(22) do
|
|
|
88
94
|
end
|
|
89
95
|
```
|
|
90
96
|
|
|
91
|
-
##
|
|
92
|
-
|
|
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`).
|
|
93
107
|
|
|
94
108
|
## Additional informations
|
|
95
109
|
|
|
@@ -122,6 +136,17 @@ vagrant-serverspec aims to adhere to [Semantic Versioning 2.0.0][semver].
|
|
|
122
136
|
* Source hosted at [GitHub][repo]
|
|
123
137
|
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
|
124
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
|
+
|
|
125
150
|
Pull requests are very welcome! Make sure your patches are well tested.
|
|
126
151
|
Ideally create a topic branch for every separate change you make. For
|
|
127
152
|
example:
|
|
@@ -134,8 +159,8 @@ example:
|
|
|
134
159
|
|
|
135
160
|
## Authors
|
|
136
161
|
|
|
137
|
-
Original Idea [Jeremy Voorhis][jvoorhis] (<jvoorhis@gmail.com>).
|
|
138
|
-
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>)
|
|
139
164
|
and a growing community of [contributors][contributors].
|
|
140
165
|
|
|
141
166
|
## License
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
require 'bundler/
|
|
1
|
+
require 'bundler/gem_tasks' # build, install, release (used by rubygems/release-gem in CI)
|
|
2
|
+
require 'rspec/core/rake_task'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
5
|
+
|
|
6
|
+
task default: :spec
|
|
@@ -3,6 +3,8 @@ module VagrantPlugins
|
|
|
3
3
|
class Config < Vagrant.plugin('2', :config)
|
|
4
4
|
attr_accessor :spec_files
|
|
5
5
|
attr_accessor :spec_pattern
|
|
6
|
+
attr_accessor :spec_excluded_files
|
|
7
|
+
attr_accessor :spec_exclude_pattern
|
|
6
8
|
attr_accessor :error_no_spec_files_found
|
|
7
9
|
attr_accessor :html_output_format
|
|
8
10
|
attr_accessor :junit_output_format
|
|
@@ -12,6 +14,8 @@ module VagrantPlugins
|
|
|
12
14
|
def initialize
|
|
13
15
|
super
|
|
14
16
|
@spec_files = UNSET_VALUE
|
|
17
|
+
@spec_excluded_files = UNSET_VALUE
|
|
18
|
+
@spec_exclude_pattern = UNSET_VALUE
|
|
15
19
|
@html_output_format = UNSET_VALUE
|
|
16
20
|
@error_no_spec_files_found = UNSET_VALUE
|
|
17
21
|
@junit_output_format = UNSET_VALUE
|
|
@@ -23,6 +27,11 @@ module VagrantPlugins
|
|
|
23
27
|
@spec_pattern = pat
|
|
24
28
|
end
|
|
25
29
|
|
|
30
|
+
def exclude_pattern=(pat)
|
|
31
|
+
@spec_excluded_files = Dir.glob(pat)
|
|
32
|
+
@spec_exclude_pattern = pat
|
|
33
|
+
end
|
|
34
|
+
|
|
26
35
|
def error_no_spec_files=(warn_spec)
|
|
27
36
|
if [true, false].include? warn_spec
|
|
28
37
|
@error_no_spec_files_found = warn_spec
|
|
@@ -49,6 +58,9 @@ module VagrantPlugins
|
|
|
49
58
|
|
|
50
59
|
def finalize!
|
|
51
60
|
@spec_files = [] if @spec_files == UNSET_VALUE
|
|
61
|
+
@spec_exclude_pattern = '' if @spec_exclude_pattern == UNSET_VALUE
|
|
62
|
+
@spec_excluded_files = [] if @spec_excluded_files == UNSET_VALUE
|
|
63
|
+
@spec_files = @spec_files - @spec_excluded_files
|
|
52
64
|
@html_output_format = false if @html_output_format == UNSET_VALUE
|
|
53
65
|
@error_no_spec_files_found = true if @error_no_spec_files_found == UNSET_VALUE
|
|
54
66
|
@junit_output_format = false if @junit_output_format == UNSET_VALUE
|
|
@@ -4,16 +4,19 @@
|
|
|
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
|
|
10
12
|
@spec_pattern = config.spec_pattern
|
|
13
|
+
@spec_excluded_files = config.spec_excluded_files
|
|
14
|
+
@spec_exclude_pattern = config.spec_exclude_pattern
|
|
11
15
|
@error_no_spec_files_found = config.error_no_spec_files_found
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def provision
|
|
15
19
|
if machine.config.vm.communicator == :winrm
|
|
16
|
-
username = machine.config.winrm.username
|
|
17
20
|
winrm_info = VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(@machine)
|
|
18
21
|
set :backend, :winrm
|
|
19
22
|
set :os, :family => 'windows'
|
|
@@ -53,7 +56,7 @@ module VagrantPlugins
|
|
|
53
56
|
host = machine.ssh_info[:host]
|
|
54
57
|
options = Net::SSH::Config.for(host)
|
|
55
58
|
|
|
56
|
-
options[:proxy] = setup_provider_proxy if
|
|
59
|
+
options[:proxy] = setup_provider_proxy if use_proxy?
|
|
57
60
|
options[:user] = machine.ssh_info[:username]
|
|
58
61
|
options[:port] = machine.ssh_info[:port]
|
|
59
62
|
options[:keys] = machine.ssh_info[:private_key_path]
|
|
@@ -69,6 +72,8 @@ module VagrantPlugins
|
|
|
69
72
|
RSpec.clear_examples
|
|
70
73
|
|
|
71
74
|
@spec_files = Dir.glob(@spec_pattern)
|
|
75
|
+
@spec_excluded_files = Dir.glob(@spec_exclude_pattern)
|
|
76
|
+
@spec_files = @spec_files - @spec_excluded_files
|
|
72
77
|
raise Vagrant::Errors::ServerSpecFilesNotFound if @spec_files.length == 0 and @error_no_spec_files_found
|
|
73
78
|
|
|
74
79
|
RSpec.configure do |rconfig|
|
|
@@ -76,9 +81,12 @@ module VagrantPlugins
|
|
|
76
81
|
require 'rspec'
|
|
77
82
|
|
|
78
83
|
if config.html_output_format
|
|
79
|
-
|
|
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)
|
|
80
88
|
|
|
81
|
-
rconfig.add_formatter
|
|
89
|
+
rconfig.add_formatter 'html', File.join(HTML_REPORT_DIR, 'overview.html')
|
|
82
90
|
end
|
|
83
91
|
|
|
84
92
|
if config.junit_output_format
|
|
@@ -120,22 +128,11 @@ module VagrantPlugins
|
|
|
120
128
|
Net::SSH::Proxy::Command.new("ssh #{proxy_options} -i #{key_path} -p #{port} #{username}@#{host} nc %h %p")
|
|
121
129
|
end
|
|
122
130
|
|
|
123
|
-
def
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
name: "DockerProvider",
|
|
127
|
-
platforms: ["mac"]
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
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')
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
if current_provider_class.include? jump_provider[:name]
|
|
134
|
-
jump_provider[:platforms].any? do |platform|
|
|
135
|
-
OS.send("#{platform}?")
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
end
|
|
135
|
+
machine.provider.config.force_host_vm ? true : false
|
|
139
136
|
end
|
|
140
137
|
end
|
|
141
138
|
end
|
data/spec/config_spec.rb
ADDED
|
@@ -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
|
data/spec/spec_helper.rb
ADDED
|
@@ -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
|
data/vagrant-serverspec.gemspec
CHANGED
|
@@ -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.
|
|
16
|
-
|
|
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.
|
|
28
|
+
gem.add_runtime_dependency 'serverspec', '~> 2.43'
|
|
20
29
|
|
|
21
|
-
#
|
|
22
|
-
gem.add_runtime_dependency 'winrm', '~> 2.
|
|
23
|
-
|
|
24
|
-
gem.add_runtime_dependency '
|
|
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 '
|
|
29
|
-
gem.add_development_dependency
|
|
35
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
|
36
|
+
gem.add_development_dependency 'rspec', '~> 3.12'
|
|
30
37
|
end
|
metadata
CHANGED
|
@@ -1,159 +1,93 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-serverspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
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:
|
|
13
|
+
date: 2026-11-05 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: serverspec
|
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
|
18
18
|
requirements:
|
|
19
|
-
- - ">="
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: '2.30'
|
|
22
19
|
- - "~>"
|
|
23
20
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: '2.
|
|
21
|
+
version: '2.43'
|
|
25
22
|
type: :runtime
|
|
26
23
|
prerelease: false
|
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
25
|
requirements:
|
|
29
|
-
- - ">="
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: '2.30'
|
|
32
26
|
- - "~>"
|
|
33
27
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '2.
|
|
28
|
+
version: '2.43'
|
|
35
29
|
- !ruby/object:Gem::Dependency
|
|
36
30
|
name: winrm
|
|
37
|
-
requirement: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !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
31
|
requirement: !ruby/object:Gem::Requirement
|
|
72
32
|
requirements:
|
|
73
33
|
- - "~>"
|
|
74
34
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
35
|
+
version: '2.3'
|
|
76
36
|
- - ">="
|
|
77
37
|
- !ruby/object:Gem::Version
|
|
78
|
-
version:
|
|
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: '
|
|
45
|
+
version: '2.3'
|
|
86
46
|
- - ">="
|
|
87
47
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
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.
|
|
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.
|
|
62
|
+
version: '0.6'
|
|
103
63
|
- !ruby/object:Gem::Dependency
|
|
104
|
-
name:
|
|
64
|
+
name: rake
|
|
105
65
|
requirement: !ruby/object:Gem::Requirement
|
|
106
66
|
requirements:
|
|
107
|
-
- - ">="
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '5.2'
|
|
110
67
|
- - "~>"
|
|
111
68
|
- !ruby/object:Gem::Version
|
|
112
|
-
version:
|
|
113
|
-
type: :
|
|
69
|
+
version: '13.0'
|
|
70
|
+
type: :development
|
|
114
71
|
prerelease: false
|
|
115
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
116
73
|
requirements:
|
|
117
|
-
- - ">="
|
|
118
|
-
- !ruby/object:Gem::Version
|
|
119
|
-
version: '5.2'
|
|
120
74
|
- - "~>"
|
|
121
75
|
- !ruby/object:Gem::Version
|
|
122
|
-
version:
|
|
76
|
+
version: '13.0'
|
|
123
77
|
- !ruby/object:Gem::Dependency
|
|
124
|
-
name:
|
|
78
|
+
name: rspec
|
|
125
79
|
requirement: !ruby/object:Gem::Requirement
|
|
126
80
|
requirements:
|
|
127
|
-
- - ">="
|
|
128
|
-
- !ruby/object:Gem::Version
|
|
129
|
-
version: '1.17'
|
|
130
81
|
- - "~>"
|
|
131
82
|
- !ruby/object:Gem::Version
|
|
132
|
-
version:
|
|
83
|
+
version: '3.12'
|
|
133
84
|
type: :development
|
|
134
85
|
prerelease: false
|
|
135
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
87
|
requirements:
|
|
137
|
-
- - ">="
|
|
138
|
-
- !ruby/object:Gem::Version
|
|
139
|
-
version: '1.17'
|
|
140
88
|
- - "~>"
|
|
141
89
|
- !ruby/object:Gem::Version
|
|
142
|
-
version:
|
|
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,25 +111,19 @@ files:
|
|
|
177
111
|
- lib/vagrant-serverspec/provisioner.rb
|
|
178
112
|
- lib/vagrant-serverspec/version.rb
|
|
179
113
|
- locales/en.yml
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
- test/Docker/sample_spec.rb
|
|
184
|
-
- test/Docker/spec_helper.rb
|
|
185
|
-
- test/ubuntu/.rspec
|
|
186
|
-
- test/ubuntu/Vagrantfile
|
|
187
|
-
- test/ubuntu/sample_spec.rb
|
|
188
|
-
- test/ubuntu/spec_helper.rb
|
|
189
|
-
- test/windows/.rspec
|
|
190
|
-
- test/windows/sample_spec.rb
|
|
191
|
-
- test/windows/spec_helper.rb
|
|
192
|
-
- test/windows/vagrantfile
|
|
114
|
+
- spec/config_spec.rb
|
|
115
|
+
- spec/provisioner_spec.rb
|
|
116
|
+
- spec/spec_helper.rb
|
|
193
117
|
- vagrant-serverspec.gemspec
|
|
194
118
|
homepage: https://github.com/vvchik/vagrant-serverspec
|
|
195
119
|
licenses:
|
|
196
120
|
- MIT
|
|
197
|
-
metadata:
|
|
198
|
-
|
|
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:
|
|
199
127
|
rdoc_options: []
|
|
200
128
|
require_paths:
|
|
201
129
|
- lib
|
|
@@ -203,28 +131,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
203
131
|
requirements:
|
|
204
132
|
- - ">="
|
|
205
133
|
- !ruby/object:Gem::Version
|
|
206
|
-
version: '0'
|
|
134
|
+
version: '3.0'
|
|
207
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
136
|
requirements:
|
|
209
137
|
- - ">="
|
|
210
138
|
- !ruby/object:Gem::Version
|
|
211
139
|
version: '0'
|
|
212
140
|
requirements: []
|
|
213
|
-
rubygems_version: 3.
|
|
214
|
-
signing_key:
|
|
141
|
+
rubygems_version: 3.5.22
|
|
142
|
+
signing_key:
|
|
215
143
|
specification_version: 4
|
|
216
144
|
summary: A Vagrant plugin that executes serverspec
|
|
217
|
-
test_files:
|
|
218
|
-
- test/Docker/.rspec
|
|
219
|
-
- test/Docker/Docker_Vagrantfile
|
|
220
|
-
- test/Docker/Vagrantfile
|
|
221
|
-
- test/Docker/sample_spec.rb
|
|
222
|
-
- test/Docker/spec_helper.rb
|
|
223
|
-
- test/ubuntu/.rspec
|
|
224
|
-
- test/ubuntu/Vagrantfile
|
|
225
|
-
- test/ubuntu/sample_spec.rb
|
|
226
|
-
- test/ubuntu/spec_helper.rb
|
|
227
|
-
- test/windows/.rspec
|
|
228
|
-
- test/windows/sample_spec.rb
|
|
229
|
-
- test/windows/spec_helper.rb
|
|
230
|
-
- 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.6
|
|
19
|
-
uses: actions/setup-ruby@v1
|
|
20
|
-
with:
|
|
21
|
-
version: 2.6.x
|
|
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,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
|
data/test/Docker/Vagrantfile
DELETED
|
@@ -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
|
data/test/Docker/sample_spec.rb
DELETED
data/test/Docker/spec_helper.rb
DELETED
|
@@ -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/ubuntu/Vagrantfile
DELETED
|
@@ -1,14 +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
|
-
#Specinfra.configuration.sudo_password = 'vagrant'
|
|
13
|
-
end
|
|
14
|
-
end
|
data/test/ubuntu/sample_spec.rb
DELETED
data/test/ubuntu/spec_helper.rb
DELETED
|
@@ -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
data/test/windows/sample_spec.rb
DELETED
|
@@ -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
|
data/test/windows/spec_helper.rb
DELETED
|
@@ -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
|
data/test/windows/vagrantfile
DELETED
|
@@ -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
|