File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <<<<<<< HEAD
12.vagrant
23Berksfile.lock
34* ~
1415.bundle /*
1516.kitchen /
1617.kitchen.local.yml
18+ =======
19+ .bundle /
20+ .kitchen /
21+ .kitchen.local.yml
22+ * .lock
23+ >>>>>>> - Improve the testing of the Python Cookbook
Original file line number Diff line number Diff line change @@ -42,3 +42,11 @@ suites:
4242 run_list :
4343 - recipe[python]
4444 attributes : {python: {install_method: "source"}}
45+ - name : exert
46+ run_list :
47+ - recipe[python]
48+ - recipe[python::test_exert]
49+ - name : virtualenv
50+ run_list :
51+ - recipe[python]
52+ - recipe[python::test_virtualenv]
Original file line number Diff line number Diff line change 55group :integration do
66 cookbook "apt"
77 cookbook "yum"
8- end
8+ cookbook "build-essential"
9+ end
Original file line number Diff line number Diff line change 1+ source 'https://rubygems.org'
2+
3+ gem 'rake'
4+ gem 'rspec'
5+ gem 'foodcritic'
6+ gem 'berkshelf'
7+ gem 'thor-foodcritic'
8+ gem 'vagrant-wrapper'
9+
10+ group :integration do
11+ gem 'test-kitchen' , :git => "git://github.com/opscode/test-kitchen.git"
12+ gem 'kitchen-vagrant' , :git => "git://github.com/opscode/kitchen-vagrant.git"
13+ gem 'kitchen-ec2' , :git => "git://github.com/opscode/kitchen-ec2.git"
14+ gem 'kitchen-lxc' , :git => "https://github.com/portertech/kitchen-lxc.git" , :tag => 'v0.0.1.beta2'
15+ end
Original file line number Diff line number Diff line change 1+ #
2+ # Author:: Scott M. Likens <scott@mopub.com>
3+ # Cookbook Name:: python
4+ # Recipe:: test_exert
5+ #
6+ # Copyright 2013, MoPub, Inc.
7+ #
8+ # Licensed under the Apache License, Version 2.0 (the "License");
9+ # you may not use this file except in compliance with the License.
10+ # You may obtain a copy of the License at
11+ #
12+ # http://www.apache.org/licenses/LICENSE-2.0
13+ #
14+ # Unless required by applicable law or agreed to in writing, software
15+ # distributed under the License is distributed on an "AS IS" BASIS,
16+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+ # See the License for the specific language governing permissions and
18+ # limitations under the License.
19+ #
20+
21+ python_virtualenv "#{ Chef ::Config [ :file_cache_path ] } /virtualenv" do
22+ interpreter "python"
23+ owner "root"
24+ group "root"
25+ action :create
26+ end
27+
28+ python_pip "boto" do
29+ action :install
30+ virtualenv "#{ Chef ::Config [ :file_cache_path ] } /virtualenv"
31+ end
32+
33+ python_pip "psutil" do
34+ action :install
35+ end
36+
Original file line number Diff line number Diff line change 1+ #
2+ # Author:: Sean Porter <portertech@hw-ops.com>
3+ # Cookbook Name:: python
4+ # Recipe:: test_virtualenv
5+ #
6+ # Copyright 2013, Heavy Water Operations, LLC.
7+ #
8+ # Licensed under the Apache License, Version 2.0 (the "License");
9+ # you may not use this file except in compliance with the License.
10+ # You may obtain a copy of the License at
11+ #
12+ # http://www.apache.org/licenses/LICENSE-2.0
13+ #
14+ # Unless required by applicable law or agreed to in writing, software
15+ # distributed under the License is distributed on an "AS IS" BASIS,
16+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+ # See the License for the specific language governing permissions and
18+ # limitations under the License.
19+ #
20+
21+ python_virtualenv "/tmp/virtualenv" do
22+ interpreter "python"
23+ owner "root"
24+ group "root"
25+ action :create
26+ end
27+
28+ python_virtualenv "isolated python environment" do
29+ path "/tmp/tobedestroyed"
30+ interpreter "python"
31+ action :create
32+ end
33+
34+ python_virtualenv "deleting the isolated python environment" do
35+ path "/tmp/tobedestroyed"
36+ action :delete
37+ end
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ @test " virtualenv test environment should exist" {
4+ [ -f " /tmp/kitchen-chef-solo/cache/virtualenv/bin/activate" ]
5+ }
6+
7+ @test " virtualenv test environment should be owned by root" {
8+ ls -l /tmp/kitchen-chef-solo/cache/virtualenv | grep " root root"
9+ }
10+
11+ @test " virtualenv test environment should have boto working" {
12+ /tmp/kitchen-chef-solo/cache/virtualenv/bin/python -c ' import boto; boto.Version'
13+ }
14+
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ @test " python bin should exist" {
4+ [ -x " /opt/bin/python" ]
5+ }
6+
7+ @test " python should be version 2.7.1" {
8+ /opt/bin/python -c ' import sys; print sys.version' | grep ' 2.7.1'
9+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ @test " virtualenv test environment should exist" {
4+ [ -f " /tmp/virtualenv/bin/activate" ]
5+ }
6+
7+ @test " virtualenv test environment should be owned by root" {
8+ ls -l /tmp/virtualenv | grep " root root"
9+ }
10+
11+ @test " virtualenv test environment should have a working python" {
12+ /tmp/virtualenv/bin/python -c ' import sys; print sys.version'
13+ }
14+
15+ @test " virtualenv resource should be able to delete an environment" {
16+ [ ! -d " /tmp/tobedestroyed" ]
17+ }
You can’t perform that action at this time.
0 commit comments