From 8e3ae070db337730369f26ec8996c11007c2344b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 7 Dec 2020 17:21:13 +0100 Subject: [PATCH] enhance pyvenv tests --- spec/acceptance/pyvenv_spec.rb | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index 1b9ad1f3..bbc7b8a8 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -143,4 +143,45 @@ class { 'python': apply_manifest(pp, catch_changes: true) end end + + context 'with versioned minimal python::pip and without systempkgs' do + it 'works with no errors' do + pp = <<-PUPPET + 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 => false, + owner => 'agent', + group => 'agent', + mode => '0755', + } + python::pip { 'agent' : + ensure => '0.1.2', + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + describe command('/opt/agent/venv/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } + end + end end