Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2296df3

Browse files
committed
Add kitchen test for docker
1 parent 711e4d9 commit 2296df3

File tree

10 files changed

+30
-39
lines changed

10 files changed

+30
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ bin/*
1212
.bundle/*
1313
.kitchen/
1414
.kitchen.local.yml
15+
Berksfile.lock

.kitchen.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
driver:
3+
name: docker
4+
require_chef_omnibus: "<%= ENV['CHEF_VERSION'] || 'latest' %>"

.kitchen.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ driver_plugin: vagrant
33
driver_config:
44
require_chef_omnibus: true
55

6+
chef_versions:
7+
- 11.10
8+
- 12
9+
610
platforms:
711
- name: ubuntu-12.10
812
driver_config:
@@ -22,15 +26,21 @@ platforms:
2226
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
2327
run_list: ["recipe[apt]"]
2428

29+
- name: ubuntu-14.04
30+
driver_config:
31+
box: opscode-ubuntu-14.04
32+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-14.04_provisionerless.box
33+
run_list: ["recipe[apt]"]
34+
2535
- name: centos-5.9
2636
driver_config:
2737
box: opscode-centos-5.9
2838
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
2939

30-
- name: centos-6.4
40+
- name: centos-6.7
3141
driver_config:
32-
box: opscode-centos-6.4
33-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
42+
box: opscode-centos-6.7
43+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.7_provisionerless.box
3444

3545
suites:
3646
- name: default

Berksfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site 'https://supermarket.chef.io'
1+
source 'https://api.berkshelf.com'
22

33
metadata
44

Berksfile.lock

Lines changed: 0 additions & 25 deletions
This file was deleted.

Gemfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
source 'https://rubygems.org'
22

3-
gem 'foodcritic', '>= 3.0.3'
4-
gem 'berkshelf', '~> 2.0'
5-
gem 'chefspec', '~> 3.0'
3+
gem 'foodcritic'
4+
gem 'berkshelf'
5+
gem 'chefspec'
6+
gem 'kitchen-docker'

recipes/package.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
else
3030
python_pkgs = value_for_platform_family(
3131
"debian" => ["python","python-dev"],
32-
"rhel" => ["python","python-devel"],
32+
"rhel" => ["python","python-devel",'gcc'],
3333
"fedora" => ["python","python-devel"],
3434
"freebsd" => ["python"],
3535
"smartos" => ["python27"],

recipes/source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
make_options = node['python']['make_options'].join(" ")
2525

2626
packages = value_for_platform_family(
27-
"rhel" => ["openssl-devel","bzip2-devel","zlib-devel","expat-devel","db4-devel","sqlite-devel","ncurses-devel","readline-devel"],
27+
"rhel" => ["openssl-devel","bzip2-devel","zlib-devel","expat-devel","db4-devel","sqlite-devel","ncurses-devel","readline-devel",'tar'],
2828
"default" => ["libssl-dev","libbz2-dev","zlib1g-dev","libexpat1-dev","libdb-dev","libsqlite3-dev","libncursesw5-dev","libncurses5-dev","libreadline-dev","libsasl2-dev", "libgdbm-dev"]
2929
)
3030
#

test/cookbooks/python_test/recipes/test_exert.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# limitations under the License.
1919
#
2020

21-
python_virtualenv "#{Chef::Config[:file_cache_path]}/virtualenv" do
21+
python_virtualenv "/tmp/kitchen/virtualenv" do
2222
interpreter "python"
2323
owner "root"
2424
group "root"
@@ -27,7 +27,7 @@
2727

2828
python_pip "boto" do
2929
action :install
30-
virtualenv "#{Chef::Config[:file_cache_path]}/virtualenv"
30+
virtualenv "/tmp/kitchen/virtualenv"
3131
end
3232

3333
python_pip "psutil" do
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bats
22

33
@test "virtualenv test environment should exist" {
4-
[ -f "/tmp/kitchen-chef-solo/cache/virtualenv/bin/activate" ]
4+
[ -f "/tmp/kitchen/virtualenv/bin/activate" ]
55
}
66

77
@test "virtualenv test environment should be owned by root" {
8-
ls -l /tmp/kitchen-chef-solo/cache/virtualenv | grep "root root"
8+
ls -l /tmp/kitchen/virtualenv | grep "root root"
99
}
1010

1111
@test "virtualenv test environment should have boto working" {
12-
/tmp/kitchen-chef-solo/cache/virtualenv/bin/python -c 'import boto; boto.Version'
12+
/tmp/kitchen/virtualenv/bin/python -c 'import boto; boto.Version'
1313
}

0 commit comments

Comments
 (0)