rspec-system 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ 2.5.0
2
+ =====
3
+
4
+ This feature release improves the VSPhere provider.
5
+
6
+ * Additional settings have been provided to manage the deployment of nodes in VSphere
7
+ * Extra settings added to control timeouts and retries
8
+ * The main resiliency code has been overhauled and now we have retry handling for most external calls
9
+
10
+ #### Detailed Changes
11
+
12
+ * Repair vsphere provider (Ken Barber)
13
+
14
+ -------------------------------
15
+
1
16
  2.4.0
2
17
  =====
3
18
 
data/README.md CHANGED
@@ -278,6 +278,17 @@ This provider has a lot more options for setup, in the form of environment varia
278
278
  * *RSPEC_VSPHERE_DEST_DIR* - destination path to launch vm's
279
279
  * *RSPEC_VSPHERE_TEMPLATE_DIR* - path to where you deployed the templates from the OVF files described above
280
280
  * *RSPEC_VSPHERE_RPOOL* - name of resource pool to use
281
+ * *RSPEC_VSPHERE_CLUSTER* - name of the cluster to use
282
+ * *RSPEC_VSPHERE_SSH_KEYS* - path to private key for authentication. Multiple paths may be provided using a colon separator.
283
+ * *RSPEC_VSPHERE_DATACENTER* - optional name of VSphere data centre
284
+ * *RSPEC_VSPHERE_NODE_TIMEOUT* - amount of seconds before trying to relaunch a node. Defaults to 1200.
285
+ * *RSPEC_VSPHERE_NODE_TRIES* - amount of attempts to relaunch a node. Defaults to 10.
286
+ * *RSPEC_VSPHERE_NODE_SLEEP* - amount of seconds to sleep for before trying again. Defaults to a random number between 30 and 90.
287
+ * *RSPEC_VSPHERE_SSH_TIMEOUT* - amount of seconds before retrying to SSH into a node. Default to 60.
288
+ * *RSPEC_VSPHERE_SSH_TRIES* - amount of attempts to SSH into a node. Defaults to 10.
289
+ * *RSPEC_VSPHERE_SSH_SLEEP* - amount of seconds to sleep before trying to SSH again. Defaults to 4.
290
+ * *RSPEC_VSPHERE_CONNECT_TIMEOUT* - amount of seconds before retrying to connect to the VSphere API. Defaults to 60.
291
+ * *RSPEC_VSPHERE_CONNECT_TRIES* - amount of attempts to connect to the VSphere API. Defaults to 10.
281
292
 
282
293
  Set these variables, and run the usual rake command:
283
294
 
@@ -12,6 +12,8 @@ module RSpecSystem
12
12
 
13
13
  ENV_TYPE = 'vsphere'
14
14
 
15
+ attr_reader :vmconf
16
+
15
17
  # Creates a new instance of RSpecSystem::NodeSet::Vsphere
16
18
  #
17
19
  # @param setname [String] name of the set to instantiate
@@ -20,96 +22,242 @@ module RSpecSystem
20
22
  # @param options [Hash] options Hash
21
23
  def initialize(setname, config, custom_prefabs_path, options)
22
24
  super
23
- @vim = RbVmomi::VIM.connect(
24
- :host => ENV["RSPEC_VSPHERE_HOST"],
25
- :user => ENV["RSPEC_VSPHERE_USER"],
26
- :password => ENV["RSPEC_VSPHERE_PASS"],
27
- :ssl => true,
28
- :insecure => true
29
- )
25
+
26
+ # Valid supported ENV variables
27
+ options = [:host, :user, :pass, :dest_dir, :template_dir, :rpool,
28
+ :cluster, :ssh_keys, :datacenter, :node_timeout, :node_tries,
29
+ :node_sleep, :ssh_timeout, :ssh_tries, :ssh_sleep, :connect_timeout,
30
+ :connect_tries]
31
+
32
+ # Devise defaults, use fog configuration from file system if it exists
33
+ defaults = load_fog_config()
34
+ defaults = defaults.merge({
35
+ :node_timeout => 1200,
36
+ :node_tries => 10,
37
+ :node_sleep => 30 + rand(60),
38
+ :ssh_timeout => 60,
39
+ :ssh_tries => 10,
40
+ :ssh_sleep => 4,
41
+ :connect_timeout => 60,
42
+ :connect_tries => 10,
43
+ })
44
+
45
+ # Traverse the ENV variables and load them into our config automatically
46
+ @vmconf = defaults
47
+ ENV.each do |k,v|
48
+ next unless k =~/^RSPEC_VSPHERE_/
49
+ var = k.sub(/^RSPEC_VSPHERE_/, '').downcase.to_sym
50
+ unless options.include?(var)
51
+ log.info("Ignoring unknown environment variable #{k}")
52
+ next
53
+ end
54
+ @vmconf[var] = v
55
+ end
30
56
 
31
57
  # Initialize node storage if not already
32
58
  RSpec.configuration.rspec_storage[:nodes] ||= {}
33
59
  end
34
60
 
35
- # @!group NodeSet Methods
36
-
37
- # Setup the NodeSet by starting all nodes.
61
+ # Retrieves fog configuration if it exists
38
62
  #
39
- # @return [void]
40
- def setup
41
- dest_dir = ENV['RSPEC_VSPHERE_DEST_DIR']
42
- template_dir = ENV['RSPEC_VSPHERE_TEMPLATE_DIR']
43
-
44
- si = @vim.serviceInstance
45
- dc = si.find_datacenter
46
-
47
- rp = dc.find_compute_resource('general').resourcePool.find(ENV["RSPEC_VSPHERE_RPOOL"])
48
- relocateSpec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => rp)
49
- spec = RbVmomi::VIM.VirtualMachineCloneSpec(
50
- :location => relocateSpec,
51
- :powerOn => true,
52
- :template => false
53
- )
54
-
55
- vm_folder = dc.vmFolder
56
- vm_newfolder = vm_folder.find(dest_dir)
57
-
58
- log.info "Launching VSphere instances one by one"
59
- nodes.each do |k,v|
60
- ps = v.provider_specifics['vsphere']
61
-
62
- raise 'No provider specifics for this prefab' if ps.nil?
63
-
64
- template = ps['template']
65
-
66
- raise "No template specified for this prefab" if template.nil?
67
-
68
- log.info "Launching VSphere instance #{k} with template #{template}"
69
-
70
- vm = vm_folder.find(ENV['RSPEC_VSPHERE_TEMPLATE_DIR']).find(template)
63
+ # @api private
64
+ def load_fog_config(path = ENV['HOME'] + '/.fog')
65
+ creds = {}
66
+ if File.exists?(path)
67
+ fog = YAML.load_file(path)
68
+ fog[:default] ||= {}
69
+ creds = {
70
+ :host => fog[:default][:vsphere_server],
71
+ :user => fog[:default][:vsphere_username],
72
+ :pass => fog[:default][:vsphere_password],
73
+ }
74
+ end
71
75
 
72
- raise "No template found" if vm.nil?
76
+ return creds
77
+ end
73
78
 
74
- vm_name = "rspec-system-#{k}-#{random_string(10)}"
79
+ # This is a DSL based wrapper that provides connection and disconnection
80
+ # handling for the VSphere client API.
81
+ #
82
+ # The connection handling automatically retries upon failure.
83
+ #
84
+ # @api private
85
+ def with_connection(&block)
86
+ vim = nil
87
+ dc = nil
88
+
89
+ tries = 0
90
+ begin
91
+ timeout(vmconf[:connect_timeout]) do
92
+ vim = RbVmomi::VIM.connect(
93
+ :host => vmconf[:host],
94
+ :user => vmconf[:user],
95
+ :password => vmconf[:pass],
96
+ :ssl => true,
97
+ :insecure => true
98
+ )
99
+ end
100
+ rescue => e
101
+ tries += 1
102
+ log.error("Failure to connect (attempt #{tries})")
103
+ if tries < vmconf[:connect_tries]
104
+ log.info("Retry connection")
105
+ retry
106
+ end
107
+ log.info("Failed to connect after #{tries} attempts, throwing exception")
108
+ raise e
109
+ end
75
110
 
76
- log.info "Cloning new VSphere vm #{vm_name} in folder #{dest_dir}"
111
+ begin
112
+ dc = vim.serviceInstance.find_datacenter(vmconf[:datacenter])
113
+ rescue => e
114
+ log.error("Unable to retrieve datacenter #{vmconf[:datacenter]}")
115
+ raise e
116
+ end
77
117
 
