Skip to content

Commit 78e746b

Browse files
committed
Add pyvenv acceptance test
1 parent 22c5f8d commit 78e746b

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

spec/acceptance/pyvenv_spec.rb

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'python::pyvenv defined resource' do
4+
context 'minimal parameters' do
5+
# Using puppet_apply as a helper
6+
it 'works with no errors' do
7+
pp = <<-EOS
8+
class { 'python':
9+
version => '3',
10+
dev => 'present',
11+
}
12+
user { 'agent':
13+
ensure => 'present',
14+
managehome => true,
15+
home => '/opt/agent',
16+
}
17+
group { 'agent':
18+
ensure => 'present',
19+
system => true,
20+
}
21+
python::pyvenv { '/opt/agent/venv':
22+
ensure => 'present',
23+
systempkgs => true,
24+
owner => 'agent',
25+
group => 'agent',
26+
mode => '0755',
27+
}
28+
EOS
29+
30+
# Run it twice and test for idempotency
31+
apply_manifest(pp, catch_failures: true)
32+
apply_manifest(pp, catch_changes: true)
33+
end
34+
end
35+
context 'with python::pip' do
36+
it 'works with no errors' do
37+
pp = <<-EOS
38+
class { 'python':
39+
version => '3',
40+
dev => 'present',
41+
}
42+
user { 'agent':
43+
ensure => 'present',
44+
managehome => true,
45+
home => '/opt/agent',
46+
}
47+
group { 'agent':
48+
ensure => 'present',
49+
system => true,
50+
}
51+
python::pyvenv { '/opt/agent/venv':
52+
ensure => 'present',
53+
systempkgs => true,
54+
owner => 'agent',
55+
group => 'agent',
56+
mode => '0755',
57+
}
58+
python::pip { 'agent' :
59+
ensure => 'latest',
60+
pkgname => 'agent',
61+
pip_provider => 'pip',
62+
virtualenv => '/opt/agent/venv',
63+
owner => 'agent',
64+
group => 'agent',
65+
}
66+
EOS
67+
68+
# Run it twice and test for idempotency
69+
apply_manifest(pp, catch_failures: true)
70+
apply_manifest(pp, catch_changes: true)
71+
end
72+
end
73+
context 'with minimal python::pip' do
74+
it 'works with no errors' do
75+
pp = <<-EOS
76+
class { 'python':
77+
version => '3',
78+
dev => 'present',
79+
}
80+
user { 'agent':
81+
ensure => 'present',
82+
managehome => true,
83+
home => '/opt/agent',
84+
}
85+
group { 'agent':
86+
ensure => 'present',
87+
system => true,
88+
}
89+
python::pyvenv { '/opt/agent/venv':
90+
ensure => 'present',
91+
systempkgs => true,
92+
owner => 'agent',
93+
group => 'agent',
94+
mode => '0755',
95+
}
96+
python::pip { 'agent' :
97+
virtualenv => '/opt/agent/venv',
98+
owner => 'agent',
99+
group => 'agent',
100+
}
101+
EOS
102+
103+
# Run it twice and test for idempotency
104+
apply_manifest(pp, catch_failures: true)
105+
apply_manifest(pp, catch_changes: true)
106+
end
107+
end
108+
end

0 commit comments

Comments
 (0)