Skip to content

Commit

Permalink
Add pyvenv acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Dec 3, 2020
1 parent 22c5f8d commit 78e746b
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions spec/acceptance/pyvenv_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
require 'spec_helper_acceptance'

describe 'python::pyvenv defined resource' do
context 'minimal parameters' do
# Using puppet_apply as a helper
it 'works with no errors' do
pp = <<-EOS
class { 'python':
version => '3',
dev => 'present',
}
user { 'agent':
ensure => 'present',
managehome => true,
home => '/opt/agent',
}
group { 'agent':
ensure => 'present',
system => true,
}
python::pyvenv { '/opt/agent/venv':
ensure => 'present',
systempkgs => true,
owner => 'agent',
group => 'agent',
mode => '0755',
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
context 'with python::pip' do
it 'works with no errors' do
pp = <<-EOS
class { 'python':
version => '3',
dev => 'present',
}
user { 'agent':
ensure => 'present',
managehome => true,
home => '/opt/agent',
}
group { 'agent':
ensure => 'present',
system => true,
}
python::pyvenv { '/opt/agent/venv':
ensure => 'present',
systempkgs => true,
owner => 'agent',
group => 'agent',
mode => '0755',
}
python::pip { 'agent' :
ensure => 'latest',
pkgname => 'agent',
pip_provider => 'pip',
virtualenv => '/opt/agent/venv',
owner => 'agent',
group => 'agent',
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
context 'with minimal python::pip' do
it 'works with no errors' do
pp = <<-EOS
class { 'python':
version => '3',
dev => 'present',
}
user { 'agent':
ensure => 'present',
managehome => true,
home => '/opt/agent',
}
group { 'agent':
ensure => 'present',
system => true,
}
python::pyvenv { '/opt/agent/venv':
ensure => 'present',
systempkgs => true,
owner => 'agent',
group => 'agent',
mode => '0755',
}
python::pip { 'agent' :
virtualenv => '/opt/agent/venv',
owner => 'agent',
group => 'agent',
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
end

0 comments on commit 78e746b

Please sign in to comment.