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

rspec mock systemd process on docker #128

Merged
merged 2 commits into from
Mar 9, 2022

Conversation

traylenator
Copy link
Collaborator

Pull Request (PR) description

On docker rspec the service provider is autodetected as redhat
rather than systemd.

https://tickets.puppetlabs.com/browse/PUP-11167

That causes

error during compilation: Parameter enable failed on Service[firewalld]: Provider redhat must have features 'maskable' to set 'enable' to 'mask' (file: /builds/ai/it
pet-module-nftables/code/spec/fixtures/modules/nftables/manifests/init.pp, line: 186)

mock the systemd process so that the systemd provider is used.

Also migrate existing mocks away from deprecated mocha.

@traylenator traylenator force-pushed the systemd branch 2 times, most recently from d8e39a2 to 85f095d Compare March 8, 2022 07:32
c.before do
# select the systemd service provider even when on docker
# https://tickets.puppetlabs.com/browse/PUP-11167
if defined?(facts) and %w[Archlinux RedHat].include?(facts[:os]['family'])
Copy link
Member

Choose a reason for hiding this comment

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

why limit to to those two OSes? shouldn't we do it on all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Was thinking someone might add slackware at some future date and then you might get the wrong service provider.
Archlinux, RedHat is everything in metadata.yml today so for sure not against changing.

On docker rspec the service provider is autodetected as redhat
rather than systemd.

https://tickets.puppetlabs.com/browse/PUP-11167

That causes

```
error during compilation: Parameter enable failed on Service[firewalld]: Provider redhat must have features 'maskable' to set 'enable' to 'mask' (file: /builds/ai/it-puppet-module-nftables/code/spec/fixtures/modules/nftables/manifests/init.pp, line: 186)
```

mock the systemd process so that the systemd provider is used.
Copy link
Collaborator

@nbarrientos nbarrientos left a comment

Choose a reason for hiding this comment

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

LGTM. Won't merge, though. Waiting for @bastelfreak's pending comment.

@bastelfreak bastelfreak merged commit 817e064 into voxpupuli:master Mar 9, 2022
@traylenator traylenator deleted the systemd branch March 9, 2022 09:15
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

Successfully merging this pull request may close these issues.

3 participants