puppetlabs-onceover 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.devcontainer/devcontainer.json +31 -0
- data/.gitattributes +2 -0
- data/.github/workflows/ci.yml +81 -0
- data/.github/workflows/mend.yml +14 -0
- data/.github/workflows/nightly.yml +66 -0
- data/.github/workflows/release.yaml +16 -0
- data/.github/workflows/release_prep.yml +20 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +804 -0
- data/.vscode/extensions.json +4 -0
- data/ARCHIVE.md +395 -0
- data/CHANGELOG.md +25 -0
- data/CODEOWNERS +2 -0
- data/Gemfile +65 -0
- data/LICENSE +202 -0
- data/README.md +965 -0
- data/Rakefile +86 -0
- data/bin/puppetlabs-onceover +17 -0
- data/cucumber.yml +1 -0
- data/factsets/AIX-6.1-powerpc.json +210 -0
- data/factsets/AIX-7.1-powerpc.json +215 -0
- data/factsets/Amazon-2018.03.json +420 -0
- data/factsets/CentOS-5.11-32.json +263 -0
- data/factsets/CentOS-5.11-64.json +263 -0
- data/factsets/CentOS-6.6-32.json +306 -0
- data/factsets/CentOS-6.6-64.json +342 -0
- data/factsets/CentOS-7.0-64.json +352 -0
- data/factsets/CentOS-8.3.2011-64.json +485 -0
- data/factsets/Debian-10.4-64.json +476 -0
- data/factsets/Debian-6.0.10-32.json +322 -0
- data/factsets/Debian-6.0.10-64.json +322 -0
- data/factsets/Debian-7.8-32.json +338 -0
- data/factsets/Debian-7.8-64.json +338 -0
- data/factsets/Debian-8.11-64.json +480 -0
- data/factsets/Debian-9.12-64.json +476 -0
- data/factsets/RHEL-6.7.json +415 -0
- data/factsets/RHEL-7.4.json +489 -0
- data/factsets/SLES-11.3-64.json +317 -0
- data/factsets/SLES-12.1-64.json +353 -0
- data/factsets/Ubuntu-12.04-32.json +328 -0
- data/factsets/Ubuntu-12.04-64.json +328 -0
- data/factsets/Ubuntu-14.04-32.json +337 -0
- data/factsets/Ubuntu-14.04-64.json +373 -0
- data/factsets/Ubuntu-18.04-64.json +556 -0
- data/factsets/Ubuntu-20.04-64.json +504 -0
- data/factsets/Windows_Server-2008r2-64.json +184 -0
- data/factsets/Windows_Server-2012r2-64.json +165 -0
- data/factsets/solaris-10_u9-sparc-64.json +769 -0
- data/factsets/solaris-11.2-sparc-64.json +774 -0
- data/factsets/windows-10-64.json +104 -0
- data/features/auto_vendored.feature +27 -0
- data/features/cache.feature +38 -0
- data/features/factsets.feature +48 -0
- data/features/formatting.feature +36 -0
- data/features/help.feature +14 -0
- data/features/init.feature +18 -0
- data/features/show.feature +28 -0
- data/features/step_definitions/cache.rb +38 -0
- data/features/step_definitions/common.rb +123 -0
- data/features/step_definitions/formatter.rb +41 -0
- data/features/step_definitions/init.rb +17 -0
- data/features/step_definitions/run.rb +17 -0
- data/features/support/cache_helper.rb +54 -0
- data/features/support/command_helper.rb +32 -0
- data/features/support/controlrepo_helper.rb +36 -0
- data/features/support/env.rb +2 -0
- data/features/windows.feature +35 -0
- data/features/zzz_run.feature +93 -0
- data/lib/puppetlabs-onceover/beaker/spec_helper.rb +71 -0
- data/lib/puppetlabs-onceover/beaker.rb +241 -0
- data/lib/puppetlabs-onceover/class.rb +56 -0
- data/lib/puppetlabs-onceover/cli/init.rb +34 -0
- data/lib/puppetlabs-onceover/cli/plugins.rb +10 -0
- data/lib/puppetlabs-onceover/cli/run.rb +85 -0
- data/lib/puppetlabs-onceover/cli/show.rb +79 -0
- data/lib/puppetlabs-onceover/cli/update.rb +48 -0
- data/lib/puppetlabs-onceover/cli.rb +47 -0
- data/lib/puppetlabs-onceover/controlrepo.rb +688 -0
- data/lib/puppetlabs-onceover/deploy.rb +171 -0
- data/lib/puppetlabs-onceover/group.rb +78 -0
- data/lib/puppetlabs-onceover/logger.rb +32 -0
- data/lib/puppetlabs-onceover/node.rb +72 -0
- data/lib/puppetlabs-onceover/rake_tasks.rb +95 -0
- data/lib/puppetlabs-onceover/rspec/formatters.rb +315 -0
- data/lib/puppetlabs-onceover/runner.rb +139 -0
- data/lib/puppetlabs-onceover/test.rb +135 -0
- data/lib/puppetlabs-onceover/testconfig.rb +315 -0
- data/lib/puppetlabs-onceover/vendored_modules.rb +202 -0
- data/lib/puppetlabs-onceover/version.rb +5 -0
- data/puppetlabs-onceover.gemspec +40 -0
- data/spec/fixtures/controlrepos/basic/Puppetfile +17 -0
- data/spec/fixtures/controlrepos/basic/environment.conf +7 -0
- data/spec/fixtures/controlrepos/basic/hieradata/common.yaml +2 -0
- data/spec/fixtures/controlrepos/basic/hieradata/nodes/example-node.yaml +1 -0
- data/spec/fixtures/controlrepos/basic/manifests/site.pp +32 -0
- data/spec/fixtures/controlrepos/basic/manifests_alternate/site.pp +2 -0
- data/spec/fixtures/controlrepos/basic/site/profile/manifests/base.pp +5 -0
- data/spec/fixtures/controlrepos/basic/site/profile/manifests/example.pp +3 -0
- data/spec/fixtures/controlrepos/basic/site/role/manifests/database_server.pp +7 -0
- data/spec/fixtures/controlrepos/basic/site/role/manifests/example.pp +3 -0
- data/spec/fixtures/controlrepos/basic/site/role/manifests/webserver.pp +7 -0
- data/spec/fixtures/controlrepos/caching/.gitignore +1 -0
- data/spec/fixtures/controlrepos/caching/.travis.yml +2 -0
- data/spec/fixtures/controlrepos/caching/Gemfile +5 -0
- data/spec/fixtures/controlrepos/caching/Puppetfile +17 -0
- data/spec/fixtures/controlrepos/caching/Rakefile +1 -0
- data/spec/fixtures/controlrepos/caching/deleteme.txt +0 -0
- data/spec/fixtures/controlrepos/caching/environment.conf +2 -0
- data/spec/fixtures/controlrepos/caching/hieradata/common.yaml +2 -0
- data/spec/fixtures/controlrepos/caching/hieradata/nodes/example-node.yaml +1 -0
- data/spec/fixtures/controlrepos/caching/manifests/site.pp +33 -0
- data/spec/fixtures/controlrepos/caching/site/profile/manifests/base.pp +5 -0
- data/spec/fixtures/controlrepos/caching/site/profile/manifests/example.pp +3 -0
- data/spec/fixtures/controlrepos/caching/site/role/manifests/database_server.pp +7 -0
- data/spec/fixtures/controlrepos/caching/site/role/manifests/example.pp +3 -0
- data/spec/fixtures/controlrepos/caching/site/role/manifests/webserver.pp +7 -0
- data/spec/fixtures/controlrepos/caching/spec/factsets/Debian-10-facter-4.json +1091 -0
- data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +7 -0
- data/spec/fixtures/controlrepos/caching/spec/onceover.yaml +55 -0
- data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +24 -0
- data/spec/fixtures/controlrepos/caching/spec/pre_conditions/escaping.pp +7 -0
- data/spec/fixtures/controlrepos/caching/spec/r10k.yaml +3 -0
- data/spec/fixtures/controlrepos/control_branch/Puppetfile +18 -0
- data/spec/fixtures/controlrepos/control_branch/environment.conf +2 -0
- data/spec/fixtures/controlrepos/custom_puppetfile/Puppetfile.custom +3 -0
- data/spec/fixtures/controlrepos/custom_puppetfile/environment.conf +7 -0
- data/spec/fixtures/controlrepos/factsets/environment.conf +1 -0
- data/spec/fixtures/controlrepos/factsets/site/profile/manifests/base.pp +6 -0
- data/spec/fixtures/controlrepos/factsets/site/role/manifests/example.pp +4 -0
- data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_extensions.pp +6 -0
- data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_external.pp +6 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +7 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_notrusted.json +530 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_nested.json +535 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_top.json +533 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_nested.json +537 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_top.json +535 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos_7_facter_4.json +706 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos_with_env.json +353 -0
- data/spec/fixtures/controlrepos/function_mocking/.gitignore +1 -0
- data/spec/fixtures/controlrepos/function_mocking/Puppetfile +4 -0
- data/spec/fixtures/controlrepos/function_mocking/Rakefile +1 -0
- data/spec/fixtures/controlrepos/function_mocking/environment.conf +2 -0
- data/spec/fixtures/controlrepos/function_mocking/site/profile/functions/fail_puppet.pp +5 -0
- data/spec/fixtures/controlrepos/function_mocking/site/profile/lib/puppet/functions/profile/fail_ruby.rb +9 -0
- data/spec/fixtures/controlrepos/function_mocking/site/profile/manifests/base.pp +10 -0
- data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/fail.pp +7 -0
- data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_data_return.pp +19 -0
- data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_new_functions.pp +12 -0
- data/spec/fixtures/controlrepos/function_mocking/spec/onceover.yaml +50 -0
- data/spec/fixtures/controlrepos/minimal/environment.conf +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +33 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile +3 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile.cron +5 -0
- data/spec/fixtures/controlrepos/vendored/environment.conf +1 -0
- data/spec/fixtures/controlrepos/vendored/site-modules/role/manifests/cron.pp +9 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/windows/Gemfile +3 -0
- data/spec/fixtures/controlrepos/windows/Puppetfile +8 -0
- data/spec/fixtures/controlrepos/windows/environment.conf +1 -0
- data/spec/fixtures/controlrepos/windows/site/role/manifests/groups.pp +8 -0
- data/spec/fixtures/controlrepos/windows/site/role/manifests/users.pp +9 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/acl.pp +12 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/choco.pp +9 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/groups.pp +8 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/users.pp +9 -0
- data/spec/fixtures/controlrepos/windows/spec/onceover.yaml +24 -0
- data/spec/puppetlabs-onceover/controlrepo_spec.rb +18 -0
- data/spec/spec_helper.rb +8 -0
- data/templates/.fixtures.yml.erb +24 -0
- data/templates/Gemfile.erb +3 -0
- data/templates/Rakefile.erb +1 -0
- data/templates/acceptance_test_spec.rb.erb +66 -0
- data/templates/controlrepo.yaml.erb +38 -0
- data/templates/error_summary.yaml.erb +17 -0
- data/templates/factsets_README.md.erb +10 -0
- data/templates/nodeset.yaml.erb +12 -0
- data/templates/pre_conditions_README.md.erb +24 -0
- data/templates/spec_helper.rb.erb +35 -0
- data/templates/spec_helper_acceptance.rb.erb +1 -0
- data/templates/test_spec.rb.erb +150 -0
- data/templates/testconfig_Rakefile.erb +47 -0
- metadata +602 -0
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v2.5.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v1.2.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v2.1.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v1.5.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v1.5.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v1.2.0"}]
|
data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"v1.2.0"}]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
modulepath = site-modules:modules:$basemodulepath
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class role::acl {
|
|
2
|
+
# ACL often causes failures such as this:
|
|
3
|
+
# https://github.com/rodjek/rspec-puppet/issues/665
|
|
4
|
+
#
|
|
5
|
+
# Onceover should handle this out of the box
|
|
6
|
+
acl { 'L:\\SQLBackup':
|
|
7
|
+
inherit_parent_permissions => false,
|
|
8
|
+
permissions => [
|
|
9
|
+
{ 'identity' => 'foo', 'rights' => ['read'] }
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Classes to be tested
|
|
2
|
+
classes:
|
|
3
|
+
- /role::/
|
|
4
|
+
|
|
5
|
+
# Nodes to tests classes on, this refers to a 'factset' or 'nodeset'
|
|
6
|
+
# depending on whether you are running 'spec' or 'acceptance' tests
|
|
7
|
+
nodes:
|
|
8
|
+
- Windows_Server-2012r2-64
|
|
9
|
+
- windows-10-64
|
|
10
|
+
- Windows_Server-2008r2-64
|
|
11
|
+
|
|
12
|
+
# You can group classes here to save typing
|
|
13
|
+
class_groups:
|
|
14
|
+
|
|
15
|
+
# You can group nodes here to save typing
|
|
16
|
+
# We have created a 'non_windows_nodes' group because we can't
|
|
17
|
+
# give you Windows vagrant boxes to test with because licensing,
|
|
18
|
+
# we can give you fact sets though so go crazy with spec testing!
|
|
19
|
+
node_groups:
|
|
20
|
+
|
|
21
|
+
test_matrix:
|
|
22
|
+
- all_nodes:
|
|
23
|
+
classes: "all_classes"
|
|
24
|
+
tests: "spec"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'puppetlabs-onceover/controlrepo'
|
|
3
|
+
|
|
4
|
+
describe "PuppetlabsOnceover::Controlrepo" do
|
|
5
|
+
context "in a barebones controlrepo" do
|
|
6
|
+
before do
|
|
7
|
+
@repo = PuppetlabsOnceover::Controlrepo.new(
|
|
8
|
+
{
|
|
9
|
+
path: 'spec/fixtures/controlrepos/minimal'
|
|
10
|
+
}
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context "without hiera.yaml" do
|
|
15
|
+
it { expect(@repo.hiera_config_file_relative_path).to be_nil }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
fixtures:
|
|
3
|
+
<% if symlinks.any? then -%>
|
|
4
|
+
symlinks:
|
|
5
|
+
<% symlinks.each do |link| -%>
|
|
6
|
+
<%= link['name'] %>: <%= link['dir'] %>
|
|
7
|
+
<% end -%>
|
|
8
|
+
<% end -%>
|
|
9
|
+
<% if repositories.any? then -%>
|
|
10
|
+
repositories:
|
|
11
|
+
<% repositories.each do |repo| -%>
|
|
12
|
+
<%= repo['name'] %>:
|
|
13
|
+
repo: <%= repo['repo'] %>
|
|
14
|
+
ref: <%= repo['ref'] %>
|
|
15
|
+
<% end -%>
|
|
16
|
+
<% end -%>
|
|
17
|
+
<% if forge_modules.any? then -%>
|
|
18
|
+
forge_modules:
|
|
19
|
+
<% forge_modules.each do |mod| -%>
|
|
20
|
+
<%= mod['name'] %>:
|
|
21
|
+
repo: <%= mod['repo'] %>
|
|
22
|
+
ref: <%= mod['ref'] %>
|
|
23
|
+
<% end -%>
|
|
24
|
+
<% end -%>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'puppetlabs-onceover/rake_tasks'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'spec_helper_acceptance'
|
|
2
|
+
|
|
3
|
+
describe "Acceptance Testing" do
|
|
4
|
+
before :each do |test|
|
|
5
|
+
PuppetlabsOnceover::Beaker.match_indentation(test,logger)
|
|
6
|
+
end
|
|
7
|
+
<% tests.each do |test| -%>
|
|
8
|
+
<% test.nodes.each do |node| -%>
|
|
9
|
+
<% test.classes.each do |cls| -%>
|
|
10
|
+
describe "<%= cls.name %> on <%= node.name %>" do
|
|
11
|
+
after :all do
|
|
12
|
+
$host.down!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "provisioning <%= node.name %>" do
|
|
16
|
+
it "should be able to provision using Beaker" do
|
|
17
|
+
expect {
|
|
18
|
+
$host = PuppetlabsOnceover::Beaker.host_create(:'<%= node.name %>',OPTIONS)
|
|
19
|
+
}.not_to raise_exception
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "copying code to <%= node.name %>" do
|
|
24
|
+
it "should copy the code successfully" do
|
|
25
|
+
expect {
|
|
26
|
+
scp_to $host, 'etc', '/'
|
|
27
|
+
}.not_to raise_exception
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
<% test.test_config['runs_before_idempotency'].times do %>
|
|
31
|
+
describe "running puppet" do
|
|
32
|
+
it "should run with no errors" do
|
|
33
|
+
expect {
|
|
34
|
+
manifest = <<CODE
|
|
35
|
+
$controlrepo_accpetance = true
|
|
36
|
+
|
|
37
|
+
<%= pre_condition %>
|
|
38
|
+
|
|
39
|
+
include <%= cls.name %>
|
|
40
|
+
CODE
|
|
41
|
+
apply_manifest_on($host,manifest,{:catch_failures => true})
|
|
42
|
+
}.not_to raise_exception
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
<% end -%>
|
|
46
|
+
<% if test.test_config['check_idempotency'] then %>
|
|
47
|
+
describe "checking for idempotency" do
|
|
48
|
+
it "should run with no changes" do
|
|
49
|
+
expect {
|
|
50
|
+
manifest = <<CODE
|
|
51
|
+
$controlrepo_accpetance = true
|
|
52
|
+
|
|
53
|
+
<%= pre_condition %>
|
|
54
|
+
|
|
55
|
+
include <%= cls.name %>
|
|
56
|
+
CODE
|
|
57
|
+
apply_manifest_on($host,manifest,{:catch_changes => true})
|
|
58
|
+
}.not_to raise_exception
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
<% end -%>
|
|
62
|
+
end
|
|
63
|
+
<% end -%>
|
|
64
|
+
<% end -%>
|
|
65
|
+
<% end -%>
|
|
66
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Classes to be tested
|
|
2
|
+
classes:
|
|
3
|
+
<% repo.roles.each do |role| -%>
|
|
4
|
+
- <%= role %>
|
|
5
|
+
<% end -%>
|
|
6
|
+
|
|
7
|
+
# Nodes to tests classes on, this refers to a 'factset' or 'nodeset'
|
|
8
|
+
# depending on whether you are running 'spec' or 'acceptance' tests
|
|
9
|
+
nodes:
|
|
10
|
+
<% repo.facts_files.each do |file| -%>
|
|
11
|
+
- <%= File.basename(file,'.json') %>
|
|
12
|
+
<% end -%>
|
|
13
|
+
|
|
14
|
+
# You can group classes here to save typing
|
|
15
|
+
class_groups:
|
|
16
|
+
|
|
17
|
+
# You can group nodes here to save typing
|
|
18
|
+
# We have created a 'non_windows_nodes' group because we can't
|
|
19
|
+
# give you Windows vagrant boxes to test with because licensing,
|
|
20
|
+
# we can give you fact sets though so go crazy with spec testing!
|
|
21
|
+
node_groups:
|
|
22
|
+
windows_nodes:
|
|
23
|
+
<% repo.facts_files.each do |file| -%>
|
|
24
|
+
<% if File.basename(file,'.json') =~ /Windows/i -%>
|
|
25
|
+
- <%= File.basename(file,'.json') %>
|
|
26
|
+
<% end -%>
|
|
27
|
+
<% end -%>
|
|
28
|
+
non_windows_nodes:
|
|
29
|
+
include: 'all_nodes'
|
|
30
|
+
exclude: 'windows_nodes'
|
|
31
|
+
|
|
32
|
+
test_matrix:
|
|
33
|
+
- all_nodes:
|
|
34
|
+
classes: 'all_classes'
|
|
35
|
+
tests: 'spec'
|
|
36
|
+
- non_windows_nodes:
|
|
37
|
+
classes: 'all_classes'
|
|
38
|
+
tests: 'acceptance'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= bold(name) %>: <%= red('failed') %>
|
|
2
|
+
errors:
|
|
3
|
+
<% errors.each do |error| -%>
|
|
4
|
+
<%= red(error[:text]) %>
|
|
5
|
+
<% if error[:file] -%>
|
|
6
|
+
file: <%= bold(error[:file]) %>
|
|
7
|
+
<% end -%>
|
|
8
|
+
<% if error[:line] -%>
|
|
9
|
+
line: <%= bold(error[:line]) %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
<% if error[:column] -%>
|
|
12
|
+
column: <%= bold(error[:column]) %>
|
|
13
|
+
<% end -%>
|
|
14
|
+
<% if error[:factsets] -%>
|
|
15
|
+
factsets: <%= bold(error[:factsets].join(', ')) %>
|
|
16
|
+
<% end -%>
|
|
17
|
+
<% end -%>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Factsets
|
|
2
|
+
|
|
3
|
+
This directory is where we put any custom factsets that we want to use.
|
|
4
|
+
They can be generated by running `puppet facts` on the target system.
|
|
5
|
+
|
|
6
|
+
If you are using Trusted Facts or Trusted External Data see: <https://github.com/voxpupuli/onceover#factsets>
|
|
7
|
+
|
|
8
|
+
**Hot tip:** If you already have factsets in here when you run `onceover init` they will be picked up and added to the config file Automatically
|
|
9
|
+
|
|
10
|
+
More info: <https://github.com/voxpupuli/onceover#factsets>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
HOSTS:
|
|
2
|
+
<% hosts_hash.each do |name, info| -%>
|
|
3
|
+
<% if info[:comment_out] then prefix = '#' end-%>
|
|
4
|
+
<%= prefix %><%= name %>:
|
|
5
|
+
<%= prefix %> roles:
|
|
6
|
+
<%= prefix %> - agent
|
|
7
|
+
<%= prefix %> type: aio
|
|
8
|
+
<%= prefix %> platform: <%= info[:platform] %>
|
|
9
|
+
<%= prefix %> box: <%= info[:boxname] %>
|
|
10
|
+
<%= prefix %> box_url: <%= info[:url] %>
|
|
11
|
+
<%= prefix %> hypervisor: vagrant_virtualbox
|
|
12
|
+
<% end -%>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Pre Conditions
|
|
2
|
+
|
|
3
|
+
This folder should contain any \*.pp files that you want to be included in every test.
|
|
4
|
+
|
|
5
|
+
A common use of this is defining resources that may not exist in the catalog when you are running tests. For example, if we are using a resource that tries to restart the `pe-puppetserver` service, unless it is compiled on a Puppet Maser the `pe-puppetserver` service will not exist and the catalog will fail to compile. To get around this we can create a .pp file and define the resource like so:
|
|
6
|
+
|
|
7
|
+
``` puppet
|
|
8
|
+
# We are not going to actually have this service anywhere on our servers but
|
|
9
|
+
# our code needs to refresh it. This is to trick puppet into doing nothing
|
|
10
|
+
service { 'pe-puppetserver':
|
|
11
|
+
ensure => 'running',
|
|
12
|
+
enable => false,
|
|
13
|
+
hasrestart => false, # Force Puppet to use start and stop to restart
|
|
14
|
+
start => 'echo "Start"', # This will always exit 0
|
|
15
|
+
stop => 'echo "Stop"', # This will also always exit 0
|
|
16
|
+
hasstatus => false, # Force puppet to use our command for status
|
|
17
|
+
status => 'echo "Status"', # This will always exit 0 and therefore Puppet will think the service is running
|
|
18
|
+
provider => 'base',
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will mean that the `pe-puppetserver` service is in the catalog for spec testing and will even allow you to try to restart it during acceptance tests without the service actually being present.
|
|
23
|
+
|
|
24
|
+
More info: https://github.com/voxpupuli/onceover#using-workarounds
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
RSpec.configure do |c|
|
|
2
|
+
c.mock_with :rspec
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
require 'rspec_junit_formatter'
|
|
6
|
+
require 'puppetlabs-onceover/rspec/formatters'
|
|
7
|
+
|
|
8
|
+
RSpec.configure do |c|
|
|
9
|
+
# Create onceover settings to be accessed by formatters
|
|
10
|
+
c.add_setting :onceover_tempdir
|
|
11
|
+
c.add_setting :onceover_root
|
|
12
|
+
c.add_setting :onceover_environmentpath
|
|
13
|
+
|
|
14
|
+
c.onceover_tempdir = <%= repo.tempdir.inspect %>
|
|
15
|
+
c.onceover_root = <%= repo.root.inspect %>
|
|
16
|
+
c.onceover_environmentpath = <%= repo.environmentpath.inspect %>
|
|
17
|
+
|
|
18
|
+
# Also add JUnit output in case people want to use that
|
|
19
|
+
c.add_formatter('RSpecJUnitFormatter','<%= repo.tempdir %>/spec.xml')
|
|
20
|
+
|
|
21
|
+
<% @formatters.each do |fm| -%>
|
|
22
|
+
c.formatter = '<%= fm %>'
|
|
23
|
+
<% end -%>
|
|
24
|
+
c.environmentpath = '<%= environmentpath %>'
|
|
25
|
+
c.module_path = '<%= modulepath %>'
|
|
26
|
+
<% if repo.hiera_config_file_relative_path %>
|
|
27
|
+
c.hiera_config = '<%= environmentpath %>/production/<%= repo.hiera_config_file_relative_path %>'
|
|
28
|
+
<% end -%>
|
|
29
|
+
c.manifest = '<%= repo.temp_manifest %>'
|
|
30
|
+
ENV['STRICT_VARIABLES'] = '<%= self.strict_variables %>'
|
|
31
|
+
<% if ENV['SHOW_PUPPET_OUTPUT'] and ENV['SHOW_PUPPET_OUTPUT'].downcase == 'true' %>
|
|
32
|
+
Puppet::Util::Log.level = :debug
|
|
33
|
+
Puppet::Util::Log.newdestination(:console)
|
|
34
|
+
<% end -%>
|
|
35
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'puppetlabs-onceover/beaker/spec_helper'
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
<% test.classes.each do |cls| -%>
|
|
4
|
+
describe "<%= cls.name %>"<%= test.tags.map { |tag| ",#{tag}: true "}.join %> do
|
|
5
|
+
|
|
6
|
+
<% test.nodes.each do |node| -%>
|
|
7
|
+
context "using fact set <%= node.name %>" do
|
|
8
|
+
node_facts = <%= node.fact_set %>
|
|
9
|
+
let(:facts) { node_facts }
|
|
10
|
+
<% if node.trusted_set -%>
|
|
11
|
+
trusted_facts = <%= node.trusted_set %>
|
|
12
|
+
let(:trusted_facts) { trusted_facts }
|
|
13
|
+
<% if node.trusted_set['certname'] -%>
|
|
14
|
+
let(:node) { "<%= node.trusted_set['certname'] %>" }
|
|
15
|
+
<% end -%>
|
|
16
|
+
<% end -%>
|
|
17
|
+
<% if node.trusted_external_set -%>
|
|
18
|
+
trusted_external_data = <%= node.trusted_external_set %>
|
|
19
|
+
let(:trusted_external_data) { trusted_external_data }
|
|
20
|
+
<% end -%>
|
|
21
|
+
<% if @before_conditions -%>
|
|
22
|
+
before :each do
|
|
23
|
+
<% @before_conditions.each do |function| -%>
|
|
24
|
+
<%= function %>
|
|
25
|
+
<% end -%>
|
|
26
|
+
end
|
|
27
|
+
<% end -%>
|
|
28
|
+
|
|
29
|
+
<% if @mock_functions -%>
|
|
30
|
+
# Create a from_json function so that we can parse the output of json for mocked functions
|
|
31
|
+
before :each do
|
|
32
|
+
Puppet::Parser::Functions.newfunction(:from_json, :type => :rvalue) { |args|
|
|
33
|
+
require 'multi_json'
|
|
34
|
+
MultiJson.load(args[0])
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
<% end -%>
|
|
38
|
+
|
|
39
|
+
<% unless opts[:no_workarounds] -%>
|
|
40
|
+
before :each do
|
|
41
|
+
# Curtrently there is some code within Puppet that will try to execute
|
|
42
|
+
# commands when compiling a catalog even though it shouldn't. One example is
|
|
43
|
+
# the groups attribute of the user resource on AIX. If we are running on
|
|
44
|
+
# Windows but pretending to be UNIX this will definitely fail so we need to
|
|
45
|
+
# mock it (or vice versa)
|
|
46
|
+
# Details:
|
|
47
|
+
# https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/execution.rb#L191
|
|
48
|
+
expected_null_file = Puppet::Util::Platform.windows? ? 'NUL' : '/dev/null'
|
|
49
|
+
unless File.exist? expected_null_file
|
|
50
|
+
allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure.new("Onceover caused this"))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The windows ACL module causes issues when compiled on other platforms
|
|
54
|
+
# These are detailed in the following ticket:
|
|
55
|
+
# https://github.com/rodjek/rspec-puppet/issues/665
|
|
56
|
+
#
|
|
57
|
+
# The below should work around this common issue
|
|
58
|
+
if Puppet::Type.type(:acl)
|
|
59
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:validate)
|
|
60
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:get_account_name).and_return(false)
|
|
61
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:get_group_name).and_return(false)
|
|
62
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:validate).and_return(true)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The windows_adsi provider also has an issue where the contructor takes
|
|
66
|
+
# a different number of arguments depending on whether the ADSI
|
|
67
|
+
# underlying connectivity exists. This causes the following error:
|
|
68
|
+
#
|
|
69
|
+
# wrong number of arguments (given 1, expected 0)
|
|
70
|
+
#
|
|
71
|
+
# This fixes that if we aren't using Windows
|
|
72
|
+
begin
|
|
73
|
+
# Test to see if this works without modification
|
|
74
|
+
require 'puppet/util/windows'
|
|
75
|
+
require 'puppet/util/windows/adsi'
|
|
76
|
+
Puppet::Util::Windows::ADSI.computer_name
|
|
77
|
+
rescue LoadError, StandardError
|
|
78
|
+
# Declare an entire mocked module because for some reason we can't load it unless we are on Windows
|
|
79
|
+
module Puppet::Util::Windows
|
|
80
|
+
module ADSI
|
|
81
|
+
class ADSIObject; end
|
|
82
|
+
class User < ADSIObject; end
|
|
83
|
+
class UserProfile; end
|
|
84
|
+
class Group < ADSIObject; end
|
|
85
|
+
end
|
|
86
|
+
module File; end
|
|
87
|
+
module Registry
|
|
88
|
+
end
|
|
89
|
+
module SID
|
|
90
|
+
class Principal; end
|
|
91
|
+
end
|
|
92
|
+
class EventLog; end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Mock commonly used things
|
|
96
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_sid).and_return('S-1-5-32-544')
|
|
97
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).and_return(nil)
|
|
98
|
+
|
|
99
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:initialize)
|
|
100
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:groups).and_return([])
|
|
101
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:name_sid_hash).and_return({})
|
|
102
|
+
|
|
103
|
+
# Group instance methods
|
|
104
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::Group).to receive(:members).and_return([])
|
|
105
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::Group).to receive(:members_sids).and_return([])
|
|
106
|
+
|
|
107
|
+
# Class methods
|
|
108
|
+
allow(Puppet::Util::Windows::ADSI::Group).to receive(:name_sid_hash).and_return({})
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
<% end -%>
|
|
112
|
+
|
|
113
|
+
<% if @after_conditions -%>
|
|
114
|
+
after :each do
|
|
115
|
+
<% @after_conditions.each do |function| -%>
|
|
116
|
+
<%= function %>
|
|
117
|
+
<% end -%>
|
|
118
|
+
end
|
|
119
|
+
<% end -%>
|
|
120
|
+
let(:pre_condition) {
|
|
121
|
+
pp = <%= '<<' %>-'END'
|
|
122
|
+
$onceover_class = '<%= cls.name %>'
|
|
123
|
+
$onceover_node = '<%= node.name %>'
|
|
124
|
+
|
|
125
|
+
# Begin user-specified pre_condition
|
|
126
|
+
<%= (pre_condition || "").chomp %>
|
|
127
|
+
# End user-specified pre_condition
|
|
128
|
+
|
|
129
|
+
<% if @mock_functions -%>
|
|
130
|
+
<% require 'multi_json' -%>
|
|
131
|
+
# Mocking functions
|
|
132
|
+
<% @mock_functions.each do |function,params| -%>
|
|
133
|
+
<% if params['returns'].is_a? String -%>
|
|
134
|
+
<% json = params['returns'].dump[1..-2].to_json -%>
|
|
135
|
+
<% else -%>
|
|
136
|
+
<% json = params['returns'].to_json -%>
|
|
137
|
+
<% end -%>
|
|
138
|
+
function <%= function %> (*$args) { from_json('<%= json %>') }
|
|
139
|
+
<% end -%>
|
|
140
|
+
<% end -%>
|
|
141
|
+
|
|
142
|
+
END
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
it { should compile }
|
|
146
|
+
end
|
|
147
|
+
<% end -%>
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
<% end -%>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'rspec/core/rake_task'
|
|
2
|
+
require 'parallel_tests/cli'
|
|
3
|
+
|
|
4
|
+
desc "Run acceptance tests"
|
|
5
|
+
RSpec::Core::RakeTask.new(:acceptance) do |t|
|
|
6
|
+
t.pattern = 'spec/acceptance'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# https://github.com/puppetlabs/puppetlabs_spec_helper/blob/main/lib/puppetlabs_spec_helper/rake_tasks.rb#L48
|
|
10
|
+
pattern = 'spec/{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit}/**/*_spec.rb'
|
|
11
|
+
|
|
12
|
+
# https://github.com/puppetlabs/puppetlabs_spec_helper/blob/main/lib/puppetlabs_spec_helper/rake_tasks.rb#L50-L72
|
|
13
|
+
RSpec::Core::RakeTask.new('spec:standalone') do |t, args|
|
|
14
|
+
t.rspec_opts = []
|
|
15
|
+
t.rspec_opts << ENV['CI_SPEC_OPTIONS'] unless ENV['CI_SPEC_OPTIONS'].nil?
|
|
16
|
+
if ENV['CI_NODE_TOTAL'] && ENV['CI_NODE_INDEX']
|
|
17
|
+
ci_total = ENV['CI_NODE_TOTAL'].to_i
|
|
18
|
+
ci_index = ENV['CI_NODE_INDEX'].to_i
|
|
19
|
+
raise "CI_NODE_INDEX must be between 1-#{ci_total}" unless ci_index >= 1 && ci_index <= ci_total
|
|
20
|
+
|
|
21
|
+
files = Rake::FileList[pattern].to_a
|
|
22
|
+
per_node = (files.size / ci_total.to_f).ceil
|
|
23
|
+
t.pattern = if args.extras.nil? || args.extras.empty?
|
|
24
|
+
files.each_slice(per_node).to_a[ci_index - 1] || files.first
|
|
25
|
+
else
|
|
26
|
+
args.extras.join(',')
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
t.pattern = if args.extras.nil? || args.extras.empty?
|
|
30
|
+
pattern
|
|
31
|
+
else
|
|
32
|
+
args.extras.join(',')
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc 'Run spec tests in parallel'
|
|
38
|
+
task :parallel_spec do |_t, args|
|
|
39
|
+
file_list = Rake::FileList[pattern].to_a
|
|
40
|
+
if file_list.empty?
|
|
41
|
+
warn 'No files for parallel_spec to run against'
|
|
42
|
+
else
|
|
43
|
+
ci_opts = ENV['CI_SPEC_OPTIONS'].to_s.strip.split
|
|
44
|
+
cli_args = ['--type', 'rspec', '--', '--format', 'progress'] + ci_opts + ['--'] + file_list
|
|
45
|
+
ParallelTests::CLI.new.run(cli_args)
|
|
46
|
+
end
|
|
47
|
+
end
|