rspec-system 1.6.0 → 1.7.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.
@@ -1,3 +1,16 @@
1
+ 1.7.0
2
+ =====
3
+
4
+ This change adjusts the temporary path for vagrant projects to use a directory in your project `.rspec_system`. This way while debugging issues on your VM you do not need to scroll back to find the vagrant project, simply look in the local `.rspec_system`.
5
+
6
+ Now if you want to adjust this base directory to something else, you can use the directory RSPEC_SYSTEM_TMP.
7
+
8
+ #### Detailed Changes
9
+
10
+ * Change the tmp path for the vagrant_projects directory to be under projects root directory (Trey Dock)
11
+
12
+ -------------------------------
13
+
1
14
  1.6.0
2
15
  =====
3
16
 
data/README.md CHANGED
@@ -22,6 +22,8 @@ Then installing with:
22
22
 
23
23
  bundle install --path vendor
24
24
 
25
+ If your using git, add `.rspec_system` to your project's `.gitignore` file. This is the default location for files created by rspec-system.
26
+
25
27
  ### Writing tests
26
28
 
27
29
  Start by creating a helper file in `spec/spec_helper_system.rb` containing something like the following:
@@ -165,6 +167,7 @@ Instead of switches, we use a number of environment variables to modify the beha
165
167
  * *RSPEC_VIRTUAL_ENV* - set this to `vagrant` if you wish, for now `vagrant` is the default so this is optional.
166
168
  * *RSPEC_SET* - the set to use when running tests (defaults to the `default_set` setting in the projects `.nodeset.yml` file). This string must align with the entries under `sets` in your `.nodeset.yml`.
167
169
  * *RSPEC_DESTROY* - set this to `no` if you do not want the VM to be destroyed before or after a test completes. May be useful during initial testing of rspec tests to allow inspection of the VM.
170
+ * *RSPEC_SYSTEM_TMP* - Sets the path to create vagrant_projects directory containing each Nodeset's Vagrantfile. Default is the directory `.rspec_system` in your projects root.
168
171
 
169
172
  So if you wanted to run an alternate nodeset you could use:
170
173
 
@@ -172,6 +175,10 @@ So if you wanted to run an alternate nodeset you could use:
172
175
 
173
176
  In Jenkins you should be able to use RSPEC\_SET in a test matrix, thus obtaining quite a nice integration and visual display of nodesets in Jenkins.
174
177
 
178
+ To set the location of the Nodeset's Vagrantfile to `/tmp/vagrant_projects/centos-64-x64` you could use:
179
+
180
+ RSPEC_SET=centos-64-x64 RSPEC_SYSTEM_TMP=/tmp rake spec:system
181
+
175
182
  #### VSphere Provider
176
183
 
177
184
  *Note:* this provider requires some templates to be created in a globally accessable folder somewhere in your VSphere system, in the near future the site: <http://puppet-vagrant-boxes.puppetlabs.com> should provide you with deployable OVF files for this purpose, and I'll provide you with better docs on how to load these ;-). Look at prefabs.yml for the names of the templates that we expect.
@@ -10,7 +10,11 @@ module RSpecSystem
10
10
  attr_reader :nodes
11
11
  attr_reader :destroy
12
12
 
13
+ # @!group Abstract Methods
14
+
13
15
  # Create new NodeSet, populating necessary data structures.
16
+ #
17
+ # @abstract override for providing global storage and setup-level code
14
18
  def initialize(setname, config, custom_prefabs_path, options)
15
19
  @setname = setname
16
20
  @config = config
@@ -24,25 +28,44 @@ module RSpecSystem
24
28
  end
25
29
 
26
30
  # Setup the NodeSet by starting all nodes.
31
+ #
32
+ # @return [void]
33
+ # @abstract Override this method and provide your own node launching code
27
34
  def setup
28
35
  raise "Unimplemented method #setup"
29
36
  end
30
37
 
31
38
  # Shutdown the NodeSet by shutting down or pausing all nodes.
39
+ #
40
+ # @return [void]
41
+ # @abstract Override this method and provide your own node teardown code
32
42
  def teardown
33
43
  raise "Unimplemented method #teardown"
34
44
  end
35
45
 
36
46
  # Run a command on a host in the NodeSet.
47
+ #
48
+ # @param opts [Hash] options hash containing :n (node) and :c (command)
49
+ # @return [Hash] a hash containing :stderr, :stdout and :exit_code
50
+ # @abstract Override this method providing your own shell running code
37
51
  def run(options)
38
52
  raise "Unimplemented method #run"
39
53
  end
40
54
 
41
55
  # Copy a file to the host in the NodeSet.
56
+ #
57
+ # @param opts [Hash] options
58
+ # @option opts [RSpecHelper::Node] :d destination node
59
+ # @option opts [String] :sp source path
60
+ # @option opts [String] :dp destination path
61
+ # @return [Boolean] returns true if command succeeded, false otherwise
62
+ # @abstract Override this method providing your own file transfer code
42
63
  def rcp(options)
43
64
  raise "Unimplemented method #rcp"
44
65
  end
45
66
 
67
+ # @!group Common Methods
68
+
46
69
  # Return environment type
47
70
  def env_type
48
71
  self.class::ENV_TYPE
@@ -27,6 +27,12 @@ RSpec.configure do |c|
27
27
  def custom_prefabs_path
28
28
  File.expand_path(File.join(File.basename(__FILE__), '..', '.prefabs.yml'))
29
29
  end
30
+
31
+ def rspec_system_tmp
32
+ path = ENV["RSPEC_SYSTEM_TMP"] || File.expand_path(File.join(File.basename(__FILE__), '..', '.rspec_system'))
33
+ FileUtils.mkdir_p(path)
34
+ path
35
+ end
30
36
 
31
37
  def rspec_system_config
32
38
  YAML.load_file('.nodeset.yml')
@@ -89,7 +95,7 @@ RSpec.configure do |c|
89
95
  end
90
96
 
91
97
  # Default the system_tmp dir to something random
92
- c.system_tmp = Dir.mktmpdir
98
+ c.system_tmp = rspec_system_tmp
93
99
 
94
100
  c.before :suite do
95
101
  # Before Suite exceptions get captured it seems
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # Metadata
4
4
  s.name = "rspec-system"
5
- s.version = "1.6.0"
5
+ s.version = "1.7.0"
6
6
  s.authors = ["Ken Barber"]
7
7
  s.email = ["ken@bob.sh"]
8
8
  s.homepage = "https://github.com/puppetlabs/rspec-system"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-system
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec