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

chore(unit-tests) generate test fixtures from Puppetfile #2263

Merged

Conversation

dduportal
Copy link
Contributor

@dduportal dduportal commented Jul 8, 2022

This PR is a big cleanup on the Puppet unit test to ensure that we can keep it working and upgrade dependencies in the future. Had to untangle quite some elements but it's hard to split into small PRs, so here we go.

EDIT: please only take teh "ci.jenkins.io" check, not the infra.ci.jenkins.io one.

It introduces the following changes:

  • Remove the file .fixtures.yml from the repository:

    • This file duplicates the content of Puppetfile and required manual copy and paste, leading to unit test running with different puppet modules than production
    • Added to gitignore and generated through the generate-puppetfile new ruby gem which reads Puppetfile and generates
  • Fix the Puppet code to support both Puppet v4 (version used for unit tests) and v6 (production server), using Puppet formatter for most of them:

    • include directive does not need the:: prefix anymore when loading a top-level module
    • ensure says file instead of present for resources of type file
    • ensure is deprecated for concat::fragment resource
  • Fix Unit Tests Harness with the errors raised by the having an up-to-date .fixtures.yml file:

    • Correctly manage facter's mock facts to support both Puppet v4 and v6 in spec/spec_helper.rb
    • Stop testing for default values of the apache::mod::status module as it's not available in this mocked context with recent versions (should be an acceptance test)
    • Fix census tests that were checking a deprecated attrbitue for the resource concat::fragment
  • Update the Pipeline (Jenkinsfile):

    • Update + cleanupo the shell scripts and Rakefile to make sure that both pipeline and local development can behave the same
    • Only spawn 1 agent for the whole build and run steps in parallels. Consumes less executors, and the dependencies are solved once per build. it's not faster, but ensure our builds are not stuck when there is a hugh activity on ci.jenkins.io
    • No need for junit test results (at least with our outdated dependencies for ruby specs gems)
    • Archive the .fixtures.yml file generated during the build for auditing purpose
  • Documentation: README updated (was long due)

Please note that with this PR, we can start thinking about:

@dduportal dduportal force-pushed the chore/puppetfile-to-test-fixtures branch from 728cd0b to f59529a Compare July 8, 2022 11:31
@dduportal dduportal force-pushed the chore/puppetfile-to-test-fixtures branch 3 times, most recently from 122ae9f to 5183bef Compare July 10, 2022 10:00
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Jenkinsfile Outdated Show resolved Hide resolved
dduportal and others added 2 commits July 11, 2022 11:57
Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>
lemeurherve
lemeurherve previously approved these changes Jul 11, 2022
Copy link
Member

@lemeurherve lemeurherve left a comment

Choose a reason for hiding this comment

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

Great job! 🎉

Puppetfile Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
ci/00_setupgems.sh Show resolved Hide resolved
spec/spec_helper.rb Outdated Show resolved Hide resolved
dduportal and others added 2 commits July 11, 2022 14:03
Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>
Copy link
Contributor

@smerle33 smerle33 left a comment

Choose a reason for hiding this comment

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

sounds great
🚀

@dduportal dduportal merged commit caf6fec into jenkins-infra:production Jul 11, 2022
@dduportal dduportal deleted the chore/puppetfile-to-test-fixtures branch July 11, 2022 14:50
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.

None yet

3 participants