File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ platforms:
2626 driver_config :
2727 box : opscode-centos-5.9
2828 box_url : https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
29-
29+
3030- name : centos-6.4
3131 driver_config :
3232 box : opscode-centos-6.4
@@ -42,3 +42,13 @@ suites:
4242 run_list :
4343 - recipe[python]
4444 attributes : {python: {install_method: "source"}}
45+ - name : exert
46+ excludes : ["centos-5.9"]
47+ run_list :
48+ - recipe[python]
49+ - recipe[python_test::test_exert]
50+ - name : virtualenv
51+ excludes : ["centos-5.9"]
52+ run_list :
53+ - recipe[python]
54+ - recipe[python_test::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+ cookbook "python_test" , :path => "./test/cookbooks/python_test"
10+ 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+ python_test Cookbook
2+ ====================
3+
4+ This cookbook tests the pip and virtualenv providers
5+
6+ Requirements
7+ ------------
8+
9+ #### packages
10+ - ` python ` - Version * 2.5* or higher
11+
12+ License and Authors
13+ -------------------
14+ Authors: Scott Likens < scott@mopub.com >
15+ Sean Porter < portertech@gmail.com >
Original file line number Diff line number Diff line change 1+ name 'python_test'
2+ maintainer 'Scott Likens'
3+ maintainer_email 'scott@mopub.com'
4+ license 'Apache 2.0'
5+ description 'Installs/Configures python_test'
6+ long_description IO . read ( File . join ( File . dirname ( __FILE__ ) , 'README.md' ) )
7+ version '0.1.0'
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 " /usr/local/bin/python" ]
5+ }
6+
7+ @test " python should be version 2.7.5" {
8+ /usr/local/bin/python -c ' import sys; print sys.version' | grep ' 2.7.5'
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