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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vagrant-hb9g3rd.lan.asio",
|
|
3
|
+
"values": {
|
|
4
|
+
"puppetversion": "6.0.2",
|
|
5
|
+
"puppet_inventory_metadata": {
|
|
6
|
+
"packages": {
|
|
7
|
+
"collection_enabled": false,
|
|
8
|
+
"last_collection_time": "0.0s"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"package_provider": "windows",
|
|
12
|
+
"pe_concat_basedir": "C:/ProgramData/PuppetLabs/puppet/cache/pe_concat",
|
|
13
|
+
"is_pe": false,
|
|
14
|
+
"platform_symlink_writable": false,
|
|
15
|
+
"puppet_files_dir_present": false,
|
|
16
|
+
"puppet_vardir": "C:/ProgramData/PuppetLabs/puppet/cache",
|
|
17
|
+
"puppet_environmentpath": "C:/ProgramData/PuppetLabs/code/environments",
|
|
18
|
+
"puppet_server": "pe-puppet.localdomain",
|
|
19
|
+
"service_provider": "windows",
|
|
20
|
+
"staging_http_get": "curl",
|
|
21
|
+
"common_appdata": "C:\\ProgramData",
|
|
22
|
+
"architecture": "x64",
|
|
23
|
+
"kernel": "windows",
|
|
24
|
+
"virtual": "vmware",
|
|
25
|
+
"is_virtual": true,
|
|
26
|
+
"hardwaremodel": "x64",
|
|
27
|
+
"operatingsystem": "windows",
|
|
28
|
+
"os": {
|
|
29
|
+
"name": "windows",
|
|
30
|
+
"family": "windows",
|
|
31
|
+
"release": {
|
|
32
|
+
"major": "10",
|
|
33
|
+
"full": "10"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"facterversion": "2.5.1",
|
|
37
|
+
"fqdn": "VAGRANT-HB9G3RD",
|
|
38
|
+
"hostname": "VAGRANT-HB9G3RD",
|
|
39
|
+
"id": "vagrant-hb9g3rd\\vagrant",
|
|
40
|
+
"interfaces": "Ethernet0_2",
|
|
41
|
+
"ipaddress_ethernet0_2": "192.168.43.174",
|
|
42
|
+
"ipaddress6_ethernet0_2": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
|
43
|
+
"macaddress_ethernet0_2": "00:0C:29:A3:53:54",
|
|
44
|
+
"netmask_ethernet0_2": "255.255.255.0",
|
|
45
|
+
"mtu_ethernet0_2": 0,
|
|
46
|
+
"ipaddress": "192.168.43.174",
|
|
47
|
+
"ipaddress6": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
|
48
|
+
"kernelmajversion": "10.0",
|
|
49
|
+
"kernelrelease": "10.0.17134",
|
|
50
|
+
"kernelversion": "10.0.17134",
|
|
51
|
+
"macaddress": "00:0C:29:A3:53:54",
|
|
52
|
+
"manufacturer": "Phoenix Technologies LTD",
|
|
53
|
+
"serialnumber": "VMware-56 4d 36 2e 2e a4 81 f9-0d 05 ae d0 e5 a3 53 54",
|
|
54
|
+
"productname": "VMware Virtual Platform",
|
|
55
|
+
"memorysize": "4.00 GB",
|
|
56
|
+
"memoryfree": "2.30 GB",
|
|
57
|
+
"memorysize_mb": "4095.49",
|
|
58
|
+
"memoryfree_mb": "2360.00",
|
|
59
|
+
"netmask": "255.255.255.0",
|
|
60
|
+
"network_ethernet0_2": "192.168.43.0",
|
|
61
|
+
"operatingsystemmajrelease": "10",
|
|
62
|
+
"operatingsystemrelease": "10",
|
|
63
|
+
"osfamily": "windows",
|
|
64
|
+
"path": "C:\\tools\\ruby24\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\vim\\vim80;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\vagrant\\AppData\\Local\\Microsoft\\WindowsApps;",
|
|
65
|
+
"physicalprocessorcount": 4,
|
|
66
|
+
"processors": {
|
|
67
|
+
"models": [
|
|
68
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
69
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
70
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
71
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
|
72
|
+
],
|
|
73
|
+
"count": 4,
|
|
74
|
+
"physicalcount": 4
|
|
75
|
+
},
|
|
76
|
+
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
77
|
+
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
78
|
+
"processor2": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
79
|
+
"processor3": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
|
80
|
+
"processorcount": 4,
|
|
81
|
+
"ps": "tasklist.exe",
|
|
82
|
+
"rubyplatform": "x64-mingw32",
|
|
83
|
+
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
|
84
|
+
"rubyversion": "2.4.3",
|
|
85
|
+
"system32": "C:\\Windows\\system32",
|
|
86
|
+
"choco_install_path": "C:\\ProgramData\\chocolatey",
|
|
87
|
+
"system_uptime": {
|
|
88
|
+
"seconds": 1113359,
|
|
89
|
+
"hours": 309,
|
|
90
|
+
"days": 12,
|
|
91
|
+
"uptime": "12 days"
|
|
92
|
+
},
|
|
93
|
+
"timezone": "GMT Standard Time",
|
|
94
|
+
"uptime": "12 days",
|
|
95
|
+
"uptime_days": 12,
|
|
96
|
+
"uptime_hours": 309,
|
|
97
|
+
"uptime_seconds": 1113359,
|
|
98
|
+
"clientcert": "vagrant-hb9g3rd.lan.asio",
|
|
99
|
+
"clientversion": "6.0.2",
|
|
100
|
+
"clientnoop": false
|
|
101
|
+
},
|
|
102
|
+
"timestamp": "2018-12-10T21:43:07.468533000+00:00",
|
|
103
|
+
"expiration": "2018-12-10T22:13:07.468533000+00:00"
|
|
104
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@vendored @puppet6
|
|
2
|
+
Feature: Automatically resolve modules vendored with puppet-agent package
|
|
3
|
+
Onceover should optionally attempt to resolve these vendored modules so that
|
|
4
|
+
users do not need to maintain these in their Puppetfile's unless they have a reason
|
|
5
|
+
to do so
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given onceover executable
|
|
9
|
+
|
|
10
|
+
Scenario: Auto resolve disabled and Puppetfile empty
|
|
11
|
+
Given initialized control repo "vendored"
|
|
12
|
+
When I run onceover command "run spec" with class "role::cron"
|
|
13
|
+
Then I should see error with message pattern "Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'cron'"
|
|
14
|
+
|
|
15
|
+
Scenario: Auto resolve enabled and Puppetfile empty
|
|
16
|
+
Given existing control repo "vendored"
|
|
17
|
+
When I run onceover command "run spec --auto_vendored=true" with class "role::cron"
|
|
18
|
+
Then the temporary Puppetfile should contain /mod 'puppetlabs-cron_core',\n.*git: 'https://github.com/puppetlabs\/puppetlabs-cron_core.git',\n.*ref: 'refs\/tags\/.*'/
|
|
19
|
+
And I should not see any errors
|
|
20
|
+
|
|
21
|
+
Scenario: Auto resolve enabled and cron_core specified in Puppetfile
|
|
22
|
+
Given existing control repo "vendored"
|
|
23
|
+
When I run onceover command "run spec --auto_vendored=true" with --puppetfile Puppetfile.cron
|
|
24
|
+
Then I should see message pattern "cron_core found in Puppetfile. Using the specified version"
|
|
25
|
+
Then the temporary Puppetfile should contain /mod 'puppetlabs\/cron_core'/
|
|
26
|
+
And I should not see any errors
|
|
27
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@cache
|
|
2
|
+
Feature: Create and maintain a .onceover cache
|
|
3
|
+
Onceover should be able to cache things in the .onceover directory for speed
|
|
4
|
+
increases and debugging of external modules. This cache should remain
|
|
5
|
+
up-to-date and should exactly mirror what would be created on the Puppet
|
|
6
|
+
master.
|
|
7
|
+
|
|
8
|
+
Background:
|
|
9
|
+
Given onceover executable
|
|
10
|
+
|
|
11
|
+
Scenario: Creating a cache
|
|
12
|
+
Given control repo "caching"
|
|
13
|
+
When I run onceover command "run spec"
|
|
14
|
+
Then the cache should exist
|
|
15
|
+
And the cache should contain all controlrepo files
|
|
16
|
+
|
|
17
|
+
Scenario: Run onceover in the caching repo
|
|
18
|
+
Given control repo "caching"
|
|
19
|
+
When I run onceover command "run spec --classes role::webserver"
|
|
20
|
+
Then I should not see any errors
|
|
21
|
+
|
|
22
|
+
Scenario: Creating a new file
|
|
23
|
+
Given existing control repo "caching"
|
|
24
|
+
When I create a file "example.txt"
|
|
25
|
+
And I run onceover command "run spec"
|
|
26
|
+
Then "example.txt" should be cached correctly
|
|
27
|
+
|
|
28
|
+
Scenario: Deleting a file
|
|
29
|
+
Given existing control repo "caching"
|
|
30
|
+
When I delete a file "deleteme.txt"
|
|
31
|
+
And I run onceover command "run spec"
|
|
32
|
+
Then "deleteme.txt" should be deleted from the cache
|
|
33
|
+
|
|
34
|
+
Scenario: Caching hidden files
|
|
35
|
+
Given existing control repo "caching"
|
|
36
|
+
When I create a file ".hidden/.hiddenfile"
|
|
37
|
+
And I run onceover command "run spec"
|
|
38
|
+
Then ".hidden/.hiddenfile" should be cached correctly
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@factsets
|
|
2
|
+
Feature: Handle factsets properly
|
|
3
|
+
Onceover should allow users to add their own factsets and should handle these well
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given onceover executable
|
|
7
|
+
|
|
8
|
+
Scenario: Selecting existing factsets
|
|
9
|
+
Given control repo "factsets"
|
|
10
|
+
When I run onceover command "init"
|
|
11
|
+
Then the config should contain "centos_with_env"
|
|
12
|
+
|
|
13
|
+
# This needs to be tested because an environment fact, if not handled, makes
|
|
14
|
+
# compilation fail because it breaks all of the workarounds that have been
|
|
15
|
+
# put in place within rspec-puppet for the environment
|
|
16
|
+
@puppet6
|
|
17
|
+
Scenario: Run with a factset containing an environment facts
|
|
18
|
+
Given existing control repo "factsets"
|
|
19
|
+
When I run onceover command "run spec" with class "role::example"
|
|
20
|
+
Then I should not see any errors
|
|
21
|
+
|
|
22
|
+
@puppet6
|
|
23
|
+
Scenario: Run trusted_extensions tests on nodes where pp_datacenter is PDK
|
|
24
|
+
Given existing control repo "factsets"
|
|
25
|
+
When I run onceover command "run spec" with class "role::trusted_extensions" on nodes "centos7_trusted_extensions_top,centos7_trusted_extensions_nested"
|
|
26
|
+
Then I should not see any errors
|
|
27
|
+
|
|
28
|
+
# Spec tests should only pass on the centos7_trusted_extensions_top and
|
|
29
|
+
# centos7_trusted_extensions_nested factsets. The rest should fail
|
|
30
|
+
@puppet6
|
|
31
|
+
Scenario: Run trusted_extensions tests on nodes where pp_datacenter is not set
|
|
32
|
+
Given existing control repo "factsets"
|
|
33
|
+
When I run onceover command "run spec" with class "role::trusted_extensions"
|
|
34
|
+
Then I should see error with message pattern "Evaluation Error: Error while evaluating a Function Call, pp_datacenter is not set to PDX"
|
|
35
|
+
|
|
36
|
+
@puppet6
|
|
37
|
+
Scenario: Run trusted_external tests on nodes where $trusted['external']['example']['foo'] is set to 'bar'
|
|
38
|
+
Given existing control repo "factsets"
|
|
39
|
+
When I run onceover command "run spec" with class "role::trusted_external" on nodes "centos7_trusted_external_top,centos7_trusted_external_nested"
|
|
40
|
+
Then I should not see any errors
|
|
41
|
+
|
|
42
|
+
# Spec tests should only pass on the centos7_trusted_externalq_top and
|
|
43
|
+
# centos7_trusted_external_nested factsets. The rest should fail
|
|
44
|
+
@puppet6
|
|
45
|
+
Scenario: Run trusted_external tests on nodes where $trusted['external'] is not specified
|
|
46
|
+
Given existing control repo "factsets"
|
|
47
|
+
When I run onceover command "run spec" with class "role::trusted_external"
|
|
48
|
+
Then I should see error with message pattern "Evaluation Error: Operator \'\[\]\' is not applicable to an Undef Value."
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@formatting
|
|
2
|
+
Feature: Format errors nicely
|
|
3
|
+
I would like Onceover to format errors nicely so that they are easily read
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given the OnceoverFormatter
|
|
7
|
+
|
|
8
|
+
Scenario: Parse a missing class error
|
|
9
|
+
When Puppet throws the error: "error during compilation: Evaluation Error: Error while evaluating a Function Call, Could not find class ::role::websevrer for server01.foo.com (line: 17, column: 1) on node server01.foo.com"
|
|
10
|
+
Then the error should parse successfully
|
|
11
|
+
And it should find 1 error
|
|
12
|
+
And the parsed error should contain the following keys: text, line, column
|
|
13
|
+
|
|
14
|
+
Scenario: Parse an incorrect parameter error
|
|
15
|
+
When Puppet throws the error: "error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Class[Docker]: has no parameter named 'package_name' (file: /some/path/tp/the/file/module/manifests/profile/docker.pp, line: 8, column: 1) on node server01.foo.com"
|
|
16
|
+
Then the error should parse successfully
|
|
17
|
+
And it should find 1 error
|
|
18
|
+
And the parsed error should contain the following keys: text, file, line, column
|
|
19
|
+
|
|
20
|
+
Scenario: Parse a duplication declaration error
|
|
21
|
+
When Puppet throws the error: "error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[virtualenv] is already declared at (file: /some/path/tp/the/file/foo/manifests/profile/ti2.pp, line: 31); cannot redeclare (file: /some/path/tp/the/file/python/manifests/install.pp, line: 54) (file: /some/path/tp/the/file/python/manifests/install.pp, line: 54, column: 3) on node server01.foo.co"
|
|
22
|
+
Then the error should parse successfully
|
|
23
|
+
And it should find 2 errors
|
|
24
|
+
And the parsed errors should contain the following keys: text, file, line, column
|
|
25
|
+
|
|
26
|
+
Scenario: Parse a lookup failure error
|
|
27
|
+
When Puppet throws the error: "error during compilation: Function lookup() did not find a value for the name 'archvsync::repositories' on node server01.foo.com"
|
|
28
|
+
Then the error should parse successfully
|
|
29
|
+
And it should find 1 errors
|
|
30
|
+
And the parsed errors should contain the following keys: text
|
|
31
|
+
|
|
32
|
+
Scenario: Fail to parse an error and survive anyway
|
|
33
|
+
When Puppet throws the error: "Derp derp derp. This error is 💩"
|
|
34
|
+
Then the error should parse successfully
|
|
35
|
+
And it should find 1 errors
|
|
36
|
+
And the parsed errors should contain the following keys: text
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Get help about Onceover's features, commands and commands' parameters
|
|
2
|
+
I would like to use executable file to run Onceover and read help
|
|
3
|
+
|
|
4
|
+
Background:
|
|
5
|
+
Given onceover executable
|
|
6
|
+
|
|
7
|
+
Scenario: Show main options with executable wihtout parameters
|
|
8
|
+
When I run onceover command ""
|
|
9
|
+
Then I see help for commands: "help, init, run, show, update"
|
|
10
|
+
|
|
11
|
+
Scenario: Show main help with "help" command
|
|
12
|
+
When I run onceover command "help"
|
|
13
|
+
Then I see help for commands: "help, init, run, show, update"
|
|
14
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: Initialize Onceover application
|
|
2
|
+
For correct control repo I would like to generate all folders and files needed
|
|
3
|
+
by Onceover. For incorrect control repo I would like to get information why
|
|
4
|
+
I can not initialize application.
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given onceover executable
|
|
8
|
+
|
|
9
|
+
Scenario: Initialize basic repo
|
|
10
|
+
Given control repo "basic"
|
|
11
|
+
When I run onceover command "init"
|
|
12
|
+
Then I should not see any errors
|
|
13
|
+
And I should see generated all necessary files and folders
|
|
14
|
+
|
|
15
|
+
Scenario: Initialize repo with missing environment.conf file
|
|
16
|
+
Given control repo "basic" without "environment.conf"
|
|
17
|
+
When I run onceover command "init"
|
|
18
|
+
Then I should see error with message pattern "No such file or directory.*environment.conf"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Feature: Show the state of things
|
|
2
|
+
For a correct controlrepo I would like to see details of the Puppetfile and
|
|
3
|
+
the things that have been detedted by onceover in the controlrepo.
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given onceover executable
|
|
7
|
+
|
|
8
|
+
Scenario: Show info for basic repo
|
|
9
|
+
Given initialized control repo "basic"
|
|
10
|
+
When I run onceover command "show repo"
|
|
11
|
+
Then I should not see any errors
|
|
12
|
+
|
|
13
|
+
Scenario: Detect roles and profiles
|
|
14
|
+
Given initialized control repo "basic"
|
|
15
|
+
When I run onceover command "show repo"
|
|
16
|
+
Then I should not see any errors
|
|
17
|
+
And I should see message pattern "roles.*role::database_server"
|
|
18
|
+
And I should see message pattern "roles.*role::webserver"
|
|
19
|
+
And I should see message pattern "roles.*role::example"
|
|
20
|
+
And I should see message pattern "profiles.*profile::example"
|
|
21
|
+
And I should see message pattern "profiles.*profile::base"
|
|
22
|
+
|
|
23
|
+
Scenario: Detect modules
|
|
24
|
+
Given initialized control repo "basic"
|
|
25
|
+
When I run onceover command "show puppetfile"
|
|
26
|
+
Then I should not see any errors
|
|
27
|
+
And I should see message pattern "puppetlabs-stdlib\s+\|\s+4\.11\.0"
|
|
28
|
+
And I should see message pattern "apache\s+\|\s+N/A"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Then(/^the cache should exist$/) do
|
|
2
|
+
cache_dir = File.join(@repo.root_folder,'.onceover')
|
|
3
|
+
expect(File.directory?(cache_dir)).to be true
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Then(/^the cache should contain all controlrepo files/) do
|
|
7
|
+
# Get all root files
|
|
8
|
+
log("Calculating MD5 hashes in repo")
|
|
9
|
+
repo_digest = Cache_Helper.digest(@repo.root_folder)
|
|
10
|
+
log("#{repo_digest.count} MD5 hashes calculated")
|
|
11
|
+
log("Calculating MD5 hashes in cache")
|
|
12
|
+
cache_digest = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/'))
|
|
13
|
+
log("#{cache_digest.count} MD5 hashes calculated")
|
|
14
|
+
expect(cache_digest).to include(repo_digest)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I (\w+) a file "(.*)"$/) do |action,file|
|
|
18
|
+
require 'securerandom'
|
|
19
|
+
actual_file = Pathname.new(File.join(@repo.root_folder,file))
|
|
20
|
+
case action
|
|
21
|
+
when "create"
|
|
22
|
+
FileUtils.mkdir_p(actual_file.dirname)
|
|
23
|
+
File.write(actual_file,SecureRandom.hex)
|
|
24
|
+
when "delete"
|
|
25
|
+
FileUtils.rm(actual_file)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^"(.*)" should be cached correctly$/) do |file|
|
|
30
|
+
original_digest = Cache_Helper.digest(File.join(@repo.root_folder,file))
|
|
31
|
+
cache_digest = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/',file))
|
|
32
|
+
expect(original_digest).to include(cache_digest)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Then(/^"([^"]*)" should be deleted from the cache$/) do |file|
|
|
36
|
+
deleted_file = Pathname.new(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/',file))
|
|
37
|
+
expect(deleted_file.exist?).to be false
|
|
38
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Given(/^onceover executable$/) do
|
|
2
|
+
@cmd = Command_Helper.new
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given(/^control repo "([^"]*)"$/) do |controlrepo_name|
|
|
6
|
+
@repo = ControlRepo_Helper.new( controlrepo_name )
|
|
7
|
+
@cmd.controlrepo = @repo
|
|
8
|
+
FileUtils.rm_rf @repo.root_folder
|
|
9
|
+
FileUtils.mkdir_p @repo.tmp_folder
|
|
10
|
+
|
|
11
|
+
FileUtils.rm_rf "#{@repo.tmp_folder}#{controlrepo_name}"
|
|
12
|
+
FileUtils.cp_r "spec/fixtures/controlrepos/#{controlrepo_name}", @repo.tmp_folder
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Given(/^existing control repo "([^"]*)"$/) do |controlrepo_name|
|
|
16
|
+
@repo = ControlRepo_Helper.new( controlrepo_name )
|
|
17
|
+
@cmd.controlrepo = @repo
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Given(/^initialized control repo "([^"]*)"$/) do |controlrepo_name|
|
|
21
|
+
step %Q(control repo "#{controlrepo_name}")
|
|
22
|
+
step %Q(I run onceover command "init")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Given(/^control repo "([^"]*)" without "([^"]*)"$/) do |controlrepo_name, filename|
|
|
26
|
+
step %Q(control repo "#{controlrepo_name}")
|
|
27
|
+
FileUtils.rm_rf "#{@repo.root_folder}/#{filename}"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
When(/^I run onceover command "([^"]*)"$/) do |command|
|
|
31
|
+
@cmd.command = "#{command} --debug"
|
|
32
|
+
log(@cmd)
|
|
33
|
+
@cmd.run
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/) do |command, cls|
|
|
37
|
+
@cmd.command = "#{command} --classes #{cls}"
|
|
38
|
+
log(@cmd)
|
|
39
|
+
@cmd.run
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
When(/^I run onceover command "([^"]*)" with class "([^"]*)" on nodes "([^"]*)"$/) do |command, cls, nodes|
|
|
43
|
+
@cmd.command = "#{command} --classes #{cls} --nodes #{nodes}"
|
|
44
|
+
log(@cmd)
|
|
45
|
+
@cmd.run
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# The below can be used to skip tests if they only work on one os
|
|
49
|
+
When(/^test osfamily is "(\w*)"$/) do |osfamily|
|
|
50
|
+
require 'facter'
|
|
51
|
+
pending unless Facter.value(:os)['family'] == osfamily
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
When(/^test osfamily is not "(\w*)"$/) do |osfamily|
|
|
55
|
+
require 'facter'
|
|
56
|
+
pending if Facter.value(:os)['family'] == osfamily
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
Then(/^I see help for commands: "([^"]*)"$/) do |commands|
|
|
60
|
+
# Get chunk of output between COMMANDS and OPTION, there should be help section
|
|
61
|
+
commands_help = @cmd.output[/COMMANDS(.*)OPTIONS/m, 1]
|
|
62
|
+
commands.split(',').each do |command|
|
|
63
|
+
result = commands_help.match(/^\s+#{command.strip}.+\n/)
|
|
64
|
+
log(result.to_s) if expect(result).not_to be nil
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Then(/^I should not see any errors$/) do
|
|
69
|
+
log(@cmd.output) unless @cmd.success?
|
|
70
|
+
expect(@cmd.success?).to be true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Then(/^the config should contain "([^"]*)"$/) do |pattern|
|
|
74
|
+
pattern = Regexp.new(pattern)
|
|
75
|
+
expect(@repo.config_file_contents).to match(pattern)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
Then(/^Onceover should exit (\d+)$/) do |code|
|
|
79
|
+
expect(@cmd.exit_code).to eq code.to_i
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
Then(/^I should see error with message pattern "([^"]*)"$/) do |err_msg_regexp|
|
|
83
|
+
expect(@cmd.success?).to be false
|
|
84
|
+
log(@cmd.output)
|
|
85
|
+
expect(@cmd.output.match err_msg_regexp).to_not be nil
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
Then(/^I should (not )?see message pattern "([^"]*)"$/) do |notword, msg_regexp|
|
|
89
|
+
output_surround = 30
|
|
90
|
+
match = Regexp.new(msg_regexp).match(@cmd.output)
|
|
91
|
+
|
|
92
|
+
# Expect it to match unless we said it shouldn't match
|
|
93
|
+
expected_match = notword.nil?
|
|
94
|
+
does_match = !match.nil?
|
|
95
|
+
|
|
96
|
+
if expected_match
|
|
97
|
+
expect(@cmd.output).to match(msg_regexp)
|
|
98
|
+
else
|
|
99
|
+
expect(@cmd.output).not_to match(msg_regexp)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# If the regex matches and that's what we expected then just print a summary
|
|
103
|
+
if does_match == expected_match
|
|
104
|
+
if match
|
|
105
|
+
log(match.pre_match[-output_surround..-1] + match.to_s + match.post_match[0..output_surround])
|
|
106
|
+
end
|
|
107
|
+
else
|
|
108
|
+
log(@cmd.output)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/) do |command, puppetfile|
|
|
113
|
+
puppetfile_path = @repo.root_folder + puppetfile
|
|
114
|
+
@cmd.command = "#{command} --puppetfile #{puppetfile_path} --debug"
|
|
115
|
+
log(@cmd)
|
|
116
|
+
@cmd.run
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
Then(/^([^"]*) should be copied to Puppetfile$/) do |puppetfile|
|
|
120
|
+
source = @repo.root_folder + puppetfile
|
|
121
|
+
destination = @repo.onceover_temp_puppetfile
|
|
122
|
+
expect(IO.read(source)).to eq(IO.read(destination))
|
|
123
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Given(/^the OnceoverFormatter$/) do
|
|
2
|
+
require 'rspec'
|
|
3
|
+
require 'puppetlabs-onceover/rspec/formatters'
|
|
4
|
+
|
|
5
|
+
RSpec.configure do |c|
|
|
6
|
+
# Create onceover settings to be accessed by formatters
|
|
7
|
+
c.add_setting :onceover_tempdir
|
|
8
|
+
c.add_setting :onceover_root
|
|
9
|
+
c.add_setting :onceover_environmentpath
|
|
10
|
+
|
|
11
|
+
c.onceover_tempdir = "/Users/foo/git/controlrepo/.onceover"
|
|
12
|
+
c.onceover_root = "/Users/foo/git/controlrepo"
|
|
13
|
+
c.onceover_environmentpath = "etc/puppetlabs/code/environments"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@formatter = PuppetlabsOnceoverFormatter.new(STDOUT)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
When(/^Puppet throws the error: "(.*)"$/) do |error|
|
|
20
|
+
@error = error
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Then(/^the error should parse successfully$/) do
|
|
24
|
+
expect do
|
|
25
|
+
@parsed_error = @formatter.parse_errors(@error)
|
|
26
|
+
end.to_not raise_error
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^it should find (\d+) errors?$/) do |number|
|
|
30
|
+
expect(@parsed_error.length).to be(number.to_i)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Then(/^the parsed errors? should contain the following keys: (.*)$/) do |keys|
|
|
34
|
+
# Split the keys into an array
|
|
35
|
+
keys = keys.split(',').map(&:strip)
|
|
36
|
+
@parsed_error.each do |error|
|
|
37
|
+
keys.each do |k|
|
|
38
|
+
expect(error).to have_key(k.to_sym)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Given(/^in Puppetfile is misspelled module's name$/) do
|
|
2
|
+
@repo.add_line_to_puppetfile %Q(mod "acme/not_exists", "7.7.7")
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^I should see generated all necessary files and folders$/) do
|
|
6
|
+
files = [ 'spec/onceover.yaml', 'Rakefile', 'Gemfile' ].map { |x| @repo.root_folder + x }
|
|
7
|
+
folders = [ 'spec/factsets', 'spec/pre_conditions'].map! { |x| @repo.root_folder + x}
|
|
8
|
+
|
|
9
|
+
files.each do |file|
|
|
10
|
+
log(file)
|
|
11
|
+
expect( File.exist? file ).to be true
|
|
12
|
+
end
|
|
13
|
+
folders.each do |folder|
|
|
14
|
+
log(folder)
|
|
15
|
+
expect( Dir.exist? folder ).to be true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Then(/^the temporary Puppetfile should contain \/(.*)\/$/) do |regex|
|
|
2
|
+
puppetfile = File.read(@repo.onceover_temp_puppetfile)
|
|
3
|
+
expect(puppetfile).to match(Regexp.new(regex))
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Then(/^the temporary Puppetfile should contain the git branch/) do
|
|
7
|
+
git_branch = `git rev-parse --abbrev-ref HEAD`.chomp
|
|
8
|
+
step %Q(the temporary Puppetfile should contain /#{git_branch}/)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
When(/^I make local modifications$/) do
|
|
12
|
+
FileUtils.rm_rf("#{@repo.onceover_temp_root_folder}/modules/apache/manifests")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Before('@skip_on_windows') do
|
|
16
|
+
skip_this_scenario if RUBY_PLATFORM =~ /mswin|mingw/
|
|
17
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
|
|
3
|
+
class Cache_Helper
|
|
4
|
+
def cache_exists?
|
|
5
|
+
File.directory?(dir + '/.onceover')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.digest(path, opts = {
|
|
9
|
+
exceptions: ['.','..','.onceover']
|
|
10
|
+
})
|
|
11
|
+
if File.directory?(path)
|
|
12
|
+
# Get the list of files
|
|
13
|
+
children = Cache_Helper.get_children(path, opts[:exceptions])
|
|
14
|
+
else
|
|
15
|
+
children = [File.expand_path(path)]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Calculate hashes
|
|
19
|
+
hashes = children.map do |child_path|
|
|
20
|
+
if File.directory? child_path
|
|
21
|
+
:directory
|
|
22
|
+
else
|
|
23
|
+
Digest::MD5.file(child_path)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
root = Pathname.new(File.expand_path(path))
|
|
28
|
+
# Move pathnames back to relative
|
|
29
|
+
children.map! do |child_path|
|
|
30
|
+
Pathname.new(child_path).relative_path_from root
|
|
31
|
+
end
|
|
32
|
+
Hash[children.zip(hashes)]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.get_children(dir, exclusions)
|
|
36
|
+
root_files = []
|
|
37
|
+
files = []
|
|
38
|
+
Dir.chdir(dir) do
|
|
39
|
+
# Get all root files
|
|
40
|
+
root_files = Dir.glob('*',File::FNM_DOTMATCH)
|
|
41
|
+
root_files = root_files - exclusions
|
|
42
|
+
root_files.each do |file|
|
|
43
|
+
files << file
|
|
44
|
+
files << Dir.glob("#{file}/**/*",File::FNM_DOTMATCH)
|
|
45
|
+
end
|
|
46
|
+
files.flatten!
|
|
47
|
+
# Calculate absolue paths
|
|
48
|
+
files.map! do |file|
|
|
49
|
+
File.expand_path(file)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
files
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require "open3"
|
|
2
|
+
|
|
3
|
+
class Command_Helper
|
|
4
|
+
attr_reader(:output, :result)
|
|
5
|
+
|
|
6
|
+
attr_writer(:command, :params, :controlrepo)
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@executable = ENV["BUNDLE_GEMFILE"] ? "bundle exec puppetlabs-onceover" : "puppetlabs-onceover"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run
|
|
13
|
+
@output, @result = Open3.capture2e generate_command
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def success?
|
|
17
|
+
return @result.success?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def exit_code
|
|
21
|
+
@result.exitstatus
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def generate_command
|
|
25
|
+
controlrepo_param = @controlrepo ? "--path #{File.expand_path(@controlrepo.root_folder)}" : ''
|
|
26
|
+
return "#{@executable} #{@command} #{controlrepo_param}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_s
|
|
30
|
+
return generate_command
|
|
31
|
+
end
|
|
32
|
+
end
|