forked from CERIT-SC/puppet-yum
-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'yum::copr' do | ||
context 'when @caddy/caddy and copart/restic are enabled' do | ||
# Using puppet_apply as a helper | ||
it 'must work idempotently with no errors' do | ||
pp = <<-PUPPET | ||
yum::copr { ['@caddy/caddy', 'copart/restic']: } | ||
PUPPET | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
describe command('dnf copr list') do | ||
its(:stdout) { is_expected.to match(%r{^copr.fedorainfracloud.org/copart/restic$}) } | ||
its(:stdout) { is_expected.to match(%r{^copr.fedorainfracloud.org/group_caddy/caddy$}) } | ||
end | ||
end | ||
|
||
context 'when copart/restic is disabled' do | ||
# Using puppet_apply as a helper | ||
it 'must work idempotently with no errors' do | ||
pp = <<-PUPPET | ||
yum::copr { ['@caddy/caddy', 'copart/restic']: | ||
ensure => 'disabled', | ||
} | ||
PUPPET | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
describe command('dnf copr list') do | ||
its(:stdout) { is_expected.to match(%r{^copr.fedorainfracloud.org/copart/restic \(disabled\)$}) } | ||
its(:stdout) { is_expected.to match(%r{^copr.fedorainfracloud.org/group_caddy/caddy \(disabled\)$}) } | ||
end | ||
end | ||
|
||
context 'when copart/restic is removed' do | ||
# Using puppet_apply as a helper | ||
it 'must work idempotently with no errors' do | ||
pp = <<-PUPPET | ||
yum::copr { ['@caddy/caddy', 'copart/restic']: | ||
ensure => 'removed', | ||
} | ||
PUPPET | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
describe command('dnf copr list') do | ||
its(:stdout) { is_expected.not_to match(%r{^copr.fedorainfracloud.org/copart/restic$}) } | ||
its(:stdout) { is_expected.not_to match(%r{^copr.fedorainfracloud.org/group_caddy/caddy$}) } | ||
end | ||
end | ||
end |