vagrant_spec 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -1
- data/README.md +2 -0
- data/lib/vagrant_spec/command/init.rb +3 -0
- data/lib/vagrant_spec/test_plan.rb +11 -4
- data/lib/vagrant_spec/version.rb +1 -1
- data/scripts/poor_mans_smoke_test.sh +1 -0
- data/spec/unit/vagrant_spec_test/command_spec/init_spec.rb +10 -0
- data/spec/unit/vagrant_spec_test/test_plan_spec.rb +15 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7222a82ae26538dbe990ae8edbe2ed8f903595de
|
4
|
+
data.tar.gz: 31a633030d6cafc40d9802e9caec5e7e715e6e1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b30568dd3353610a7d26836866a5042de4282bf601fec5e653e419405872b30b55597a6d94e21c0efcb1e7626efff8fac8336f647b71379809b1826eaf10ef80
|
7
|
+
data.tar.gz: 913b13f14fd5f8893d32cc6618d8e7a86704f34e4fd3d83090cec458ed03d118f8cb40b94af48824704bbf58452e42cdc5014fb7bfaae08c422c8d526da0838a
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.0.6](https://github.com/miroswan/vagrant_spec/tree/v0.0.6) (2016-08-13)
|
4
|
+
[Full Changelog](https://github.com/miroswan/vagrant_spec/compare/v0.0.5...v0.0.6)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Test command spews stacktrace when no nodes are found [\#17](https://github.com/miroswan/vagrant_spec/issues/17)
|
9
|
+
- Wiki should contain a walkthrough of how to get started with system config testing [\#8](https://github.com/miroswan/vagrant_spec/issues/8)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Develop [\#19](https://github.com/miroswan/vagrant_spec/pull/19) ([miroswan](https://github.com/miroswan))
|
14
|
+
- Fix/handle no machines [\#18](https://github.com/miroswan/vagrant_spec/pull/18) ([miroswan](https://github.com/miroswan))
|
15
|
+
- Fix/directory [\#16](https://github.com/miroswan/vagrant_spec/pull/16) ([miroswan](https://github.com/miroswan))
|
16
|
+
- Update README.md [\#15](https://github.com/miroswan/vagrant_spec/pull/15) ([miroswan](https://github.com/miroswan))
|
17
|
+
|
3
18
|
## [v0.0.5](https://github.com/miroswan/vagrant_spec/tree/v0.0.5) (2016-08-10)
|
4
19
|
[Full Changelog](https://github.com/miroswan/vagrant_spec/compare/v0.0.4...v0.0.5)
|
5
20
|
|
6
|
-
**
|
21
|
+
**Fixed bugs:**
|
7
22
|
|
8
23
|
- SSH Issue [\#14](https://github.com/miroswan/vagrant_spec/issues/14)
|
24
|
+
|
25
|
+
**Closed issues:**
|
26
|
+
|
9
27
|
- Fix spelling and grammatical issues in the documentation [\#7](https://github.com/miroswan/vagrant_spec/issues/7)
|
10
28
|
|
11
29
|
**Merged pull requests:**
|
data/README.md
CHANGED
@@ -9,6 +9,8 @@ Vagrant Spec is a Vagrant plugin that makes integration testing for deployments
|
|
9
9
|
to clustered systems a breeze. It also separates the build and deployment steps
|
10
10
|
to clearly separate pipeline tasks.
|
11
11
|
|
12
|
+
For a complete tutorial, reference the [Welcome to VagrantSpec](https://github.com/miroswan/vagrant_spec/wiki/Welcome-to-VagrantSpec)
|
13
|
+
|
12
14
|
## Installation
|
13
15
|
|
14
16
|
```vagrant plugin install vagrant_spec```
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
|
3
5
|
require 'vagrant_spec/ansible_inventory'
|
4
6
|
require 'vagrant_spec/machine_data'
|
5
7
|
require 'vagrant_spec/config'
|
@@ -30,6 +32,7 @@ module VagrantSpec
|
|
30
32
|
|
31
33
|
def execute
|
32
34
|
return unless parse_opts
|
35
|
+
FileUtils.mkdir @directory unless Dir.exist? @directory
|
33
36
|
unless @ansible_inventory == DEFAULTS['ansible_inventory']
|
34
37
|
VagrantSpec::AnsibleInventory.new(@env).generate
|
35
38
|
end
|
@@ -27,14 +27,21 @@ module VagrantSpec
|
|
27
27
|
# This will fail if any of the tests fail, but it will allow all tests to
|
28
28
|
# run
|
29
29
|
def run
|
30
|
+
print_banner
|
31
|
+
@test_plan.each do |plan|
|
32
|
+
found_nodes = nodes(plan)
|
33
|
+
if found_nodes
|
34
|
+
found_nodes.each { |node| execute_plan_tests(node, plan) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
exit @ret_code
|
38
|
+
end
|
39
|
+
|
40
|
+
def print_banner
|
30
41
|
@env.ui.info('*******************************************************')
|
31
42
|
@env.ui.info('***************** ServerSpec Test Run *****************')
|
32
43
|
@env.ui.info('*******************************************************')
|
33
44
|
@env.ui.info('')
|
34
|
-
@test_plan.each do |plan|
|
35
|
-
nodes(plan).each { |node| execute_plan_tests(node, plan) }
|
36
|
-
end
|
37
|
-
exit @ret_code
|
38
45
|
end
|
39
46
|
|
40
47
|
# Return array of active Vagrant machines
|
data/lib/vagrant_spec/version.rb
CHANGED
@@ -16,6 +16,7 @@ bundle exec vagrant spec test -h
|
|
16
16
|
bundle exec vagrant spec no_command -h
|
17
17
|
rm -f "serverspec/spec_helper.rb"
|
18
18
|
rm -f ".vagrantspec_machine_data"
|
19
|
+
rm -f "vagrantspec_inventory"
|
19
20
|
bundle exec vagrant up
|
20
21
|
bundle exec vagrant spec init
|
21
22
|
ansible-playbook site.yml -i vagrantspec_inventory
|
@@ -32,6 +32,8 @@ describe VagrantSpec::Command::Init do
|
|
32
32
|
allow_any_instance_of(VagrantSpec::MachineData).to receive(:generate)
|
33
33
|
allow(mock_ansible_inventory).to receive(:generate)
|
34
34
|
allow(mock_machine_data).to receive(:generate)
|
35
|
+
allow(Dir).to receive(:exist?) { false }
|
36
|
+
allow(FileUtils).to receive(:mkdir)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -55,6 +57,14 @@ describe VagrantSpec::Command::Init do
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
context 'when the @directory does not exist' do
|
61
|
+
it '#execute creates the @directory' do
|
62
|
+
execute_protection_proc.call
|
63
|
+
expect(FileUtils).to receive(:mkdir).with(subject.directory)
|
64
|
+
subject.execute
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
58
68
|
context 'and when @ansible_inventory eq empty hash,' do
|
59
69
|
it '#execute creates an instance of VagrantSpec::SpecHelper' do
|
60
70
|
execute_protection_proc.call
|
@@ -10,10 +10,6 @@ require 'rspec/support/spec/stderr_splitter'
|
|
10
10
|
describe VagrantSpec::TestPlan do
|
11
11
|
include RSpec::Support::InSubProcess
|
12
12
|
include_context 'unit'
|
13
|
-
|
14
|
-
##############################################################################
|
15
|
-
# mocks
|
16
|
-
|
17
13
|
include_examples 'shared_mocks'
|
18
14
|
|
19
15
|
let(:mock_plan) do
|
@@ -40,9 +36,6 @@ describe VagrantSpec::TestPlan do
|
|
40
36
|
|
41
37
|
let(:mock_ssh_backend) { double(Specinfra::Backend::Ssh) }
|
42
38
|
|
43
|
-
##############################################################################
|
44
|
-
# Stubs
|
45
|
-
|
46
39
|
before do
|
47
40
|
allow_any_instance_of(VagrantSpec::MachineFinder)
|
48
41
|
.to receive(:match_nodes) { [double(Vagrant::Machine)] }
|
@@ -63,6 +56,11 @@ describe VagrantSpec::TestPlan do
|
|
63
56
|
|
64
57
|
subject { VagrantSpec::TestPlan.new(iso_env) }
|
65
58
|
|
59
|
+
it '#print_banner prints the testing initialization banner' do
|
60
|
+
expect(mock_ui).to receive(:info)
|
61
|
+
subject.print_banner
|
62
|
+
end
|
63
|
+
|
66
64
|
context 'when passing a Regexp object' do
|
67
65
|
it '#nodes calls match_nodes on a machine_finder instance' do
|
68
66
|
expect(subject.m_finder).to receive(:match_nodes)
|
@@ -93,13 +91,6 @@ describe VagrantSpec::TestPlan do
|
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
96
|
-
##############################################################################
|
97
|
-
# Testing #execute_plan_tests
|
98
|
-
#
|
99
|
-
# These tests must be executed in a sub process because execute_plan_tests
|
100
|
-
# executes clear_examples. clear_examples modifies global state, so we must
|
101
|
-
# contain it.
|
102
|
-
|
103
94
|
def execute_plan_tests_proc
|
104
95
|
proc do
|
105
96
|
allow(subject).to receive(:close_ssh)
|
@@ -129,4 +120,14 @@ describe VagrantSpec::TestPlan do
|
|
129
120
|
expect(subject).to receive(:configure_serverspec)
|
130
121
|
end
|
131
122
|
end
|
123
|
+
|
124
|
+
context 'when nodes returns nil' do
|
125
|
+
it '#run does not fail with NoMethodError' do
|
126
|
+
allow(subject).to receive(:execute_plan_tests)
|
127
|
+
allow(subject).to receive(:exit)
|
128
|
+
allow(subject).to receive(:nodes) { nil }
|
129
|
+
|
130
|
+
expect { subject.run }.not_to raise_error
|
131
|
+
end
|
132
|
+
end
|
132
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Demitri
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: serverspec
|