78
- vm.CloneVM_Task(
79
- :folder => vm_newfolder,
80
- :name => vm_name,
81
- :spec => spec
82
- ).wait_for_completion
118
+ block.call(dc)
83
119
 
84
- log.info "Cloning complete"
120
+ vim.close
121
+ end
85
122
 
86
- newvm = vm_newfolder.find(vm_name)
87
- guest_info = newvm.guest
123
+ # @!group NodeSet Methods
88
124
 
89
- timeout(60) do
90
- while(newvm.guest.guestState != 'running') do
91
- sleep 2
92
- log.info "#{k}> Waiting for vm to run ..."
125
+ # Setup the NodeSet by starting all nodes.
126
+ #
127
+ # @return [void]
128
+ def setup
129
+ with_connection do |dc|
130
+ # Traverse folders to find target folder for new vm's and template
131
+ # folders. Automatically create the destination folder if it doesn't
132
+ # exist.
133
+ dest_folder = dc.vmFolder.traverse!(vmconf[:dest_dir], RbVmomi::VIM::Folder)
134
+ raise "Destination folder #{vmconf[:dest_dir]} not found" if dest_folder.nil?
135
+ template_folder = dc.vmFolder.traverse(vmconf[:template_dir], RbVmomi::VIM::Folder)
136
+ raise "Template folder #{vmconf[:template_dir]} not found" if template_folder.nil?
137
+
138
+ # Find resource pool and prepare clone spec for cloning further down.
139
+ rp = dc.find_compute_resource(vmconf[:cluster]).
140
+ resourcePool.
141
+ traverse(vmconf[:rpool])
142
+ relocateSpec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => rp)
143
+ spec = RbVmomi::VIM.VirtualMachineCloneSpec(
144
+ :location => relocateSpec,
145
+ :powerOn => true,
146
+ :template => false
147
+ )
148
+
149
+ log.info "Launching VSphere instances one by one"
150
+ nodes.each do |k,v|
151
+ #####################
152
+ # Node launching step
153
+ #####################
154
+ RSpec.configuration.rspec_storage[:nodes][k] ||= {}
155
+
156
+ # Obtain the template name to use
157
+ ps = v.provider_specifics['vsphere']
158
+ raise 'No provider specifics for this prefab' if ps.nil?
159
+ template = ps['template']
160
+ raise "No template specified for this prefab" if template.nil?
161
+
162
+ # Traverse to find template VM object
163
+ vm = template_folder.find(template, RbVmomi::VIM::VirtualMachine)
164
+ raise "Cannot template find template #{template} in folder #{vmconf[:template_dir]}" if vm.nil?
165
+
166
+ # Create a random name for the new VM
167
+ vm_name = "rspec-system-#{k}-#{random_string(10)}"
168
+ RSpec.configuration.rspec_storage[:nodes][k][:vm] = vm_name
169
+
170
+ log.info "Launching VSphere instance #{k} with template #{vmconf[:template_dir]}/#{template} as #{vmconf[:dest_dir]}/#{vm_name}"
171
+
172
+ ipaddress = nil
173
+ newvm = nil
174
+ tries = 0
175
+ start_time = Time.now
176
+ begin
177
+ timeout(vmconf[:node_timeout]) do
178
+ log.info "Cloning new VSphere vm #{vm_name} in folder #{vmconf[:dest_dir]}"
179
+ vm.CloneVM_Task(
180
+ :folder => dest_folder,
181
+ :name => vm_name,
182
+ :spec => spec
183
+ ).wait_for_completion
184
+ time1 = Time.now
185
+ log.info "Cloning complete, took #{time1 - start_time} seconds"
186
+
187
+ newvm = dest_folder.find(vm_name, RbVmomi::VIM::VirtualMachine)
188
+ raise "Cannot find newly built virtual machine #{vm_name} in folder #{vmconf[:dest_dir]}" if newvm.nil?
189
+
190
+ while(newvm.guest.guestState != 'running') do
191
+ sleep 4
192
+ log.info "#{k}> Waiting for vm to run ..."
193
+ end
194
+ time2 = Time.now
195
+ log.info "#{k}> Time in seconds for VM to run: #{time2 - time1}"
196
+
197
+ while((ipaddress = newvm.guest.ipAddress) == nil) do
198
+ sleep 4
199
+ log.info "#{k}> Waiting for ip address ..."
200
+ end
201
+ time3 = Time.now
202
+ log.info "#{k}> Time in seconds waiting for IP: #{time3 - time2}"
203
+ end
204
+ RSpec.configuration.rspec_storage[:nodes][k][:ipaddress] = ipaddress
205
+ rescue Timeout::Error, SystemCallError => e
206
+ tries += 1
207
+ log.error("VM launch attempt #{tries} failed with: " + e.message)
208
+ if tries < vmconf[:node_tries]
209
+ log.info("Destroying any VM's, sleeping then trying again ...")
210
+ begin
211
+ newvm.PowerOffVM_Task.wait_for_completion
212
+ rescue RbVmomi::Fault => e
213
+ log.error "Fault attempting to power off node #{k}, #{e.message}"
214
+ ensure
215
+ begin
216
+ newvm.Destroy_Task.wait_for_completion
217
+ rescue RbVmomi::Fault => e
218
+ log.error "Fault attempting to destroy node #{k}, #{e.message}"
219
+ end
220
+ end
221
+ sleep_time = vmconf[:node_sleep]
222
+ log.info("Sleeping #{sleep_time} seconds before trying again ...")
223
+ sleep sleep_time
224
+ retry
225
+ else
226
+ log.error("Failed to create VM and already retried #{tries} times, throwing exception")
227
+ raise e
228
+ end
93
229
  end
