Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance pyvenv tests #590

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions spec/acceptance/pyvenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,46 @@ class { 'python':
apply_manifest(pp, catch_changes: true)
end
end

context 'with versioned minimal python::pip and without systempkgs' do
bastelfreak marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind adding it, but rubocop doesn't complain at the moment:

$ bundle exec rake rubocop:auto_correct
Running RuboCop...
Inspecting 20 files
Parser::Source::Rewriter is deprecated.
Please update your code to use Parser::Source::TreeRewriter instead
....................

20 files inspected, no offenses detected

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does make it harder to read. I'd say to add the space and then consider adding that check to modulesync

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind adding it, but rubocop doesn't complain at the moment:

I suspect this is because the version is too old to contain it.

its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} }
end
end
end