forked from voxpupuli/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validates given virtualenv path is valid
The issue was from voxpupuli#165, the virtualenv given didn't give the full path, we now fail early to catch this. Also adds an rspec to catch this, and a beaker test based on the scenario given in voxpupuli#165
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'python class' do | ||
|
||
context 'default parameters' do | ||
# Using puppet_apply as a helper | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
class { 'python' : | ||
version => 'system', | ||
pip => true, | ||
virtualenv => true, | ||
} | ||
-> | ||
python::virtualenv { 'venv' : | ||
ensure => present, | ||
systempkgs => false, | ||
venv_dir => '/opt/venv', | ||
owner => 'root', | ||
group => 'root', | ||
} | ||
-> | ||
python::pip { 'rpyc' : | ||
ensure => '3.2.3', | ||
virtualenv => '/opt/venv', | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
describe 'python::pip', :type => :define do | ||
let (:title) { 'rpyc' } | ||
context "on Debian OS" do | ||
let :facts do | ||
{ | ||
:id => 'root', | ||
:kernel => 'Linux', | ||
:lsbdistcodename => 'squeeze', | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
:operatingsystemrelease => '6', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
|
||
describe "virtualenv as" do | ||
context "fails with non qualified path" do | ||
let (:params) {{ :virtualenv => "venv" }} | ||
it { is_expected.to raise_error(/"venv" is not an absolute path./) } | ||
end | ||
context "suceeds with qualified path" do | ||
let (:params) {{ :virtualenv => "/opt/venv" }} | ||
it { is_expected.to contain_exec("pip_install_rpyc").with_cwd('/opt/venv') } | ||
end | ||
context "defaults to system" do | ||
let (:params) {{ }} | ||
it { is_expected.to contain_exec("pip_install_rpyc").with_cwd('/') } | ||
end | ||
end | ||
end | ||
end |