Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get tests working on master #266

Merged
merged 1 commit into from
Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group :test, :integration do
end

group :test do
gem 'chefspec', '~> 4.0.0'
gem 'chefspec', '~> 4.2.0'
# elecksee is lxc dependency
gem 'elecksee', '~> 1.0.20'
gem 'foodcritic', '~> 3.0.3'
Expand Down
13 changes: 10 additions & 3 deletions libraries/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
if defined?(ChefSpec)
# Docker matchers
ChefSpec::Runner.define_runner_method(:docker_container)
ChefSpec::Runner.define_runner_method(:docker_image)
ChefSpec::Runner.define_runner_method(:docker_registry)
chefspec_version = Gem.loaded_specs['chefspec'].version
if chefspec_version < Gem::Version.new('4.1.0')
ChefSpec::Runner.define_runner_method(:docker_container)
ChefSpec::Runner.define_runner_method(:docker_image)
ChefSpec::Runner.define_runner_method(:docker_registry)
else
ChefSpec.define_matcher(:docker_container)
ChefSpec.define_matcher(:docker_image)
ChefSpec.define_matcher(:docker_registry)
end

# Docker registry
def login_docker_registry(resource_name)
Expand Down
2 changes: 1 addition & 1 deletion spec/aufs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'includes the aufs recipe' do
Expand Down
6 changes: 3 additions & 3 deletions spec/binary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'docker::binary' do
context 'by default' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.automatic['kernel']['release'] = '3.8.0'
end.converge(described_recipe)
end
Expand All @@ -15,7 +15,7 @@

context 'when install_dir is set' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.normal['docker']['install_dir'] = '/tmp'
node.automatic['kernel']['release'] = '3.8.0'
end.converge(described_recipe)
Expand All @@ -28,7 +28,7 @@

context 'when install_type is binary' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.normal['docker']['install_type'] = 'binary'
node.automatic['kernel']['release'] = '3.8.0'
end.converge(described_recipe)
Expand Down
8 changes: 4 additions & 4 deletions spec/cgroups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'docker::cgroups' do
context 'when running on oracle 6.5' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'oracle', version: '6.5').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'oracle', version: '6.5').converge(described_recipe)
end

it 'installs the libcgroup package' do
Expand All @@ -18,7 +18,7 @@

context 'when running on any ubuntu platform' do
let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'should install the cgroup-bin package' do
Expand All @@ -28,7 +28,7 @@

context 'when running on ubuntu 12.04' do
let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'should start the cgconfig service' do
Expand All @@ -42,7 +42,7 @@

context 'when running on other ubuntu platforms' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '14.04').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04').converge(described_recipe)
end

it 'should start the cgroup-lite service' do
Expand Down
20 changes: 10 additions & 10 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

context 'when running on ubuntu 12.04' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['docker']['alert_on_error_action'] = :warn
end.converge(described_recipe)
end
Expand All @@ -46,7 +46,7 @@

context 'when running on debian 7.4' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'debian', version: '7.4') do |node|
ChefSpec::SoloRunner.new(platform: 'debian', version: '7.4') do |node|
node.set['docker']['alert_on_error_action'] = :warn
end.converge(described_recipe)
end
Expand Down Expand Up @@ -74,7 +74,7 @@

context 'when exec_driver is lxc' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['exec_driver'] = 'lxc'
end.converge(described_recipe)
Expand All @@ -91,7 +91,7 @@

context 'when install_type is binary' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['install_type'] = 'binary'
end.converge(described_recipe)
Expand All @@ -112,7 +112,7 @@
it 'installs the XZ Utilities package' do
expect(chef_run).to install_package('xz-utils')

rhel_run = ChefSpec::Runner.new(platform: 'redhat', version: '6.5') do |node|
rhel_run = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5') do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['install_type'] = 'binary'
node.automatic['kernel']['release'] = '3.8.0'
Expand All @@ -133,7 +133,7 @@
context 'when running on ubuntu < 13.10' do
context 'and install_type is binary and storage_driver is aufs' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['install_type'] = 'binary'
node.set['docker']['storage_driver'] = 'aufs'
Expand All @@ -148,7 +148,7 @@

context 'when running on ubuntu > 13.10' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '14.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['install_type'] = 'binary'
node.set['docker']['storage_driver'] = 'aufs'
Expand All @@ -162,7 +162,7 @@

context 'when install_type is source' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['install_type'] = 'source'
end.converge(described_recipe)
Expand All @@ -183,7 +183,7 @@

context 'when the install_type is package' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['alert_on_error_action'] = :warn
end.converge(described_recipe)
end
Expand All @@ -196,7 +196,7 @@
%w( runit systemd sysv ).each do |init|
context "when init_type is #{init}" do
let(:chef_run) do
ChefSpec::Runner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.set['docker']['graph'] = '/var/lib/docker'
node.set['docker']['alert_on_error_action'] = :warn
node.set['docker']['init_type'] = init
Expand Down
14 changes: 7 additions & 7 deletions spec/dep_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'docker::dep_check' do
context 'when running on darwin' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'mac_os_x', version: '10.9.2').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'mac_os_x', version: '10.9.2').converge(described_recipe)
end

before do
Expand All @@ -22,7 +22,7 @@

context 'when running debian' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.automatic['kernel']['release'] = '3.2.0-26-generic'
end.converge(described_recipe)
end
Expand All @@ -35,7 +35,7 @@
context 'when running on redhat' do
context 'with 32bit archtiecture' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'redhat', version: '6.5') do |node|
ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5') do |node|
node.automatic['kernel']['machine'] = 'i386'
end.converge(described_recipe)
end
Expand All @@ -47,7 +47,7 @@

context 'with platform < 6.5' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'redhat', version: '5.8').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'redhat', version: '5.8').converge(described_recipe)
end

it 'should fail' do
Expand All @@ -57,7 +57,7 @@

context 'installing as binary on kernel < 3.8' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'redhat', version: '6.5') do |node|
ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5') do |node|
node.set['docker']['install_type'] = 'binary'
node.automatic['kernel']['release'] = '2.6.32-431'
end.converge(described_recipe)
Expand All @@ -70,7 +70,7 @@

context 'with kernel version < 2.6.32' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'redhat', version: '6.5') do |node|
ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5') do |node|
node.automatic['kernel']['release'] = '2.6.18-308.1.1.el5'
end.converge(described_recipe)
end
Expand All @@ -84,7 +84,7 @@
context 'when running on suse' do
context 'on 32bit arch' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'opensuse', version: '12.3') do |node|
ChefSpec::SoloRunner.new(platform: 'opensuse', version: '12.3') do |node|
node.automatic['kernel']['machine'] = 'i386'
end.converge(described_recipe)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/devicemapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'docker::devicemapper' do
let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'includes the device-mapper recipe' do
Expand Down
6 changes: 3 additions & 3 deletions spec/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'docker::group' do
let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'creates the docker group' do
Expand All @@ -15,7 +15,7 @@

context 'when group is set' do
let(:chef_run) do
runner = ChefSpec::Runner.new
runner = ChefSpec::SoloRunner.new
runner.node.set['docker']['group'] = 'vagrant'
runner.converge(described_recipe)
end
Expand All @@ -31,7 +31,7 @@

context 'when group_members is set' do
let(:chef_run) do
runner = ChefSpec::Runner.new
runner = ChefSpec::SoloRunner.new
runner.node.set['docker']['group_members'] = ['vagrant']
runner.converge(described_recipe)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lxc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
context 'when running on debian' do
it_behaves_like 'a non-ubuntu platform' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'debian', version: '7.4').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'debian', version: '7.4').converge(described_recipe)
end
end
end

context 'when running on oracle' do
it_behaves_like 'a non-ubuntu platform' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'oracle', version: '6.5').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'oracle', version: '6.5').converge(described_recipe)
end
end
end

context 'when running on ubuntu' do
let(:chef_run) do
ChefSpec::Runner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'includes the lxc recipe' do
Expand Down
16 changes: 8 additions & 8 deletions spec/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@
context 'when running on centos' do
it_behaves_like 'a yum-based system' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: '6.5').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'centos', version: '6.5').converge(described_recipe)
end
end
end

context 'when running on redhat' do
it_behaves_like 'a yum-based system' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'redhat', version: '6.5').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5').converge(described_recipe)
end
end
end

context 'when running on debian' do
it_behaves_like 'an apt-based system' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'debian', version: '7.4').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'debian', version: '7.4').converge(described_recipe)
end
let(:chef_run2) do
runner = ChefSpec::Runner.new(platform: 'debian', version: '7.4')
runner = ChefSpec::SoloRunner.new(platform: 'debian', version: '7.4')
runner.node.set['docker']['version'] = '0.9.1'
runner.converge(described_recipe)
end
Expand All @@ -64,10 +64,10 @@
context 'when running on ubuntu' do
it_behaves_like 'an apt-based system' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe)
end
let(:chef_run2) do
runner = ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04')
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04')
runner.node.set['docker']['version'] = '0.9.1'
runner.converge(described_recipe)
end
Expand All @@ -76,7 +76,7 @@

context 'when running on fedora' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'fedora', version: '19').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'fedora', version: '19').converge(described_recipe)
end

it 'should install the docker-io package' do
Expand All @@ -86,7 +86,7 @@

context 'when running on mac_os_x' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'mac_os_x', version: '10.9.2').converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'mac_os_x', version: '10.9.2').converge(described_recipe)
end

it 'should tap the homebrew/binary cask' do
Expand Down