This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from gds-operations/virtualenv_tests_with_aggr…
…egator Install to Python virtualenv
- Loading branch information
Showing
13 changed files
with
101 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
fixtures: | ||
repositories: | ||
stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git | ||
python: git://github.com/stankevich/puppet-python.git | ||
symlinks: | ||
graphite: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
# == Class: graphite::deps | ||
# | ||
# Class to install all graphite dependency packages | ||
# Class to create a Python virtualenv and install all graphite dependencies | ||
# within that sandbox. | ||
# | ||
# With the exception of pycairo which can't be installed by pip. It is | ||
# installed as a system package and symlinked into the virtualenv. This is a | ||
# slightly hacky alternative to `--system-site-packages` which would mess | ||
# with Graphite's other dependencies. | ||
# | ||
class graphite::deps { | ||
$root_dir = $::graphite::root_dir | ||
|
||
ensure_packages([ | ||
'python-ldap', | ||
'python-cairo', | ||
'python-django', | ||
'python-twisted', | ||
'python-django-tagging', | ||
'python-simplejson', | ||
'python-memcache', | ||
'python-pysqlite2', | ||
'python-support', | ||
'python-pip', | ||
python::virtualenv { $root_dir: } -> | ||
python::pip { [ | ||
'gunicorn', | ||
]) | ||
'twisted==11.1.0', | ||
'django==1.4.10', | ||
'django-tagging==0.3.1', | ||
'python-memcached==1.47', | ||
'simplejson==2.1.6', | ||
]: | ||
virtualenv => $root_dir, | ||
} | ||
|
||
ensure_packages(['python-cairo']) | ||
|
||
file { "${root_dir}/lib/python2.7/site-packages/cairo": | ||
ensure => link, | ||
target => '/usr/lib/python2.7/dist-packages/cairo', | ||
require => [ | ||
Python::Virtualenv[$root_dir], | ||
Package['python-cairo'], | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
require 'spec_helper' | ||
|
||
describe 'graphite::deps', :type => :class do | ||
describe 'graphite', :type => :class do | ||
|
||
[ | ||
'python-ldap', | ||
'python-cairo', | ||
'python-django', | ||
'python-twisted', | ||
'python-django-tagging', | ||
'python-simplejson', | ||
'python-memcache', | ||
'python-pysqlite2', | ||
'python-support', | ||
'python-pip', | ||
'gunicorn', | ||
].each do |pkg| | ||
it { | ||
should contain_package(pkg) | ||
} | ||
context 'root_dir' do | ||
let(:params) {{ | ||
:root_dir => '/this/is/root', | ||
}} | ||
|
||
it { should contain_python__virtualenv('/this/is/root') } | ||
it { should contain_python__pip('gunicorn').with_virtualenv('/this/is/root') } | ||
|
||
it { should contain_package('python-cairo').with_ensure('present') } | ||
it { should contain_file('/this/is/root/lib/python2.7/site-packages/cairo'). | ||
with_ensure('link'). | ||
with_target('/usr/lib/python2.7/dist-packages/cairo'). | ||
with_require(['Python::Virtualenv[/this/is/root]', 'Package[python-cairo]']) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
require 'spec_helper' | ||
|
||
shared_examples "pip_package" do |package| | ||
it { should contain_python__pip("#{package}==1.2.3"). | ||
with_virtualenv('/this/is/root'). | ||
with_environment(["PYTHONPATH=/this/is/root/lib:/this/is/root/webapp"]) } | ||
end | ||
|
||
describe 'graphite', :type => :class do | ||
let(:version) { '0.9.12' } | ||
context 'root_dir and version' do | ||
let(:params) {{ | ||
:version => '1.2.3', | ||
:root_dir => '/this/is/root', | ||
}} | ||
|
||
it { should contain_package('whisper').with_ensure(version) } | ||
it { should contain_exec('graphite/install carbon'). | ||
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/lib\" carbon==#{version}") } | ||
it { should contain_exec('graphite/install graphite-web'). | ||
with_command("/usr/bin/pip install --install-option=\"--prefix=/opt/graphite\" --install-option=\"--install-lib=/opt/graphite/webapp\" graphite-web==#{version}") } | ||
it_should_behave_like "pip_package", "whisper" | ||
it_should_behave_like "pip_package", "carbon" | ||
it_should_behave_like "pip_package", "graphite-web" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters