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

How do I test against different OSes? #276

Open
rnelson0 opened this issue Aug 5, 2020 · 0 comments
Open

How do I test against different OSes? #276

rnelson0 opened this issue Aug 5, 2020 · 0 comments

Comments

@rnelson0
Copy link
Member

rnelson0 commented Aug 5, 2020

I'm new to using onceover but familiar with using the PDK, where the combination of metadata.json and rspec-puppet-facts lets me loop through all supported OSes:

describe 'profiles::base' do
  on_supported_os.each do |os, os_facts|
    context "on #{os}" do
      let(:facts) { os_facts }
...

In onceover, this generates errors because rspec-puppet-facts is not present:

An error occurred while loading ./spec/classes/profiles/base_spec.rb.
Failure/Error:
    on_supported_os.each do |os, os_facts|
      context "on #{os}" do
        let(:facts) { os_facts }
  
        it { is_expected.to compile }
  
        it { is_expected.to contain_class('ca_cert') }
        it { is_expected.to contain_class('sssd') }
        it { is_expected.to contain_class('access') }
        it { is_expected.to contain_class('sudo') }

NameError:
  undefined local variable or method `on_supported_os' for RSpec::ExampleGroups::ProfilesBase:Class
# ./spec/classes/profiles/base_spec.rb:4:in `block in <top (required)>'
# ./spec/classes/profiles/base_spec.rb:3:in `<top (required)>'

What is the recommended way to perform a test against multiple OSes (e.g. RedHat family v7 and v8)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant