rspec-system 2.5.1 → 2.6.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 +7 -0
- data/CHANGELOG.md +24 -0
- data/README.md +66 -71
- data/lib/rspec-system.rb +0 -1
- data/lib/rspec-system/helper.rb +2 -5
- data/lib/rspec-system/helpers.rb +1 -1
- data/lib/rspec-system/helpers/rcp.rb +2 -5
- data/lib/rspec-system/helpers/shell.rb +1 -1
- data/lib/rspec-system/node.rb +1 -3
- data/lib/rspec-system/node_set.rb +12 -4
- data/lib/rspec-system/node_set/base.rb +132 -7
- data/lib/rspec-system/node_set/{vagrant.rb → vagrant_base.rb} +63 -82
- data/lib/rspec-system/node_set/vagrant_virtualbox.rb +41 -0
- data/lib/rspec-system/node_set/vagrant_vmware_fusion.rb +43 -0
- data/lib/rspec-system/node_set/vsphere.rb +35 -95
- data/lib/rspec-system/spec_helper.rb +50 -11
- data/resources/prefabs.yml +26 -116
- data/rspec-system.gemspec +4 -4
- data/spec/spec_helper_system.rb +0 -1
- data/spec/system/base_spec.rb +8 -2
- metadata +16 -31
- data/lib/rspec-system/internal_helpers.rb +0 -101
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'rspec-system'
|
2
|
-
|
3
|
-
# This is a helper module that exposes some internal helpers used by the main
|
4
|
-
# public ones, also the startup and teardown routines.
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
module RSpecSystem::InternalHelpers
|
8
|
-
# Return the path to the nodeset file
|
9
|
-
#
|
10
|
-
# @return [Pathname]
|
11
|
-
def nodeset
|
12
|
-
Pathname.new(File.join(File.basename(__FILE__), '..', '.nodeset.yml'))
|
13
|
-
end
|
14
|
-
|
15
|
-
# Return the path to the custom prefabs file
|
16
|
-
#
|
17
|
-
# @return [Pathname]
|
18
|
-
def custom_prefabs_path
|
19
|
-
Pathname.new(File.expand_path(File.join(File.basename(__FILE__), '..', '.prefabs.yml')))
|
20
|
-
end
|
21
|
-
|
22
|
-
# Return the path to the temporary directory
|
23
|
-
#
|
24
|
-
# @return [Pathname]
|
25
|
-
def rspec_system_tmp
|
26
|
-
path = ENV["RSPEC_SYSTEM_TMP"] || File.expand_path(File.join(File.basename(__FILE__), '..', '.rspec_system'))
|
27
|
-
FileUtils.mkdir_p(path)
|
28
|
-
Pathname.new(path)
|
29
|
-
end
|
30
|
-
|
31
|
-
# Return the nodeset configuration hash
|
32
|
-
#
|
33
|
-
# @return [Hash] nodeset configuration
|
34
|
-
def rspec_system_config
|
35
|
-
YAML.load_file('.nodeset.yml')
|
36
|
-
end
|
37
|
-
|
38
|
-
# Grab the type of virtual environment we wish to run these tests in
|
39
|
-
#
|
40
|
-
# @return [String] current virtual env type
|
41
|
-
def rspec_virtual_env
|
42
|
-
ENV["RSPEC_VIRTUAL_ENV"] || 'vagrant'
|
43
|
-
end
|
44
|
-
|
45
|
-
# Defines if a set will be destroyed before and after tests
|
46
|
-
#
|
47
|
-
# @return [Boolean]
|
48
|
-
def rspec_destroy
|
49
|
-
return false if ENV["RSPEC_DESTROY"] =~ /(no|false)/
|
50
|
-
return true
|
51
|
-
end
|
52
|
-
|
53
|
-
# Return the current nodeset object
|
54
|
-
#
|
55
|
-
# @return [RSpecSystem::NodeSet::Base] current nodeset object
|
56
|
-
def rspec_system_node_set
|
57
|
-
setname = ENV['RSPEC_SET'] || rspec_system_config['default_set']
|
58
|
-
config = rspec_system_config['sets'][setname]
|
59
|
-
options = {}
|
60
|
-
options[:destroy] = rspec_destroy
|
61
|
-
RSpecSystem::NodeSet.create(setname, config, rspec_virtual_env, custom_prefabs_path, options)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Start all nodes
|
65
|
-
#
|
66
|
-
# @return [void]
|
67
|
-
def start_nodes
|
68
|
-
ns = rspec_system_node_set
|
69
|
-
|
70
|
-
output << "=begin===========================================================\n"
|
71
|
-
output << "\n"
|
72
|
-
output << bold("Starting nodes") << "\n"
|
73
|
-
output << "\n"
|
74
|
-
output << bold("Setname:") << " #{ns.setname}\n"
|
75
|
-
output << bold("Configuration:") << " #{ns.config.pretty_inspect}"
|
76
|
-
output << bold("Virtual Environment:") << " #{ns.env_type}\n"
|
77
|
-
output << bold("Default node:") << " #{ns.default_node.name}\n"
|
78
|
-
output << bold("Destroy node:") << " #{ns.destroy}\n"
|
79
|
-
output << "\n"
|
80
|
-
ns.setup
|
81
|
-
output << "\n"
|
82
|
-
output << "=end=============================================================\n"
|
83
|
-
output << "\n"
|
84
|
-
nil
|
85
|
-
end
|
86
|
-
|
87
|
-
# Stop all nodes
|
88
|
-
#
|
89
|
-
# @return [void]
|
90
|
-
def stop_nodes
|
91
|
-
output << "\n"
|
92
|
-
output << "=begin===========================================================\n"
|
93
|
-
output << "\n"
|
94
|
-
output << bold("Stopping nodes\n")
|
95
|
-
output << "\n"
|
96
|
-
rspec_system_node_set.teardown
|
97
|
-
output << "\n"
|
98
|
-
output << "=end=============================================================\n"
|
99
|
-
nil
|
100
|
-
end
|
101
|
-
end
|