94
- end
95
-
96
- timeout(60) do
97
- while(newvm.guest.ipAddress == nil) do
98
- sleep 2
99
- log.info "#{k}> Waiting for ip address ..."
230
+ time2 = Time.now
231
+ log.info "#{k}> Took #{time2 - start_time} seconds to boot instance"
232
+
233
+ #####################
234
+ # SSH Step
235
+ #####################
236
+ tries = 0
237
+ begin
238
+ timeout(vmconf[:ssh_timeout]) do
239
+ output << bold(color("localhost$", :green)) << " ssh #{k}\n"
240
+ chan = Net::SSH.start(ipaddress, 'root', {
241
+ :keys => vmconf[:ssh_keys].split(":"),
242
+ })
243
+
244
+ RSpec.configuration.rspec_storage[:nodes][k][:ssh] = chan
245
+ end
246
+ rescue Timeout::Error, SystemCallError => e
247
+ tries += 1
248
+ output << e.message << "\n"
249
+ if tries < vmconf[:ssh_tries]
250
+ log.info("Sleeping for #{vmconf[:ssh_sleep]} seconds then trying again ...")
251
+ sleep vmconf[:ssh_sleep]
252
+ retry
253
+ else
254
+ log.error("Inability to connect to host, already tried #{tries} times, throwing exception")
255
+ raise e
256
+ end
100
257
  end
258
+ time3 = Time.now
259
+ log.info "#{k}> Took #{time3 - start_time} seconds for instance to be ready"
101
260
  end
102
-
103
- ipaddress = newvm.guest.ipAddress
104
-
105
- output << bold(color("localhost$", :green)) << " ssh #{k}"
106
- chan = Net::SSH.start(ipaddress, 'vagrant', :password => 'vagrant')
107
-
108
- RSpec.configuration.rspec_storage[:nodes][k] = {
109
- :ipaddress => ipaddress,
110
- :ssh => chan,
111
- :vm => newvm
112
- }
113
261
  end
114
262
 
115
263
  nil
@@ -119,28 +267,48 @@ module RSpecSystem
119
267
  #
120
268
  # @return [void]
121
269
  def teardown
122
- nodes.each do |k,v|
123
- storage = RSpec.configuration.rspec_storage[:nodes][k]
270
+ with_connection do |dc|
271
+ nodes.each do |k,v|
272
+ storage = RSpec.configuration.rspec_storage[:nodes][k]
124
273
 
125
- if storage.nil?
126
- log.info "No entry for node #{k}, no teardown necessary"
127
- next
128
- end
274
+ if storage.nil?
275
+ log.info "No entry for node #{k}, no teardown necessary"
276
+ next
277
+ end
129
278
 
