Skip to content

Commit 64620b7

Browse files
committed
Remove OSX spec options as they do not work
- remove conditionality for macOS (nee OSX) - add `skip` for tests which are not runnable on macOS - update README
1 parent 2d11ae2 commit 64620b7

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@ cd /opt/bosh/bosh-stemcell
177177
OS_IMAGE=/opt/bosh/tmp/ubuntu_base_image.tgz bundle exec rake spec:shellout_types
178178
```
179179

180-
If on macOS, run:
181-
182-
```shell
183-
OSX=true OS_IMAGE=/opt/bosh/tmp/ubuntu_base_image.tgz bundle exec rake spec:shellout_types
184-
```
185-
186180
### How to run tests for BOSH Linux Stemcell Builder
187181

188182
The BOSH Linux Stemcell Builder code itself can be tested with the following command's:

bosh-stemcell/spec/bosh/stemcell/helpers_sh_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require 'spec_helper'
22

33
context 'helpers.sh' do
4+
before do
5+
skip "This spec requires linux" unless RUBY_PLATFORM.downcase.include?("linux")
6+
end
47

58
context 'add_on_exit runs cleanup commands in LIFO order' do
69
describe ShelloutTypes::Command.new(

bosh-stemcell/spec/shellout_types/spec_helper.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
require 'shellout_types/chroot'
44
require 'tmpdir'
55

6+
def supported_testing_os?
7+
RUBY_PLATFORM.downcase.include?("linux")
8+
end
69

710
RSpec.configure do |config|
811
if config.inclusion_filter[:shellout_types]
12+
config.before(:suite) do
13+
raise "Running 'shellout_types' specs on '#{RUBY_PLATFORM}' is not supported" unless supported_testing_os?
14+
end
15+
916
if ENV['OS_IMAGE']
1017
@os_image_dir = Dir.mktmpdir('os-image-rspec')
1118
ShelloutTypes::Chroot.chroot_dir = @os_image_dir
@@ -15,11 +22,7 @@
1522
Bosh::Core::Shell.new.run("sudo tar zxf #{ENV['OS_IMAGE']} -C #{config.os_image_dir}")
1623
Bosh::Core::Shell.new.run("sudo chgrp -Rh $(id -g) #{config.os_image_dir}")
1724
Bosh::Core::Shell.new.run("sudo chmod 775 #{config.os_image_dir}")
18-
if ENV['OSX']
19-
Bosh::Core::Shell.new.run("sudo chroot #{config.os_image_dir} /bin/bash -c \"useradd --uid $(id -u) -G nogroup shellout\"")
20-
else
21-
Bosh::Core::Shell.new.run("sudo chroot #{config.os_image_dir} /bin/bash -c 'useradd -G nogroup shellout'")
22-
end
25+
Bosh::Core::Shell.new.run("sudo chroot #{config.os_image_dir} /bin/bash -c 'useradd -G nogroup shellout'")
2326
end
2427

2528
config.after(:suite) do

0 commit comments

Comments
 (0)