onceover 3.21.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +4 -6
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/release.yaml +32 -0
- data/.github/workflows/tests.yaml +30 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +4 -704
- data/.rubocop_todo.yml +828 -0
- data/CHANGELOG.md +1036 -0
- data/Gemfile +9 -0
- data/LICENSE +202 -0
- data/README.md +122 -32
- data/Rakefile +24 -14
- data/cucumber.yml +1 -0
- data/features/auto_vendored.feature +27 -0
- data/features/step_definitions/common.rb +5 -5
- data/features/step_definitions/run.rb +4 -0
- data/features/support/cache_helper.rb +0 -1
- data/features/support/command_helper.rb +0 -2
- data/features/support/controlrepo_helper.rb +0 -2
- data/features/zzz_run.feature +1 -8
- data/lib/onceover/beaker/spec_helper.rb +9 -9
- data/lib/onceover/beaker.rb +9 -12
- data/lib/onceover/cli/run.rb +1 -0
- data/lib/onceover/controlrepo.rb +22 -27
- data/lib/onceover/deploy.rb +30 -3
- data/lib/onceover/group.rb +1 -3
- data/lib/onceover/logger.rb +3 -3
- data/lib/onceover/node.rb +0 -2
- data/lib/onceover/rake_tasks.rb +9 -4
- data/lib/onceover/rspec/formatters.rb +5 -8
- data/lib/onceover/runner.rb +1 -1
- data/lib/onceover/test.rb +2 -3
- data/lib/onceover/testconfig.rb +2 -2
- data/lib/onceover/vendored_modules.rb +186 -0
- data/onceover.gemspec +26 -30
- data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +1 -1
- data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +1 -1
- data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +1 -1
- 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 +6 -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/onceover/controlrepo_spec.rb +1 -1
- data/templates/factsets_README.md.erb +1 -1
- data/templates/pre_conditions_README.md.erb +1 -1
- data/templates/spec_helper.rb.erb +0 -2
- data/templates/test_spec.rb.erb +3 -0
- metadata +173 -68
- data/.gitmodules +0 -4
data/Gemfile
CHANGED
@@ -10,11 +10,15 @@ end
|
|
10
10
|
|
11
11
|
group :test do
|
12
12
|
# Required for the final controlrepo tests
|
13
|
+
gem 'rexml', '~> 3.3', '>= 3.3.9'
|
13
14
|
gem 'toml-rb'
|
14
15
|
end
|
15
16
|
|
16
17
|
group :development do
|
18
|
+
gem 'cucumber'
|
17
19
|
gem 'pry'
|
20
|
+
gem 'rubocop'
|
21
|
+
gem 'rubygems-tasks'
|
18
22
|
end
|
19
23
|
|
20
24
|
# Evaluate Gemfile.local if it exists
|
@@ -26,3 +30,8 @@ end
|
|
26
30
|
if File.exist?(File.join(Dir.home, '.gemfile'))
|
27
31
|
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
|
28
32
|
end
|
33
|
+
|
34
|
+
group :release do
|
35
|
+
gem 'faraday-retry', require: false
|
36
|
+
gem 'github_changelog_generator', require: false
|
37
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Onceover
|
2
2
|
|
3
|
+
[![License](https://img.shields.io/github/license/voxpupuli/onceover.svg)](https://github.com/voxpupuli/onceover/blob/master/LICENSE)
|
4
|
+
[![Donated by dylanratcliffe](https://img.shields.io/badge/donated%20by-dylanratcliffe-fb7047.svg)](#transfer-notice)
|
5
|
+
[![RubyGem Version](https://img.shields.io/gem/v/onceover.svg)](https://rubygems.org/gems/onceover)
|
6
|
+
[![RubyGem Downloads](https://img.shields.io/gem/dt/onceover.svg)](https://rubygems.org/gems/onceover)
|
7
|
+
|
3
8
|
*The gateway drug to automated infrastructure testing with Puppet*
|
4
9
|
|
5
10
|
Onceover is a tool to automatically run basic tests on an entire Puppet control repository.
|
@@ -8,8 +13,6 @@ It includes automatic parsing of the `Puppetfile`, `environment.conf` and others
|
|
8
13
|
|
9
14
|
**New in v3.19.1: I've reversed the decision to have onceover use `site.pp` in the same way Puppet does. From now on your `manifest` setting in `environment.conf` will be ignored and your `site.pp` will only be used if you explicitly set the `manifest` option in the CLI or config file.**
|
10
15
|
|
11
|
-
[![Build Status](https://travis-ci.com/dylanratcliffe/onceover.svg?branch=master)](https://travis-ci.com/dylanratcliffe/onceover) [![Build status](https://ci.appveyor.com/api/projects/status/2ys2ggkgln69hmyf/branch/master?svg=true)](https://ci.appveyor.com/project/dylanratcliffe/onceover/branch/master)
|
12
|
-
|
13
16
|
## Table of Contents
|
14
17
|
|
15
18
|
- [Overview](#overview)
|
@@ -21,6 +24,7 @@ It includes automatic parsing of the `Puppetfile`, `environment.conf` and others
|
|
21
24
|
- [Puppetfile](#puppetfile)
|
22
25
|
- [Spec testing](#spec-testing)
|
23
26
|
- [Adding your own spec tests](#adding-your-own-spec-tests)
|
27
|
+
- [Vendored Modules](#vendored-modules)
|
24
28
|
- [Using Workarounds](#using-workarounds)
|
25
29
|
- [Extra tooling](#extra-tooling)
|
26
30
|
- [Plugins](#plugins)
|
@@ -33,6 +37,7 @@ It includes automatic parsing of the `Puppetfile`, `environment.conf` and others
|
|
33
37
|
- [Ruby Warnings](#ruby-warnings)
|
34
38
|
- [Rake tasks](#rake-tasks)
|
35
39
|
- [generate_fixtures](#generate_fixtures)
|
40
|
+
- [generate_vendor_cache](#generate_vendor_cache)
|
36
41
|
|
37
42
|
## Overview
|
38
43
|
|
@@ -65,6 +70,7 @@ This toolset requires some [configuration](#configuration) before it can be used
|
|
65
70
|
```shell
|
66
71
|
bundle exec onceover init
|
67
72
|
```
|
73
|
+
|
68
74
|
1. Run your spec tests!
|
69
75
|
|
70
76
|
```shell
|
@@ -179,6 +185,7 @@ Hopefully this config file will be fairly self explanatory once you see it, but
|
|
179
185
|
**Note**: The facts are available through the `node_facts` hash and the trusted facts as `trusted_facts`.
|
180
186
|
|
181
187
|
Exmaple:
|
188
|
+
|
182
189
|
```yaml
|
183
190
|
after:
|
184
191
|
- "puts 'Test finished running'"
|
@@ -200,6 +207,7 @@ Hopefully this config file will be fairly self explanatory once you see it, but
|
|
200
207
|
This setting overrides defaults for the `Onceover::Controlrepo` class' `opts` hash.
|
201
208
|
|
202
209
|
Example:
|
210
|
+
|
203
211
|
```yaml
|
204
212
|
opts:
|
205
213
|
:facts_dirs: # Remember: `opts` keys are symbols!
|
@@ -225,7 +233,7 @@ node_groups:
|
|
225
233
|
exclude: 'windows_nodes' # Then remove the windows ones from that list
|
226
234
|
```
|
227
235
|
|
228
|
-
It's important to note that in order to reference a group using the *include/exclude* syntax
|
236
|
+
It's important to note that in order to reference a group using the *include/exclude* syntax it has to have been defined already i.e. it has to come above the group that references it
|
229
237
|
|
230
238
|
#### Examples
|
231
239
|
|
@@ -384,6 +392,52 @@ In this case, you're all set and onceover will auto-magically pick those up for
|
|
384
392
|
|
385
393
|
**Note**: The top level `trusted` hash takes precidence over the `trusted[extensions]` hash nested under `values`. Meaning that if you have any specified at the top level, any nested ones will not be considered. So pick **ONE** method and stick with that.
|
386
394
|
|
395
|
+
#### Trusted Certname
|
396
|
+
|
397
|
+
**Note:** When testing with Puppet >= 4.3 the trusted facts hash will have the standard trusted fact keys (certname, domain, and hostname) populated based on the node name (as set with :node).
|
398
|
+
|
399
|
+
To support the resolution of the trusted fact `certname` in auto-generated spec tests, onceover will set `:node` to the value of `trusted[certname]` where present in the source factset.
|
400
|
+
|
401
|
+
For example: A spec test generated by the factset below would result in `:node` == `node.puppetlabs.net`.
|
402
|
+
|
403
|
+
```json
|
404
|
+
{
|
405
|
+
"name": "node.puppetlabs.net",
|
406
|
+
"values": {
|
407
|
+
"aio_agent_build": "1.10.4",
|
408
|
+
"aio_agent_version": "1.10.4",
|
409
|
+
"architecture": "x86_64",
|
410
|
+
"trusted": {
|
411
|
+
"certname": "node.puppetlabs.net",
|
412
|
+
"extensions": {
|
413
|
+
"pp_role": "agent",
|
414
|
+
"pp_datacenter": "puppet"
|
415
|
+
}
|
416
|
+
}
|
417
|
+
```
|
418
|
+
|
419
|
+
If `trusted[certname]` is absent, the value of `:node` will default to the FQDN of the host running onceover. For example:
|
420
|
+
|
421
|
+
```json
|
422
|
+
{
|
423
|
+
"name": "node.puppetlabs.net",
|
424
|
+
"values": {
|
425
|
+
"aio_agent_build": "1.10.4",
|
426
|
+
"aio_agent_version": "1.10.4",
|
427
|
+
"architecture": "x86_64",
|
428
|
+
"trusted": {
|
429
|
+
"extensions": {
|
430
|
+
"pp_role": "agent",
|
431
|
+
"pp_datacenter": "puppet"
|
432
|
+
}
|
433
|
+
}
|
434
|
+
```
|
435
|
+
|
436
|
+
See the following rspec-puppet links for more information:
|
437
|
+
|
438
|
+
- [Specifying the FQDN of the test node](https://github.com/puppetlabs/rspec-puppet#specifying-the-fqdn-of-the-test-node)
|
439
|
+
- [Specifying trusted facts](https://github.com/puppetlabs/rspec-puppet#specifying-trusted-facts)
|
440
|
+
|
387
441
|
#### Trusted External Data
|
388
442
|
|
389
443
|
**Note:** This feature requires `rspec-puppet` >= 2.8.0.
|
@@ -444,7 +498,7 @@ In these instances it may be worth creating a hierarchy level that simply includ
|
|
444
498
|
|
445
499
|
Organisations often reference modules from their own git servers in the `Puppetfile`, like this:
|
446
500
|
|
447
|
-
```
|
501
|
+
```ruby
|
448
502
|
mod "puppetlabs-apache",
|
449
503
|
:git => "https://git.megacorp.com/pup/puppetlabs-apache.git",
|
450
504
|
:tag => "v5.4.0"
|
@@ -454,7 +508,7 @@ Under the hood, `onceover` uses `r10k` to download the modules in your `Puppetfi
|
|
454
508
|
If you get errors downloading modules from `git`, its because `r10k`'s call to your underlying `git` command has failed.
|
455
509
|
`onceover` tells you the command that `r10k` tried to run, so if you get an error like this:
|
456
510
|
|
457
|
-
```
|
511
|
+
```text
|
458
512
|
INFO -> Updating module /Users/dylan/control-repo/.onceover/etc/puppetlabs/code/environments
|
459
513
|
/production/modules/apache
|
460
514
|
ERROR -> Command exited with non-zero exit code:
|
@@ -472,14 +526,17 @@ Exit code: 128
|
|
472
526
|
|
473
527
|
Then the approach to debug it would be to run the command that Onceover suggested:
|
474
528
|
|
475
|
-
```
|
529
|
+
```shell
|
476
530
|
git --git-dir /Users/dylan/.r10k/git/ssh---git.megacorp.com-pup-puppetlabs_apache.git fetch origin --prune
|
477
531
|
```
|
478
532
|
|
479
533
|
In this case, running the command interactively gives us a prompt to add the server to our `~/.ssh/known_hosts` file, which fixes the problem permanently:
|
480
534
|
|
481
|
-
```
|
535
|
+
```shell
|
482
536
|
$ git --git-dir /Users/dylan/.r10k/git/ssh---git.megacorp.com-pup-puppetlabs_apache.git fetch origin --prune
|
537
|
+
```
|
538
|
+
|
539
|
+
```text
|
483
540
|
The authenticity of host 'git.megacorp.com (123.456.789.101)' can't be established.
|
484
541
|
...
|
485
542
|
Warning: Permanently added 'git.megacorp.com,123.456.789.101' (RSA) to the list of known hosts.
|
@@ -561,13 +618,37 @@ If you want to see Puppet's output, you can set the `SHOW_PUPPET_OUTPUT` environ
|
|
561
618
|
|
562
619
|
`SHOW_PUPPET_OUTPUT=true onceover run spec`
|
563
620
|
|
621
|
+
### Vendored Modules
|
622
|
+
|
623
|
+
As of Puppet 6.0 some resource types were removed from Puppet and repackaged as individual modules. These supported type modules are still included in the `puppet-agent` package, so you don't have to download them from the Forge. However, this does not apply to the `puppet` gem used when spec testing. This frequently results in users wondering why their Puppet manifests apply just fine on a node, but their tests fail with messages like `Unknown resource type: cron_core` for example. A common workaround for this problem was to add said modules into your Puppetfile, thus requiring manual management.
|
624
|
+
|
625
|
+
Onceover now has the ability to remove that manual process for you by querying Github's API to determine which versions are in use by the version of the [puppet-agent package](https://github.com/puppetlabs/puppet-agent/tree/main/configs/components) you are testing against.
|
626
|
+
|
627
|
+
This functionality is opt in, so to use it configure the following:
|
628
|
+
|
629
|
+
```yaml
|
630
|
+
# onceover.yaml
|
631
|
+
opts:
|
632
|
+
auto_vendored: true
|
633
|
+
```
|
634
|
+
|
635
|
+
or on the cli:
|
636
|
+
|
637
|
+
```shell
|
638
|
+
bundle exec onceover run spec --auto_vendored=true
|
639
|
+
```
|
640
|
+
|
641
|
+
Essentially what this is doing is resolving any of these [supported type modules](https://www.puppet.com/docs/puppet/8/type#supported-type-modules-in-puppet-agent) that are not already specified in your Puppetfile, and adding them to the copy Onceover uses to deploy into its working directory structure.
|
642
|
+
|
643
|
+
CI/CD pipeline users are encouraged to provide Onceover with a cache of the module versions to test against in order to avoid hitting Githubs API ratelimit. To do so, the [generate_vendor_cache](#generate_vendor_cache) rake task can be used to populate the cache into your `spec/vendored_modules` directory.
|
644
|
+
|
564
645
|
## Using workarounds
|
565
646
|
|
566
647
|
There may be situations where you cannot test everything that is in your puppet code, some common reasons for this include:
|
567
648
|
|
568
|
-
|
569
|
-
|
570
|
-
|
649
|
+
- Code is destined for a Puppet Master but the VM image is not a Puppet Master which means we can't restart certain services etc.
|
650
|
+
- A file is being pulled from somewhere that is only accessible in production
|
651
|
+
- Something is trying to connect to something else that does not exist
|
571
652
|
|
572
653
|
Fear not! There is a solution for this, it's also a good way to practice writing *nasty* puppet code. For this exact purpose I have added the ability for onceover to include extra bits of code in the tests to fix things like this. All you need to do is put a file/s containing puppet code here:
|
573
654
|
|
@@ -629,8 +710,8 @@ Onceover now allows for plugins. To use a plugin simply install a gem with a nam
|
|
629
710
|
|
630
711
|
Useful plugins:
|
631
712
|
|
632
|
-
|
633
|
-
|
713
|
+
- [onceover-codequality](https://github.com/declarativesystems/onceover-codequality) _Check lint and syntax_
|
714
|
+
- [onceover-octocatalog-diff](https://github.com/voxpupuli/onceover-octocatalog-diff) _See the differences between two versions of a catalog_
|
634
715
|
|
635
716
|
If you want to write your own plugin, take a look at [onceover-helloworld](https://github.com/declarativesystems/onceover-helloworld) to help you get started.
|
636
717
|
|
@@ -835,6 +916,12 @@ fixtures:
|
|
835
916
|
|
836
917
|
Notice that the symlinks are not the ones that we provided in `environment.conf`? This is because the rake task will go into each of directories, find the modules and create a symlink for each of them (This is what rspec expects).
|
837
918
|
|
919
|
+
#### generate_vendor_cache
|
920
|
+
|
921
|
+
`bundle exec rake generate_vendor_cache`
|
922
|
+
|
923
|
+
This task will query Github's API to determine the versions of the vendored modules in use by the version of the puppet agent you are testing against, and cache that information in `control-repo/spec/vendored_modules`. This way your pipelines won't need to reach out for this information each time Onceover is ran with `auto_vendored` enabled.
|
924
|
+
|
838
925
|
## Developing Onceover
|
839
926
|
|
840
927
|
Install gem dependencies:
|
@@ -853,23 +940,26 @@ Execute tests
|
|
853
940
|
|
854
941
|
Cheers to all of those who helped out:
|
855
942
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
943
|
+
- @jessereynolds
|
944
|
+
- @op-ct
|
945
|
+
- @GeoffWilliams
|
946
|
+
- @beergeek
|
947
|
+
- @jairojunior
|
948
|
+
- @natemccurdy
|
949
|
+
- @aardvark
|
950
|
+
- @Mandos
|
951
|
+
- @Nekototori
|
952
|
+
- @LMacchi
|
953
|
+
- @tabakhase
|
954
|
+
- @binford2k
|
955
|
+
- @raphink
|
956
|
+
- @tequeter
|
957
|
+
- @alexjfisher
|
958
|
+
- @smortex
|
959
|
+
- @16c7x
|
960
|
+
- @neomilium
|
961
|
+
- @chlawren
|
962
|
+
|
963
|
+
## Transfer Notice
|
964
|
+
|
965
|
+
This project was originally authored by dylanratcliffe. The maintainer preferred that Vox Pupuli take ownership of the project for future improvement and maintenance. Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of voxpupuli-onceover.
|
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rubygems/tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
require 'cucumber/rake/task'
|
4
|
-
require 'rubocop/rake_task'
|
5
4
|
require 'puppet/version'
|
6
5
|
Gem::Tasks.new
|
7
6
|
|
@@ -33,15 +32,13 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
|
|
33
32
|
t.cucumber_opts = "--tags \"#{skip_string}\"" # Any valid command line option can go here.
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
35
|
task default: :full_tests
|
38
36
|
|
39
|
-
|
40
37
|
desc "Run unit tests"
|
41
|
-
task rspec_unit_tests: [:syntax, :
|
38
|
+
task rspec_unit_tests: [:syntax, :spec]
|
42
39
|
|
43
40
|
desc "Run acceptance cucumber tests"
|
44
|
-
task cucumber_acceptance_tests: [:syntax, :
|
41
|
+
task cucumber_acceptance_tests: [:syntax, :fixtures, :cucumber]
|
45
42
|
|
46
43
|
desc "Run full set of tests"
|
47
44
|
task full_tests: [:rspec_unit_tests, :cucumber_acceptance_tests]
|
@@ -51,6 +48,7 @@ task :syntax do
|
|
51
48
|
require 'find'
|
52
49
|
Find.find(*paths) do |path|
|
53
50
|
next unless path =~ /\.rb$/
|
51
|
+
|
54
52
|
if windows?
|
55
53
|
sh "ruby -cw #{path} > NUL"
|
56
54
|
else
|
@@ -59,16 +57,28 @@ task :syntax do
|
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
RuboCop::RakeTask.new(:rubocop) do |task|
|
63
|
-
task.options << '--display-cop-names'
|
64
|
-
task.formatters = ['simple']
|
65
|
-
task.patterns = [
|
66
|
-
"lib/**/*.rb",
|
67
|
-
"ext/**/*.rb",
|
68
|
-
]
|
69
|
-
end
|
70
|
-
|
71
60
|
task :fixtures do
|
72
61
|
system 'git submodule init && git submodule update --recursive'
|
73
62
|
raise "Couldn't clone controlrepo to fixtures directory" unless $?.success?
|
74
63
|
end
|
64
|
+
|
65
|
+
begin
|
66
|
+
require 'voxpupuli/rubocop/rake'
|
67
|
+
rescue LoadError
|
68
|
+
# the voxpupuli-rubocop gem is optional
|
69
|
+
end
|
70
|
+
|
71
|
+
begin
|
72
|
+
require 'rubygems'
|
73
|
+
require 'github_changelog_generator/task'
|
74
|
+
rescue LoadError
|
75
|
+
# Do nothing if no required gem installed
|
76
|
+
else
|
77
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
78
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions]
|
79
|
+
config.user = 'voxpupuli'
|
80
|
+
config.project = 'onceover'
|
81
|
+
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
|
82
|
+
config.future_release = gem_version
|
83
|
+
end
|
84
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --publish-quiet
|
@@ -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
|
+
|
@@ -27,19 +27,19 @@ Given(/^control repo "([^"]*)" without "([^"]*)"$/) do |controlrepo_name, filena
|
|
27
27
|
FileUtils.rm_rf "#{@repo.root_folder}/#{filename}"
|
28
28
|
end
|
29
29
|
|
30
|
-
When(/^I run onceover command "([^"]*)"$/)
|
30
|
+
When(/^I run onceover command "([^"]*)"$/) do |command|
|
31
31
|
@cmd.command = "#{command} --debug"
|
32
32
|
log(@cmd)
|
33
33
|
@cmd.run
|
34
34
|
end
|
35
35
|
|
36
|
-
When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/)
|
36
|
+
When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/) do |command, cls|
|
37
37
|
@cmd.command = "#{command} --classes #{cls}"
|
38
38
|
log(@cmd)
|
39
39
|
@cmd.run
|
40
40
|
end
|
41
41
|
|
42
|
-
When(/^I run onceover command "([^"]*)" with class "([^"]*)" on nodes "([^"]*)"$/)
|
42
|
+
When(/^I run onceover command "([^"]*)" with class "([^"]*)" on nodes "([^"]*)"$/) do |command, cls, nodes|
|
43
43
|
@cmd.command = "#{command} --classes #{cls} --nodes #{nodes}"
|
44
44
|
log(@cmd)
|
45
45
|
@cmd.run
|
@@ -109,7 +109,7 @@ Then(/^I should (not )?see message pattern "([^"]*)"$/) do |notword, msg_regexp|
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/)
|
112
|
+
When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/) do |command, puppetfile|
|
113
113
|
puppetfile_path = @repo.root_folder + puppetfile
|
114
114
|
@cmd.command = "#{command} --puppetfile #{puppetfile_path} --debug"
|
115
115
|
log(@cmd)
|
@@ -117,7 +117,7 @@ When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/) do |comm
|
|
117
117
|
end
|
118
118
|
|
119
119
|
Then(/^([^"]*) should be copied to Puppetfile$/) do |puppetfile|
|
120
|
-
source =
|
120
|
+
source = @repo.root_folder + puppetfile
|
121
121
|
destination = @repo.onceover_temp_puppetfile
|
122
122
|
expect(IO.read(source)).to eq(IO.read(destination))
|
123
123
|
end
|