130
- ssh = storage[:ssh]
131
- ssh.close unless ssh.closed?
279
+ ssh = storage[:ssh]
280
+ unless ssh.nil? or ssh.closed?
281
+ ssh.close
282
+ end
132
283
 
133
- if destroy
134
- log.info "Destroying instance #{k}"
135
- vm = storage[:vm]
136
- if vm == nil
137
- log.error "No vm object for #{k}"
284
+ if destroy
285
+ log.info "Destroying instance #{k}"
286
+ vm_name = storage[:vm]
287
+ if vm_name == nil
288
+ log.error "No vm object for #{k}"
289
+ next
290
+ end
291
+
292
+ # Traverse folders to find target folder for new vm's
293
+ vm_folder = dc.vmFolder.traverse(vmconf[:dest_dir], RbVmomi::VIM::Folder)
294
+ raise "VirtualMachine folder #{vmconf[:dest_dir]} not found" if vm_folder.nil?
295
+ vm = vm_folder.find(vm_name, RbVmomi::VIM::VirtualMachine)
296
+ raise "VirtualMachine #{vm_name} not found in #{vmconf[:dest_dir]}" if vm.nil?
297
+
298
+ begin
299
+ vm.PowerOffVM_Task.wait_for_completion
300
+ rescue RbVmomi::Fault => e
301
+ log.error "Fault attempting to power off node #{k}, #{e.message}"
302
+ ensure
303
+ begin
304
+ vm.Destroy_Task.wait_for_completion
305
+ rescue RbVmomi::Fault => e
306
+ log.error "Fault attempting to destroy node #{k}, #{e.message}"
307
+ end
308
+ end
309
+ else
138
310
  next
139
311
  end
140
- vm.PowerOffVM_Task.wait_for_completion
141
- vm.Destroy_Task.wait_for_completion
142
- else
143
- next
144
312
  end
145
313
  end
146
314
 
@@ -156,7 +324,7 @@ module RSpecSystem
156
324
  cmd = opts[:c]
157
325
 
158
326
  ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]
159
- ssh_exec!(ssh, "cd /tmp && sudo sh -c '#{cmd}'")
327
+ ssh_exec!(ssh, cmd)
160
328
  end
161
329
 
162
330
  # Transfer files to a host in the NodeSet.
@@ -171,20 +339,17 @@ module RSpecSystem
171
339
  source = opts[:sp]
172
340
  dest_path = opts[:dp]
173
341
 
174
- # Grab a remote path for temp transfer
175
- tmpdest = tmppath
176
-
177
342
  # Do the copy and print out results for debugging
178
343
  ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]
179
- ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true
180
-
181
- # Now we move the file into their final destination
182
- result = run(:n => opts[:d], :c => "mv #{tmpdest} #{dest_path}")
183
- if result[:exit_code] == 0
184
- return true
185
- else
186
- return false
344
+
345
+ begin
346
+ ssh.scp.upload! source.to_s, dest_path.to_s, :recursive => true
347
+ rescue => e
348
+ log.error("Error with scp of file #{source} to #{dest}:#{dest_path}")
349
+ raise e
187
350
  end
351
+
352
+ true
188
353
  end
189
354
 
190
355
  end
@@ -46,7 +46,7 @@
46
46
  box: 'centos-59-x64-vbox4210-nocm'
47
47
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box'
48
48
  vsphere:
49
- template: 'centos-59-x64-vs51-nocm'
49
+ template: 'centos-5-x86_64'
50
50
  'centos-63-x64':
51
51
  description: "Vagrant images obtained from http://puppet-vagrant-boxes.puppetlabs.com"
52
52
  facts:
@@ -92,7 +92,7 @@
92
92
  box: 'centos-64-x64-vbox4210-nocm'
93
93
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box'
94
94
  vsphere:
95
- template: 'centos-64-x64-vs51-nocm'
95
+ template: 'centos-6-x86_64'
96
96
  'fedora-18-x64':
97
97
  description: ""
98
98
  facts:
@@ -114,7 +114,7 @@
114
114
  box: 'fedora-18-x64-vbox4210-nocm'
115
115
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box'
116
116
  vsphere:
117
- template: 'fedora-18-x64-vs51-nocm'
117
+ template: 'fedora-18-x86_64'
118
118
  'debian-606-x64':
