theforeman / puppet-pulpcore

Puppet module for setting up Pulp 3 as part of Katello installation
GNU General Public License v3.0
2 stars 28 forks source link

Use the yumrepo type to manage the repository & expose more params #320

Closed ekohl closed 10 months ago

ekohl commented 10 months ago

This drops module_hotfixes=1 since the repository now presents proper modular metadata. It also stops managing the pulpcore-source repository, but it was enforces to be disabled anyway.

The parameters can be used to test from staging repositories or a local mirror. It's an alternative to https://github.com/theforeman/puppet-pulpcore/pull/319.

ehelms commented 10 months ago

Here is a diff to update tests:

diff --git a/.fixtures.yml b/.fixtures.yml
index 3a8278e..4ab9c3c 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -13,3 +13,4 @@ fixtures:
       puppet_version: '>= 6.0.0'
     stdlib:           'https://github.com/puppetlabs/puppetlabs-stdlib'
     systemd:          'https://github.com/voxpupuli/puppet-systemd'
+    yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core'
diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb
index 0da9730..384e2e7 100644
--- a/spec/classes/repo_spec.rb
+++ b/spec/classes/repo_spec.rb
@@ -7,12 +7,13 @@ describe 'pulpcore::repo' do

       describe "with default values" do
         it { is_expected.to compile.with_all_deps }
-        it do
-          is_expected.to contain_anchor('pulpcore::repo')
-          is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
-            .with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
-            .that_notifies('Anchor[pulpcore::repo]')
-        end
+        it { is_expected.to contain_anchor('pulpcore::repo') }
+        it { is_expected.to contain_yumrepo('pulpcore')
+          .with_baseurl(%r{https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
+          .with_gpgcheck(1)
+          .with_gpgkey(%r{https://yum.theforeman.org/pulpcore/\d+\.\d+/GPG-RPM-KEY-pulpcore})
+          .that_notifies('Anchor[pulpcore::repo]')
+        }

         if os_facts[:os]['release']['major'] == '8'
           it 'configures the pulpcore module' do
@@ -21,7 +22,7 @@ describe 'pulpcore::repo' do
               .with_ensure(/^el\d+/)
               .with_enable_only(true)
               .with_provider('dnfmodule')
-              .that_requires('File[/etc/yum.repos.d/pulpcore.repo]')
+              .that_requires('Yumrepo[pulpcore]')
               .that_notifies('Anchor[pulpcore::repo]')
           end
         else
@@ -32,16 +33,17 @@ describe 'pulpcore::repo' do
       describe "with nightly version" do
         let :params do
           {
-            version: 'nightly'
+            version: 'nightly',
+            gpgkey: '',
           }
         end

         it { is_expected.to compile.with_all_deps }
-        it do
-          is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
-            .with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/nightly/el\d+/\$basearch$})
-            .that_notifies('Anchor[pulpcore::repo]')
-        end
+        it { is_expected.to contain_yumrepo('pulpcore')
+          .with_baseurl(%r{https://yum.theforeman.org/pulpcore/nightly/el\d+/\$basearch$})
+          .with_gpgcheck(0)
+          .that_notifies('Anchor[pulpcore::repo]')
+        }
       end
     end
   end
evgeni commented 10 months ago

WHY GITHUB, WHY IT FAILED