Skip to content

Commit

Permalink
Use Puppet Litmus for acceptance testing (#79)
Browse files Browse the repository at this point in the history
* Satisfy puppet-lint & rubocop

Checks for "puppet-lint: variable contains a capital letter" are currently only ignored.
This is because it would break backward compatibility.

Removes warnings/errors:
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (examples/ca.pp:1:9)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (examples/init.pp:1:9)
pdk (WARNING): puppet-lint: defined type not documented (manifests/ca.pp:38:1)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (manifests/ca.pp:49:11)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (manifests/ca.pp:50:11)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (manifests/ca.pp:51:11)
pdk (WARNING): puppet-lint: absolute class name reference (manifests/ca.pp:115:29)
pdk (WARNING): puppet-lint: absolute class name reference (manifests/ca.pp:137:29)
pdk (WARNING): puppet-lint: absolute class name reference (manifests/ca.pp:148:30)
pdk (WARNING): puppet-lint: absolute class name reference (manifests/ca.pp:159:25)
pdk (WARNING): puppet-lint: ensure set to present on file resource (manifests/ca.pp:109:23)
pdk (WARNING): puppet-lint: ensure set to present on file resource (manifests/ca.pp:131:23)
pdk (WARNING): puppet-lint: ensure set to present on file resource (manifests/ca.pp:142:24)
pdk (ERROR): puppet-lint: there should be a single space or newline before a closing brace (manifests/ca.pp:165:4)
pdk (ERROR): puppet-lint: there should be a single space or single newline after an opening brace (manifests/ca.pp:48:1)
pdk (WARNING): puppet-lint: missing documentation for defined type parameter ca_cert::ca::ca_file_group (manifests/ca.pp:45:20)
pdk (WARNING): puppet-lint: missing documentation for defined type parameter ca_cert::ca::ca_file_group (manifests/ca.pp:45:20)
pdk (ERROR): puppet-lint: there should be a single space or newline before a closing brace (manifests/enable.pp:23:4)
pdk (ERROR): puppet-lint: there should be a single space or single newline after an opening brace (manifests/enable.pp:3:1)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (manifests/init.pp:54:11)
pdk (WARNING): puppet-lint: class included by absolute name (::$class) (manifests/init.pp:55:11)
pdk (ERROR): puppet-lint: there should be a single space or single newline after an opening brace (manifests/init.pp:53:1)
pdk (WARNING): puppet-lint: variable contains a capital letter (manifests/init.pp:46:11)
pdk (WARNING): puppet-lint: variable contains a capital letter (manifests/init.pp:73:16)
pdk (WARNING): puppet-lint: variable contains a capital letter (manifests/init.pp:74:16)
pdk (ERROR): puppet-lint: there should be a single space before an opening brace (manifests/params.pp:47:57)
pdk (ERROR): puppet-lint: there should be a single space before an opening brace (manifests/params.pp:76:67)
pdk (ERROR): puppet-lint: there should be a single space or newline before a closing brace (manifests/update.pp:12:4)
pdk (ERROR): puppet-lint: there should be a single space or single newline after an opening brace (manifests/update.pp:3:1)

pdk (WARNING): rubocop: Unnecessary disabling of `RSpec/VoidExpect`. (spec/defines/ca_spec.rb:2:1)

* Satisfy metadata-json-lint

Removes warnings:
pdk (WARNING): metadata-json-lint: Dependency puppet/archive has an open ended dependency version requirement >= 6.0.0 (metadata.json)

* Add GitHub actions for automatic validation & testing

* Use a unsupported OS for testing failing on these

Removes errors:
rspec ./spec/classes/ca_cert_spec.rb:192 # ca_cert on a Solaris based OS is expected to raise Puppet::Error with message matching /Unsupported osfamily/
rspec ./spec/classes/params_spec.rb:60 # ca_cert::params on an unsupported operating system is expected to raise Puppet::Error with message matching /Unsupported osfamily/

* Align unit tests with code

The code is only executed on osfamily RedHat with major version below 7.
The unit tests did only skip the tests on RedHat 7 but not on 8.

Removes errors:
rspec './spec/classes/update_spec.rb[1:9:3:1]' # ca_cert::update on redhat-8-x86_64 with force_enable set to true is expected to contain Exec[enable_ca_trust] with command => "update-ca-trust force-enable"
rspec './spec/classes/update_spec.rb[1:9:4:1]' # ca_cert::update on redhat-8-x86_64 with force_enable set to false is expected to contain Exec[enable_ca_trust] with command => "update-ca-trust enable"

* Remove traces of remote_file from unit tests and .fixtures.yml

When remote_file got replaced by archive [1] the unit tests were not updated accordingly.

Removes errors.
rspec ./spec/defines/ca_spec.rb:141 # ca_cert::ca os-dependent items On Debian based systems with a remote certificate is expected to contain Remote_file[/usr/local/share/ca-certificates/Globalsign_Org_Intermediate.crt] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt"
rspec ./spec/defines/ca_spec.rb:202 # ca_cert::ca os-dependent items On RedHat based systems with a remote certificate is expected to contain Remote_file[/etc/pki/ca-trust/source/anchors/Globalsign_Org_Intermediate.crt] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt"
rspec ./spec/defines/ca_spec.rb:246 # ca_cert::ca os-dependent items On RedHat based systems when explicitly distrusting a certificate is expected to contain Remote_file[/etc/pki/ca-trust/source/blacklist/Globalsign_Org_Intermediate.crt] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt"
rspec ./spec/defines/ca_spec.rb:273 # ca_cert::ca os-dependent items On Suse 11 based systems with a remote certificate is expected to contain Remote_file[/etc/ssl/certs/Globalsign_Org_Intermediate.pem] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.pem"
rspec ./spec/defines/ca_spec.rb:347 # ca_cert::ca os-dependent items On Suse 12 based systems with a remote certificate is expected to contain Remote_file[/etc/pki/trust/anchors/Globalsign_Org_Intermediate.crt] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt"
rspec ./spec/defines/ca_spec.rb:393 # ca_cert::ca os-dependent items On Suse 12 based systems when explicitly distrusting a certificate is expected to contain Remote_file[/etc/pki/trust/blacklist/Globalsign_Org_Intermediate.crt] with ensure => "present" and source => "http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt"

[1] #69

* Remove traces of TravisCI and appveyor

* Update to PDK v3.0.0

* Use Puppet Litmus for acceptance testing

---------

Co-authored-by: Phil Friderici <[email protected]>
  • Loading branch information
Phil-Friderici and Phil Friderici authored Aug 10, 2023
1 parent 98e8b50 commit e2187a9
Show file tree
Hide file tree
Showing 28 changed files with 851 additions and 303 deletions.
5 changes: 4 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
remote_file: "https://github.com/lwf/puppet-remote_file.git"
puppet_archive: "https://github.com/voxpupuli/puppet-archive.git"
# needed for Litmus acceptance testing:
facts: https://github.com/puppetlabs/puppetlabs-facts.git
provision: https://github.com/puppetlabs/provision.git
puppet_agent: https://github.com/puppetlabs/puppetlabs-puppet_agent.git
symlinks:
ca_cert: "#{source_dir}"
42 changes: 42 additions & 0 deletions .github/workflows/acceptance-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: CI

on: pull_request

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

jobs:
acceptance:
name: Litmus Acceptance
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
CI: true
steps:
- uses: actions/checkout@v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.3'
bundler-cache: true

- name: Provision Testing Environments
run: |
bundle exec rake 'litmus:provision_list[default]'
bundle exec rake 'litmus:install_agent'
bundle exec rake 'litmus:install_module'
- name: Run Tests
run: bundle exec rake 'litmus:acceptance:parallel'

- name: Tear Down
run: bundle exec rake 'litmus:tear_down'

tests:
needs:
- acceptance
runs-on: ubuntu-20.04
name: Test suite
steps:
- run: echo Test suite completed
34 changes: 34 additions & 0 deletions .github/workflows/run-pdk-tests-on-puppet-7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run PDK tests on Puppet 7.x

on:
- push
- pull_request

jobs:
validate-7:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Run pdk validate
uses: puppets-epic-show-theatre/action-pdk-validate@v1
with:
puppet-version: "7"
# [optional] A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
# pe-version: ""
# [optional] A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".

test-7:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Run unit tests
uses: puppets-epic-show-theatre/action-pdk-test-unit@v1
with:
puppet-version: "7"
# [optional] A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
# pe-version: ""
# [optional] A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".
34 changes: 34 additions & 0 deletions .github/workflows/run-pdk-tests-on-puppet-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run PDK tests on Puppet 8.x

on:
- push
- pull_request

jobs:
validate-8:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Run pdk validate
uses: puppets-epic-show-theatre/action-pdk-validate@v1
with:
puppet-version: "8"
# [optional] A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
# pe-version: ""
# [optional] A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".

test-8:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Run unit tests
uses: puppets-epic-show-theatre/action-pdk-test-unit@v1
with:
puppet-version: "8"
# [optional] A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
# pe-version: ""
# [optional] A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1".
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/spec/fixtures/modules/*
/tmp/
/vendor/
/convert_report.txt
Expand All @@ -25,3 +25,4 @@
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
11 changes: 6 additions & 5 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/spec/fixtures/modules/*
/tmp/
/vendor/
/convert_report.txt
Expand All @@ -25,18 +25,19 @@
.project
.envrc
/inventory.yaml
/appveyor.yml
/spec/fixtures/litmus_inventory.yaml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/.puppet-lint.rc
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/..yml
/.yardopts
/spec/
/.vscode/
/.sync.yml
/.devcontainer/
Loading

0 comments on commit e2187a9

Please sign in to comment.