119
119
  description: "Vagrant images obtained from http://puppet-vagrant-boxes.puppetlabs.com"
120
120
  facts:
@@ -157,7 +157,7 @@
157
157
  box: 'debian-607-x64-vbox4210-nocm'
158
158
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box'
159
159
  vsphere:
160
- template: 'debian-607-x64-vs51-nocm'
160
+ template: 'debian-6-x86_64'
161
161
  'debian-70rc1-x64':
162
162
  description: ""
163
163
  facts:
@@ -181,7 +181,7 @@
181
181
  box: 'debian-70rc1-x64-vbox4210-nocm'
182
182
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box'
183
183
  vsphere:
184
- template: 'debian-70rc1-x64-vs51-nocm'
184
+ template: 'debian-7-x86_64'
185
185
  'ubuntu-server-1004-x64':
186
186
  description: ''
187
187
  facts:
@@ -227,7 +227,7 @@
227
227
  box: 'ubuntu-server-10044-x64-vbox4210-nocm'
228
228
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box'
229
229
  vsphere:
230
- template: 'ubuntu-server-10044-x64-vs51-nocm'
230
+ template: 'ubuntu-1004-x86_64'
231
231
  'ubuntu-server-1204-x64':
232
232
  description: ''
233
233
  facts:
@@ -273,7 +273,7 @@
273
273
  box: 'ubuntu-server-12042-x64-vbox4210-nocm'
274
274
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box'
275
275
  vsphere:
276
- template: 'ubuntu-server-12042-x64-vs51-nocm'
276
+ template: 'ubuntu-1204-x86_64'
277
277
  'sles-11sp1-x64':
278
278
  description: ''
279
279
  facts:
@@ -292,4 +292,4 @@
292
292
  box: 'sles-11sp1-x64-vbox4210-nocm'
293
293
  box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box'
294
294
  vsphere:
295
- template: 'sles-11sp1-x64-vs51-nocm'
295
+ template: 'sles-11-x86_64'
data/rspec-system.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # Metadata
4
4
  s.name = "rspec-system"
5
- s.version = "2.4.0"
5
+ s.version = "2.5.0"
6
6
  s.authors = ["Ken Barber"]
7
7
  s.email = ["info@puppetlabs.com"]
8
8
  s.homepage = "https://github.com/puppetlabs/rspec-system"
@@ -21,6 +21,7 @@ RSpec.configure do |c|
21
21
  c.include ::LocalHelpers
22
22
 
23
23
  c.before :suite do
24
+ shell 'echo "mesg n" >> ~/.profile'
24
25
  shell 'echo foobar > /tmp/setupblock'
25
26
  end
26
27
  end
@@ -56,17 +56,17 @@ describe "shell:" do
56
56
  end
57
57
 
58
58
  it 'escape all quotes properly' do
59
- shell 'rm -f ~vagrant/foo'
60
- shell "su - vagrant -c 'echo \"foo bar baz\" > ~/foo'" do |r|
59
+ shell 'rm -f ~/foo'
60
+ shell "bash -c 'echo \"foo bar baz\" > ~/foo'" do |r|
61
61
  r.stderr.should be_empty
62
62
  r.exit_code.should be_zero
63
63
  end
64
64
 
65
- shell 'cat ~vagrant/foo' do |r|
65
+ shell 'cat ~/foo' do |r|
66
66
  r.stdout.should =~ /foo bar baz/
67
67
  r.exit_code.should be_zero
68
68
  end
69
- shell 'rm -f ~vagrant/foo'
69
+ shell 'rm -f ~/foo'
70
70
  end
71
71
 
72
72
  it 'a string of commands should succeed' do
@@ -140,7 +140,7 @@ describe "shell:" do
140
140
  end
141
141
 
142
142
  it 'should complete fine if command completed within timeout' do
143
- shell(:c => 'sleep 1', :timeout => 5) do |r|
143
+ shell(:c => 'sleep 1', :timeout => 10) do |r|
144
144
  r.stdout.should == ''
145
145
  r.stderr.should == ''
146
146
  r.exit_code.should == 0
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: 2.4.0
4
+ version: 2.5.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-10-19 00:00:00.000000000 Z
12
+ date: 2013-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec