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.
Files changed (324) hide show
  1. checksums.yaml +7 -0
  2. data/.devcontainer/devcontainer.json +31 -0
  3. data/.gitattributes +2 -0
  4. data/.github/workflows/ci.yml +81 -0
  5. data/.github/workflows/mend.yml +14 -0
  6. data/.github/workflows/nightly.yml +66 -0
  7. data/.github/workflows/release.yaml +16 -0
  8. data/.github/workflows/release_prep.yml +20 -0
  9. data/.gitignore +19 -0
  10. data/.rubocop.yml +19 -0
  11. data/.rubocop_todo.yml +804 -0
  12. data/.vscode/extensions.json +4 -0
  13. data/ARCHIVE.md +395 -0
  14. data/CHANGELOG.md +25 -0
  15. data/CODEOWNERS +2 -0
  16. data/Gemfile +65 -0
  17. data/LICENSE +202 -0
  18. data/README.md +965 -0
  19. data/Rakefile +86 -0
  20. data/bin/puppetlabs-onceover +17 -0
  21. data/cucumber.yml +1 -0
  22. data/factsets/AIX-6.1-powerpc.json +210 -0
  23. data/factsets/AIX-7.1-powerpc.json +215 -0
  24. data/factsets/Amazon-2018.03.json +420 -0
  25. data/factsets/CentOS-5.11-32.json +263 -0
  26. data/factsets/CentOS-5.11-64.json +263 -0
  27. data/factsets/CentOS-6.6-32.json +306 -0
  28. data/factsets/CentOS-6.6-64.json +342 -0
  29. data/factsets/CentOS-7.0-64.json +352 -0
  30. data/factsets/CentOS-8.3.2011-64.json +485 -0
  31. data/factsets/Debian-10.4-64.json +476 -0
  32. data/factsets/Debian-6.0.10-32.json +322 -0
  33. data/factsets/Debian-6.0.10-64.json +322 -0
  34. data/factsets/Debian-7.8-32.json +338 -0
  35. data/factsets/Debian-7.8-64.json +338 -0
  36. data/factsets/Debian-8.11-64.json +480 -0
  37. data/factsets/Debian-9.12-64.json +476 -0
  38. data/factsets/RHEL-6.7.json +415 -0
  39. data/factsets/RHEL-7.4.json +489 -0
  40. data/factsets/SLES-11.3-64.json +317 -0
  41. data/factsets/SLES-12.1-64.json +353 -0
  42. data/factsets/Ubuntu-12.04-32.json +328 -0
  43. data/factsets/Ubuntu-12.04-64.json +328 -0
  44. data/factsets/Ubuntu-14.04-32.json +337 -0
  45. data/factsets/Ubuntu-14.04-64.json +373 -0
  46. data/factsets/Ubuntu-18.04-64.json +556 -0
  47. data/factsets/Ubuntu-20.04-64.json +504 -0
  48. data/factsets/Windows_Server-2008r2-64.json +184 -0
  49. data/factsets/Windows_Server-2012r2-64.json +165 -0
  50. data/factsets/solaris-10_u9-sparc-64.json +769 -0
  51. data/factsets/solaris-11.2-sparc-64.json +774 -0
  52. data/factsets/windows-10-64.json +104 -0
  53. data/features/auto_vendored.feature +27 -0
  54. data/features/cache.feature +38 -0
  55. data/features/factsets.feature +48 -0
  56. data/features/formatting.feature +36 -0
  57. data/features/help.feature +14 -0
  58. data/features/init.feature +18 -0
  59. data/features/show.feature +28 -0
  60. data/features/step_definitions/cache.rb +38 -0
  61. data/features/step_definitions/common.rb +123 -0
  62. data/features/step_definitions/formatter.rb +41 -0
  63. data/features/step_definitions/init.rb +17 -0
  64. data/features/step_definitions/run.rb +17 -0
  65. data/features/support/cache_helper.rb +54 -0
  66. data/features/support/command_helper.rb +32 -0
  67. data/features/support/controlrepo_helper.rb +36 -0
  68. data/features/support/env.rb +2 -0
  69. data/features/windows.feature +35 -0
  70. data/features/zzz_run.feature +93 -0
  71. data/lib/puppetlabs-onceover/beaker/spec_helper.rb +71 -0
  72. data/lib/puppetlabs-onceover/beaker.rb +241 -0
  73. data/lib/puppetlabs-onceover/class.rb +56 -0
  74. data/lib/puppetlabs-onceover/cli/init.rb +34 -0
  75. data/lib/puppetlabs-onceover/cli/plugins.rb +10 -0
  76. data/lib/puppetlabs-onceover/cli/run.rb +85 -0
  77. data/lib/puppetlabs-onceover/cli/show.rb +79 -0
  78. data/lib/puppetlabs-onceover/cli/update.rb +48 -0
  79. data/lib/puppetlabs-onceover/cli.rb +47 -0
  80. data/lib/puppetlabs-onceover/controlrepo.rb +688 -0
  81. data/lib/puppetlabs-onceover/deploy.rb +171 -0
  82. data/lib/puppetlabs-onceover/group.rb +78 -0
  83. data/lib/puppetlabs-onceover/logger.rb +32 -0
  84. data/lib/puppetlabs-onceover/node.rb +72 -0
  85. data/lib/puppetlabs-onceover/rake_tasks.rb +95 -0
  86. data/lib/puppetlabs-onceover/rspec/formatters.rb +315 -0
  87. data/lib/puppetlabs-onceover/runner.rb +139 -0
  88. data/lib/puppetlabs-onceover/test.rb +135 -0
  89. data/lib/puppetlabs-onceover/testconfig.rb +315 -0
  90. data/lib/puppetlabs-onceover/vendored_modules.rb +202 -0
  91. data/lib/puppetlabs-onceover/version.rb +5 -0
  92. data/puppetlabs-onceover.gemspec +40 -0
  93. data/spec/fixtures/controlrepos/basic/Puppetfile +17 -0
  94. data/spec/fixtures/controlrepos/basic/environment.conf +7 -0
  95. data/spec/fixtures/controlrepos/basic/hieradata/common.yaml +2 -0
  96. data/spec/fixtures/controlrepos/basic/hieradata/nodes/example-node.yaml +1 -0
  97. data/spec/fixtures/controlrepos/basic/manifests/site.pp +32 -0
  98. data/spec/fixtures/controlrepos/basic/manifests_alternate/site.pp +2 -0
  99. data/spec/fixtures/controlrepos/basic/site/profile/manifests/base.pp +5 -0
  100. data/spec/fixtures/controlrepos/basic/site/profile/manifests/example.pp +3 -0
  101. data/spec/fixtures/controlrepos/basic/site/role/manifests/database_server.pp +7 -0
  102. data/spec/fixtures/controlrepos/basic/site/role/manifests/example.pp +3 -0
  103. data/spec/fixtures/controlrepos/basic/site/role/manifests/webserver.pp +7 -0
  104. data/spec/fixtures/controlrepos/caching/.gitignore +1 -0
  105. data/spec/fixtures/controlrepos/caching/.travis.yml +2 -0
  106. data/spec/fixtures/controlrepos/caching/Gemfile +5 -0
  107. data/spec/fixtures/controlrepos/caching/Puppetfile +17 -0
  108. data/spec/fixtures/controlrepos/caching/Rakefile +1 -0
  109. data/spec/fixtures/controlrepos/caching/deleteme.txt +0 -0
  110. data/spec/fixtures/controlrepos/caching/environment.conf +2 -0
  111. data/spec/fixtures/controlrepos/caching/hieradata/common.yaml +2 -0
  112. data/spec/fixtures/controlrepos/caching/hieradata/nodes/example-node.yaml +1 -0
  113. data/spec/fixtures/controlrepos/caching/manifests/site.pp +33 -0
  114. data/spec/fixtures/controlrepos/caching/site/profile/manifests/base.pp +5 -0
  115. data/spec/fixtures/controlrepos/caching/site/profile/manifests/example.pp +3 -0
  116. data/spec/fixtures/controlrepos/caching/site/role/manifests/database_server.pp +7 -0
  117. data/spec/fixtures/controlrepos/caching/site/role/manifests/example.pp +3 -0
  118. data/spec/fixtures/controlrepos/caching/site/role/manifests/webserver.pp +7 -0
  119. data/spec/fixtures/controlrepos/caching/spec/factsets/Debian-10-facter-4.json +1091 -0
  120. data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +7 -0
  121. data/spec/fixtures/controlrepos/caching/spec/onceover.yaml +55 -0
  122. data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +24 -0
  123. data/spec/fixtures/controlrepos/caching/spec/pre_conditions/escaping.pp +7 -0
  124. data/spec/fixtures/controlrepos/caching/spec/r10k.yaml +3 -0
  125. data/spec/fixtures/controlrepos/control_branch/Puppetfile +18 -0
  126. data/spec/fixtures/controlrepos/control_branch/environment.conf +2 -0
  127. data/spec/fixtures/controlrepos/custom_puppetfile/Puppetfile.custom +3 -0
  128. data/spec/fixtures/controlrepos/custom_puppetfile/environment.conf +7 -0
  129. data/spec/fixtures/controlrepos/factsets/environment.conf +1 -0
  130. data/spec/fixtures/controlrepos/factsets/site/profile/manifests/base.pp +6 -0
  131. data/spec/fixtures/controlrepos/factsets/site/role/manifests/example.pp +4 -0
  132. data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_extensions.pp +6 -0
  133. data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_external.pp +6 -0
  134. data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +7 -0
  135. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_notrusted.json +530 -0
  136. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_nested.json +535 -0
  137. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_top.json +533 -0
  138. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_nested.json +537 -0
  139. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_top.json +535 -0
  140. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos_7_facter_4.json +706 -0
  141. data/spec/fixtures/controlrepos/factsets/spec/factsets/centos_with_env.json +353 -0
  142. data/spec/fixtures/controlrepos/function_mocking/.gitignore +1 -0
  143. data/spec/fixtures/controlrepos/function_mocking/Puppetfile +4 -0
  144. data/spec/fixtures/controlrepos/function_mocking/Rakefile +1 -0
  145. data/spec/fixtures/controlrepos/function_mocking/environment.conf +2 -0
  146. data/spec/fixtures/controlrepos/function_mocking/site/profile/functions/fail_puppet.pp +5 -0
  147. data/spec/fixtures/controlrepos/function_mocking/site/profile/lib/puppet/functions/profile/fail_ruby.rb +9 -0
  148. data/spec/fixtures/controlrepos/function_mocking/site/profile/manifests/base.pp +10 -0
  149. data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/fail.pp +7 -0
  150. data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_data_return.pp +19 -0
  151. data/spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_new_functions.pp +12 -0
  152. data/spec/fixtures/controlrepos/function_mocking/spec/onceover.yaml +50 -0
  153. data/spec/fixtures/controlrepos/minimal/environment.conf +2 -0
  154. data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
  155. data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
  156. data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
  157. data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
  158. data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
  159. data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
  160. data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
  161. data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
  162. data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +33 -0
  163. data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
  164. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
  165. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
  166. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
  167. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
  168. data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
  169. data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
  170. data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
  171. data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
  172. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
  173. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
  174. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
  175. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
  176. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
  177. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
  178. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
  179. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
  180. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
  181. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
  182. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
  183. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
  184. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
  185. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
  186. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
  187. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
  188. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
  189. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
  190. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
  191. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
  192. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
  193. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
  194. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
  195. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
  196. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
  197. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
  198. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
  199. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
  200. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
  201. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
  202. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
  203. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
  204. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
  205. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
  206. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
  207. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
  208. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
  209. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
  210. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
  211. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
  212. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
  213. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
  214. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
  215. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
  216. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
  217. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
  218. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
  219. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
  220. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
  221. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
  222. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
  223. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
  224. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
  225. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
  226. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
  227. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
  228. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
  229. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
  230. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
  231. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
  232. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
  233. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
  234. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
  235. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
  236. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
  237. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
  238. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
  239. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
  240. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
  241. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
  242. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
  243. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
  244. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
  245. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
  246. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
  247. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
  248. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
  249. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
  250. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
  251. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
  252. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
  253. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
  254. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
  255. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
  256. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
  257. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
  258. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
  259. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
  260. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
  261. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
  262. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
  263. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
  264. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
  265. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
  266. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
  267. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
  268. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
  269. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
  270. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
  271. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
  272. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
  273. data/spec/fixtures/controlrepos/vendored/Puppetfile +3 -0
  274. data/spec/fixtures/controlrepos/vendored/Puppetfile.cron +5 -0
  275. data/spec/fixtures/controlrepos/vendored/environment.conf +1 -0
  276. data/spec/fixtures/controlrepos/vendored/site-modules/role/manifests/cron.pp +9 -0
  277. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-7.30.0.json +1 -0
  278. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-8.6.0.json +1 -0
  279. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-7.30.0.json +1 -0
  280. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-8.6.0.json +1 -0
  281. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-7.30.0.json +1 -0
  282. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-8.6.0.json +1 -0
  283. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-7.30.0.json +1 -0
  284. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-8.6.0.json +1 -0
  285. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-7.30.0.json +1 -0
  286. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-8.6.0.json +1 -0
  287. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-7.30.0.json +1 -0
  288. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-8.6.0.json +1 -0
  289. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-7.30.0.json +1 -0
  290. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-8.6.0.json +1 -0
  291. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-7.30.0.json +1 -0
  292. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json +1 -0
  293. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json +1 -0
  294. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json +1 -0
  295. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json +1 -0
  296. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json +1 -0
  297. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json +1 -0
  298. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json +1 -0
  299. data/spec/fixtures/controlrepos/windows/Gemfile +3 -0
  300. data/spec/fixtures/controlrepos/windows/Puppetfile +8 -0
  301. data/spec/fixtures/controlrepos/windows/environment.conf +1 -0
  302. data/spec/fixtures/controlrepos/windows/site/role/manifests/groups.pp +8 -0
  303. data/spec/fixtures/controlrepos/windows/site/role/manifests/users.pp +9 -0
  304. data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/acl.pp +12 -0
  305. data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/choco.pp +9 -0
  306. data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/groups.pp +8 -0
  307. data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/users.pp +9 -0
  308. data/spec/fixtures/controlrepos/windows/spec/onceover.yaml +24 -0
  309. data/spec/puppetlabs-onceover/controlrepo_spec.rb +18 -0
  310. data/spec/spec_helper.rb +8 -0
  311. data/templates/.fixtures.yml.erb +24 -0
  312. data/templates/Gemfile.erb +3 -0
  313. data/templates/Rakefile.erb +1 -0
  314. data/templates/acceptance_test_spec.rb.erb +66 -0
  315. data/templates/controlrepo.yaml.erb +38 -0
  316. data/templates/error_summary.yaml.erb +17 -0
  317. data/templates/factsets_README.md.erb +10 -0
  318. data/templates/nodeset.yaml.erb +12 -0
  319. data/templates/pre_conditions_README.md.erb +24 -0
  320. data/templates/spec_helper.rb.erb +35 -0
  321. data/templates/spec_helper_acceptance.rb.erb +1 -0
  322. data/templates/test_spec.rb.erb +150 -0
  323. data/templates/testconfig_Rakefile.erb +47 -0
  324. metadata +602 -0
@@ -0,0 +1,36 @@
1
+ class ControlRepo_Helper
2
+ attr_reader :tmp_folder
3
+
4
+ def initialize( name )
5
+ @name = name
6
+ @tmp_folder = '.cucumber/tmp/'
7
+ end
8
+
9
+ def root_folder
10
+ @tmp_folder + @name + '/'
11
+ end
12
+
13
+ def puppetfile
14
+ root_folder + "Puppetfile"
15
+ end
16
+
17
+ def onceover_temp_root_folder
18
+ root_folder + '.onceover/etc/puppetlabs/code/environments/production/'
19
+ end
20
+
21
+ def onceover_temp_puppetfile
22
+ onceover_temp_root_folder + "Puppetfile"
23
+ end
24
+
25
+ def config_file
26
+ root_folder + 'spec/onceover.yaml'
27
+ end
28
+
29
+ def config_file_contents
30
+ File.read(config_file)
31
+ end
32
+
33
+ def add_line_to_puppetfile( line )
34
+ open(puppetfile, 'a') { |f| f.puts line }
35
+ end
36
+ end
@@ -0,0 +1,2 @@
1
+
2
+
@@ -0,0 +1,35 @@
1
+ @windows
2
+ Feature: Run onceover with windows
3
+ Onceover should allow to run rspec and acceptance test for all profvile and role classes
4
+ or for any part of them. Use should set if he wants to see only summary of tests or full
5
+ log info.
6
+
7
+ Background:
8
+ Given onceover executable
9
+
10
+ Scenario: Run with common Windows code
11
+ Given control repo "windows"
12
+ When I run onceover command "run spec" with class "role::users"
13
+ Then I should not see any errors
14
+
15
+ Scenario: Run with common Windows code without workarounds
16
+ Given existing control repo "windows"
17
+ When I run onceover command "run spec --no_workarounds" with class "role::users"
18
+ And test osfamily is not "windows"
19
+ Then Onceover should exit 1
20
+
21
+ Scenario: Compiling a windows role with groups that is valid should compile
22
+ Given control repo "windows"
23
+ When I run onceover command "run spec" with class "role::groups"
24
+ Then I should not see any errors
25
+
26
+ Scenario: Compiling a windows role with users that is valid should compile
27
+ Given control repo "windows"
28
+ When I run onceover command "run spec" with class "role::users"
29
+ Then I should not see any errors
30
+
31
+ Scenario: Compiling a windows role with chocolatey that is valid should compile
32
+ Given control repo "windows"
33
+ When I run onceover command "run spec" with class "role::choco"
34
+ Then I should not see any errors
35
+
@@ -0,0 +1,93 @@
1
+ @run
2
+ Feature: Run rspec and acceptance test suites
3
+ Onceover should allow to run rspec and acceptance test for all profile and role classes
4
+ or for any part of them. Use should set if he wants to see only summary of tests or full
5
+ log info.
6
+
7
+ Background:
8
+ Given onceover executable
9
+
10
+ Scenario: Run without a Puppetfile
11
+ Given initialized control repo "minimal"
12
+ When I run onceover command "run spec"
13
+ Then I should not see any errors
14
+
15
+ Scenario: Run correct spec tests
16
+ Given initialized control repo "basic"
17
+ When I run onceover command "run spec"
18
+ Then I should not see any errors
19
+
20
+ Scenario: Run correct spec tests in parallel
21
+ Given initialized control repo "basic"
22
+ When I run onceover command "run spec --parallel"
23
+ Then I should not see any errors
24
+
25
+ Scenario: Using regexes to define tests
26
+ Given initialized control repo "caching"
27
+ When I run onceover command "run spec"
28
+ Then I should see message pattern "apache::params"
29
+
30
+ Scenario: Checking that r10k config works
31
+ Given initialized control repo "caching"
32
+ When I run onceover command "run spec --debug"
33
+ Then I should see message pattern "r10k.yaml"
34
+
35
+ Scenario: Run spec tests with misspelled module in Puppetfile
36
+ Given initialized control repo "basic"
37
+ And in Puppetfile is misspelled module's name
38
+ When I run onceover command "run spec"
39
+ Then I should see error with message pattern "The module acme-not_exists does not exist"
40
+
41
+ @skip_on_windows
42
+ Scenario: Force overwrite local modifications
43
+ Given initialized control repo "basic"
44
+ When I run onceover command "run spec"
45
+ And I make local modifications
46
+ And I run onceover command "run spec --force"
47
+ Then I should see message pattern "Overwriting local modifications"
48
+
49
+ Scenario: When using an alternate manifests directory
50
+ Given initialized control repo "basic"
51
+ When I run onceover command "run spec --manifest manifests_alternate"
52
+ Then I should see error with message pattern "Using alternate site.pp"
53
+
54
+ Scenario: Check that control_branch functionality works
55
+ Given initialized control repo "control_branch"
56
+ When I run onceover command "run spec"
57
+ Then the temporary Puppetfile should contain the git branch
58
+
59
+ Scenario: Mocking functions should work and return the correct data types
60
+ Given control repo "function_mocking"
61
+ When I run onceover command "run spec" with class "role::test_data_return"
62
+ Then I should not see any errors
63
+
64
+ Scenario: Mocking functions that use the new :: pathing
65
+ Given control repo "function_mocking"
66
+ When I run onceover command "run spec" with class "role::test_new_functions"
67
+ Then I should not see any errors
68
+
69
+ Scenario: Running tests that fail to compile
70
+ Given control repo "function_mocking"
71
+ When I run onceover command "run spec" with class "role::fail"
72
+ Then I should see message pattern "Syntax error at 'is'"
73
+ And Onceover should exit 1
74
+
75
+ Scenario: Run with a custom Puppetfile
76
+ Given initialized control repo "custom_puppetfile"
77
+ When I run onceover command "run spec" with --puppetfile Puppetfile.custom
78
+ Then Puppetfile.custom should be copied to Puppetfile
79
+ And I should see message pattern "Using Puppetfile .*Puppetfile"
80
+ And I should see message pattern ".*extlib"
81
+
82
+ Scenario: Testing that --tags works with native rspec tags
83
+ Given control repo "puppet_controlrepo"
84
+ When I run onceover command "run spec --tags syntax"
85
+ Then I should not see any errors
86
+ And I should see message pattern "When checking Puppet syntax"
87
+ And I should not see message pattern "role::"
88
+
89
+ # This test is a full test using my controlrepo. It should remain at the end because it takes ages
90
+ Scenario: Run advanced spec tests
91
+ Given control repo "puppet_controlrepo"
92
+ When I run onceover command "run spec -p --force"
93
+ Then I should not see any errors
@@ -0,0 +1,71 @@
1
+ # This has all been hacked out of the beaker-rspec gem. The reason I have
2
+ # hacked it out instead of just using it the way it was intended is that
3
+ # it is very stuck in its ways around how it spins up all the servers
4
+ # first, then goes ahead and runs the tests. Because I don't want to do this
5
+ # I have had to replicate MOST of the functionality, EXCEPT the stuff I don't
6
+ # want. This is annoying but as far as I can tell this is the only way to do
7
+ # it
8
+
9
+ require 'beaker'
10
+ require 'beaker-rspec/beaker_shim' # This overloads Rspec's methods and provides the interface between beaker and RSpec
11
+ require "beaker-rspec/helpers/serverspec"
12
+ include BeakerRSpec::BeakerShim
13
+
14
+ require 'puppetlabs-onceover/beaker'
15
+
16
+ #scp_to hosts, '<%= repo.tempdir %>/etc', '/'
17
+
18
+ RSpec.configure do |c|
19
+ # Enable color
20
+ c.color = true
21
+ c.tty = true
22
+
23
+ # Readable test descriptions
24
+ c.formatter = :documentation
25
+
26
+ # Define persistant hosts setting
27
+ c.add_setting :hosts, :default => []
28
+ # Define persistant options setting
29
+ c.add_setting :options, :default => {}
30
+ # Define persistant metadata object
31
+ c.add_setting :metadata, :default => {}
32
+ # Define persistant logger object
33
+ c.add_setting :logger, :default => nil
34
+ # Define persistant default node
35
+ c.add_setting :default_node, :default => nil
36
+
37
+ #default option values
38
+ defaults = {
39
+ :nodeset => 'onceover-nodes',
40
+ }
41
+ #read env vars
42
+ env_vars = {
43
+ :color => ENV['BEAKER_color'] || ENV.fetch('RS_COLOR', nil),
44
+ :nodeset => ENV['BEAKER_set'] || ENV.fetch('RS_SET', nil),
45
+ :nodesetfile => ENV['BEAKER_setfile'] || ENV.fetch('RS_SETFILE', nil),
46
+ :provision => ENV['BEAKER_provision'] || ENV.fetch('RS_PROVISION', nil),
47
+ :keyfile => ENV['BEAKER_keyfile'] || ENV.fetch('RS_KEYFILE', nil),
48
+ :debug => ENV['BEAKER_debug'] || ENV.fetch('RS_DEBUG', nil),
49
+ :destroy => ENV['BEAKER_destroy'] || ENV.fetch('RS_DESTROY', nil),
50
+ }.compact
51
+ #combine defaults and env_vars to determine overall options
52
+ options = defaults.merge(env_vars)
53
+
54
+ # process options to construct beaker command string
55
+ nodesetfile = options[:nodesetfile] || File.join('spec/acceptance/nodesets',"#{options[:nodeset]}.yml")
56
+ fresh_nodes = options[:provision] == 'no' ? '--no-provision' : nil
57
+ keyfile = options[:keyfile] ? ['--keyfile', options[:keyfile]] : nil
58
+ debug = options[:debug] ? ['--log-level', 'debug'] : nil
59
+ color = options[:color] == 'no' ? ['--no-color'] : nil
60
+
61
+ # Configure all nodes in nodeset
62
+ c.setup([fresh_nodes, '--hosts', nodesetfile, keyfile, debug, color].flatten.compact)
63
+ #c.provision
64
+ #c.validate
65
+ #c.configure
66
+ end
67
+
68
+ # Set the number of lines it will print
69
+ options[:trace_limit] = 1000
70
+
71
+ OPTIONS = options
@@ -0,0 +1,241 @@
1
+ # rubocop:disable Style/RescueStandardError
2
+ # ^^ I canlt be bothered fixing this because all of this code is deprecated
3
+
4
+ class PuppetlabsOnceover
5
+ class Beaker
6
+ # WARNING: All of this functionality is deprecated. It will be left around
7
+ # until there is something to replace it, but don't rely on it
8
+ def self.facts_to_vagrant_box(facts)
9
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
10
+ # Gets the most similar vagrant box to the facts set provided, will accept a single fact
11
+ # se or an array
12
+
13
+ if facts.is_a?(Array)
14
+ returnval = facts.map do |fact|
15
+ self.facts_to_vagrant_box(fact)
16
+ end
17
+ return returnval
18
+ end
19
+
20
+ begin
21
+ if facts['os']['distro']['id'] == 'Ubuntu'
22
+ os = 'ubuntu'
23
+ version = facts['os']['distro']['release']['major']
24
+ end
25
+ rescue
26
+ # Do nothing, this is the easiest way to handle the hash bing in different formats
27
+ end
28
+
29
+ begin
30
+ if facts['os']['distro']['id'] == 'Debian'
31
+ os = 'Debian'
32
+ version = facts['os']['distro']['release']['full']
33
+ end
34
+ rescue
35
+ # Do nothing
36
+ end
37
+
38
+ begin
39
+ if facts['os']['family'] == "RedHat"
40
+ os = 'centos'
41
+ version = "#{facts['os']['release']['major']}.#{facts['os']['release']['minor']}"
42
+ end
43
+ rescue
44
+ # Do nothing
45
+ end
46
+
47
+ return "UNKNOWN" unless os.is_a?(String)
48
+
49
+ if facts['os']['architecture'] =~ /64/
50
+ arch = '64'
51
+ else
52
+ arch = '32'
53
+ end
54
+
55
+ "puppetlabs/#{os}-#{version}-#{arch}-puppet"
56
+ end
57
+
58
+ # This will take a fact set and return the beaker platform of that machine
59
+ # This is necissary as beaker needs the platform set up correctly to know which
60
+ # commands to run when we do stuff. Personally I would prefer beaker to detect the
61
+ # platform as it would not be that hard, especially once puppet is installed, oh well.
62
+ def self.facts_to_platform(facts)
63
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
64
+
65
+ if facts.is_a?(Array)
66
+ returnval = facts.map do |fact|
67
+ self.facts_to_platform(fact)
68
+ end
69
+ return returnval
70
+ end
71
+
72
+ begin
73
+ if facts['os']['family'] == 'RedHat'
74
+ platform = 'el'
75
+ version = facts['os']['release']['major']
76
+ end
77
+ rescue
78
+ # Do nothing, this is the easiest way to handle the hash being in different formats
79
+ end
80
+
81
+ begin
82
+ if facts['os']['distro']['id'] == 'Ubuntu'
83
+ platform = 'ubuntu'
84
+ version = facts['os']['distro']['release']['major']
85
+ end
86
+ rescue
87
+ # Do nothing, this is the easiest way to handle the hash being in different formats
88
+ end
89
+
90
+ begin
91
+ if facts['os']['distro']['id'] == 'Debian'
92
+ platform = 'debian'
93
+ version = facts['os']['distro']['release']['full']
94
+ end
95
+ rescue
96
+ # Do nothing
97
+ end
98
+
99
+ if facts['os']['architecture'] =~ /64/
100
+ arch = '64'
101
+ else
102
+ arch = '32'
103
+ end
104
+
105
+ "#{platform}-#{version}-#{arch}"
106
+ end
107
+
108
+ # This little method will deploy a Controlrepo object to a host, just using r10k deploy
109
+ def self.deploy_controlrepo_on(host, repo = PuppetlabsOnceover::Controlrepo.new())
110
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
111
+
112
+ require 'beaker-rspec'
113
+ require 'puppetlabs-onceover/controlrepo'
114
+
115
+ if host.is_a?(Array)
116
+ hosts.each do |single_host|
117
+ deploy_controlrepo_on(single_host)
118
+ end
119
+ end
120
+
121
+ # Use a beaker helper to do the install (*nix only)
122
+ install_r10k_on(host)
123
+
124
+ # Use beaker to install git
125
+ host.install_package('git')
126
+
127
+ # copy the file over to the host (Maybe I should be changing the directory here??)
128
+ scp_to(host, repo.r10k_config_file, '/tmp/r10k.yaml')
129
+
130
+ # Do an r10k deploy
131
+ r10k_deploy(host, {
132
+ :puppetfile => true,
133
+ :configfile => '/tmp/r10k.yaml',
134
+ })
135
+ end
136
+
137
+ # This actually provisions a node and checks that puppet will be able to run and
138
+ # be idempotent. It hacks the beaker NetworkManager object to do this. The reason
139
+ # is that beaker is designed to run in the following order:
140
+ # 1. Spin up nodes
141
+ # 2. Run all tests
142
+ # 3. Kill all nodes
143
+ #
144
+ # This is not helpful for us. We want to be able to test all of our classes on
145
+ # all of our nodes, this could be a lot of vms and having them all running at once
146
+ # would be a real kick in the dick for whatever system was running it.
147
+ def self.provision_and_test(host,puppet_class,opts = {}, repo = PuppetlabsOnceover::Controlrepo.new)
148
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
149
+
150
+ opts = {:runs_before_idempotency => 1}.merge(opts)
151
+ opts = {:check_idempotency => true}.merge(opts)
152
+ opts = {:deploy_controlrepo => true}.merge(opts)
153
+
154
+ raise "Hosts must be a single host object, not an array" if host.is_a?(Array)
155
+ raise "Class must be a single Class [String], not an array" unless puppet_class.is_a?(String)
156
+
157
+ # Create our own NWM object that we are going to interact with
158
+ # Note here that 'options', 'logger' and are exposed within the rspec tests
159
+ # if this is run outside of that context it will fail
160
+ network_manager = ::Beaker::NetworkManager.new(options,logger)
161
+
162
+ # Hack the network manager to smash our host in there without provisioning
163
+ network_manager.instance_variable_set(:@hosts,[host])
164
+
165
+ # Now that we have a working network manager object, we can provision, but only if
166
+ # we need to, ahhh smart...
167
+ unless host.up?
168
+ network_manager.provision
169
+ network_manager.proxy_package_manager
170
+ network_manager.validate
171
+ network_manager.configure
172
+ end
173
+
174
+ # Actually run the tests
175
+ manifest = "include #{puppet_class}"
176
+
177
+ opts[:runs_before_idempotency].times do
178
+ apply_manifest_on(host, manifest, {:catch_failures => true})
179
+ end
180
+
181
+ if opts[:check_idempotency]
182
+ apply_manifest_on(host, manifest, {:catch_changes => true})
183
+ end
184
+
185
+ network_manager.cleanup
186
+ end
187
+
188
+ def self.match_indentation(test,logger)
189
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
190
+
191
+ logger.line_prefix = ' ' * (test.metadata[:scoped_id].split(':').count - 1)
192
+ end
193
+
194
+ def self.host_create(name, nodes)
195
+ warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
196
+
197
+ require 'beaker/network_manager'
198
+
199
+ current_opts = {}
200
+ nodes.each do |opt,val|
201
+ if opt == :HOSTS
202
+ val.each do |k,v|
203
+ if k == name
204
+ current_opts[:HOSTS] = {k => v}
205
+ end
206
+ end
207
+ else
208
+ current_opts[opt] = val
209
+ end
210
+ end
211
+
212
+ # I copied this code off the internet, basically it allows us
213
+ # to refer to each key as either a string or an object
214
+ current_opts.default_proc = proc do |h, k|
215
+ case k
216
+ when String then sym = k.to_sym; h[sym] if h.key?(sym)
217
+ when Symbol then str = k.to_s; h[str] if h.key?(str)
218
+ end
219
+ end
220
+
221
+ @nwm = ::Beaker::NetworkManager.new(current_opts,logger)
222
+ @nwm.provision
223
+ @nwm.proxy_package_manager
224
+ @nwm.validate
225
+ @nwm.configure
226
+
227
+ @nwm.instance_variable_get(:@hosts).each do |host|
228
+ host.instance_variable_set(:@nwm,@nwm)
229
+ host.define_singleton_method(:down!) do
230
+ @nwm.cleanup
231
+ end
232
+ end
233
+
234
+ raise "The networkmanager created too many machines! Only expecting one" if hosts.count > 1
235
+
236
+ @nwm.instance_variable_get(:@hosts)[0]
237
+ end
238
+ end
239
+ end
240
+
241
+ # rubocop:enable Style/RescueStandardError
@@ -0,0 +1,56 @@
1
+ class PuppetlabsOnceover
2
+ class Class
3
+ @@all = []
4
+
5
+ attr_accessor :name
6
+
7
+ def initialize(name)
8
+ # if the class we are trying to create is a regex, create class objects
9
+ # for everything that matches.
10
+ if PuppetlabsOnceover::Class.name_is_regexp?(name)
11
+ expression = PuppetlabsOnceover::Class.string_to_regexp(name)
12
+ matched_classes = PuppetlabsOnceover::Controlrepo.classes.keep_if { |c| c =~ expression }
13
+ matched_classes.each do |c|
14
+ PuppetlabsOnceover::Class.new(c)
15
+ end
16
+ else
17
+ @name = name
18
+ @@all << self
19
+ end
20
+ end
21
+
22
+ # This is what is executed to see if something exists as a class. The same
23
+ # thing is executed for groups etc. when building up test matricies.
24
+ def self.find(class_name)
25
+ if PuppetlabsOnceover::Class.name_is_regexp?(class_name)
26
+ return @@all.select do |cls|
27
+ cls.name =~ PuppetlabsOnceover::Class.string_to_regexp(class_name)
28
+ end
29
+ else
30
+ @@all.each do |cls|
31
+ if cls.name == class_name
32
+ return cls
33
+ end
34
+ end
35
+ end
36
+ logger.warn "Class #{class_name} not found"
37
+ nil
38
+ end
39
+
40
+ def self.all
41
+ @@all
42
+ end
43
+
44
+ def self.string_to_regexp(string)
45
+ if PuppetlabsOnceover::Class.name_is_regexp?(string)
46
+ Regexp.new(string[1..-2])
47
+ else
48
+ raise "#{string} does not start and end with / and cannot be converted to regexp"
49
+ end
50
+ end
51
+
52
+ def self.name_is_regexp?(name)
53
+ name.start_with?('/') and name.end_with?('/')
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,34 @@
1
+ require 'cri'
2
+ require 'puppetlabs-onceover/controlrepo'
3
+ require 'puppetlabs-onceover/cli'
4
+ require 'puppetlabs-onceover/runner'
5
+ require 'puppetlabs-onceover/testconfig'
6
+ require 'puppetlabs-onceover/logger'
7
+
8
+ class PuppetlabsOnceover
9
+ class CLI
10
+ class Init
11
+ def self.command
12
+ @command ||= Cri::Command.define do
13
+ name 'init'
14
+ usage 'init'
15
+ summary 'Sets up a controlrepo for testing from scratch'
16
+ description <<-DESCRIPTION
17
+ This will generate all of the config files required for the onceover
18
+ tool to work.
19
+ DESCRIPTION
20
+
21
+ run do |opts, args, cmd|
22
+ PuppetlabsOnceover::Controlrepo.init(PuppetlabsOnceover::Controlrepo.new(opts))
23
+ # Would it make sense for #init to be a class instance method of Controlrepo ? Then you could:
24
+ # cp = PuppetlabsOnceover::Controlrepo.new(opts)
25
+ # cp.init
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ # Register itself
34
+ PuppetlabsOnceover::CLI.command.add_command(PuppetlabsOnceover::CLI::Init.command)
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+
3
+ # Get all of the gems that start with onceover-
4
+ plugins = Gem::Specification.group_by{ |g| g.name }.keep_if do |name, details|
5
+ name =~ /^onceover-.*$/
6
+ end.keys
7
+
8
+ plugins.each do |plugin|
9
+ require plugin.gsub('-', '/')
10
+ end
@@ -0,0 +1,85 @@
1
+ require 'cri'
2
+ require 'puppetlabs-onceover/controlrepo'
3
+ require 'puppetlabs-onceover/cli'
4
+ require 'puppetlabs-onceover/runner'
5
+ require 'puppetlabs-onceover/testconfig'
6
+ require 'puppetlabs-onceover/logger'
7
+ require 'puppetlabs-onceover/deploy'
8
+
9
+ class PuppetlabsOnceover
10
+ class CLI
11
+ class Run
12
+ def self.command
13
+ @command ||= Cri::Command.define do
14
+ name 'run'
15
+ usage 'run [spec|acceptance]'
16
+ summary 'Runs either the spec or acceptance tests'
17
+ description <<-DESCRIPTION
18
+ This will run the full set of spec or acceptance tests.
19
+ This includes deploying using r10k and running all custom tests.
20
+ DESCRIPTION
21
+
22
+ optional :t, :tags, 'A list of tags. Only tests with these tags will be run'
23
+ optional :c, :classes, 'A list of classes. Only tests with these classes will be run'
24
+ optional :n, :nodes, 'A list of nodes. Only tests with these nodes will be run'
25
+ optional :s, :skip_r10k, 'Skip the r10k step'
26
+ optional :f, :force, 'Passes --force to r10k, overwriting modules'
27
+ optional :sv, :strict_variables, 'Run with strict_variables set to yes'
28
+
29
+ run do |opts, args, cmd|
30
+ puts cmd.help(:verbose => opts[:verbose])
31
+ exit 0
32
+ end
33
+ end
34
+ end
35
+
36
+ class Spec
37
+ def self.command
38
+ @command ||= Cri::Command.define do
39
+ name 'spec'
40
+ usage 'spec'
41
+ summary 'Runs spec tests'
42
+
43
+ optional :p, :parallel, 'Runs spec tests in parallel. This increases speed at the cost of poorly formatted logs and irrelevant junit output.'
44
+ optional nil, :format, 'Which RSpec formatter to use, valid options are: documentation, progress, FailureCollector, PuppetlabsOnceoverFormatter. You also specify this multiple times', multiple: true, default: :defaults
45
+ optional nil, :no_workarounds, 'Disables workarounds that have been added for convenience to get around common RSPec issues such as https://github.com/rodjek/rspec-puppet/issues/665'
46
+ optional :ff, :fail_fast, 'Abort the run after the first failure'
47
+ optional nil, :auto_vendored, 'Attempt to resolve vendored puppet modules. Ex: puppetlabs/cron_core', default: false
48
+
49
+ run do |opts, args, cmd|
50
+ repo = PuppetlabsOnceover::Controlrepo.new(opts)
51
+ PuppetlabsOnceover::Deploy.new.deploy_local(repo, opts)
52
+ runner = PuppetlabsOnceover::Runner.new(repo,PuppetlabsOnceover::TestConfig.new(repo.onceover_yaml, opts), :spec)
53
+ runner.prepare!
54
+ runner.run_spec!
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ class Acceptance
61
+ def self.command
62
+ @command ||= Cri::Command.define do
63
+ name 'acceptance'
64
+ usage 'acceptance'
65
+ summary 'Runs acceptance tests'
66
+
67
+ run do |opts, args, cmd|
68
+ warn "[DEPRECATION] Acceptance testing is deprecated due to the removal of Beaker dependencies"
69
+ warn "[DEPRECATION] Appeptance testing will be replaced by a more pluggable framework in the future, if you have ideas as to how this should be done please submit a ticket."
70
+ repo = PuppetlabsOnceover::Controlrepo.new(opts)
71
+ runner = PuppetlabsOnceover::Runner.new(repo,PuppetlabsOnceover::TestConfig.new(repo.onceover_yaml,opts), :acceptance)
72
+ runner.prepare!
73
+ runner.run_acceptance!
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ # Register itself
83
+ PuppetlabsOnceover::CLI.command.add_command(PuppetlabsOnceover::CLI::Run.command)
84
+ PuppetlabsOnceover::CLI::Run.command.add_command(PuppetlabsOnceover::CLI::Run::Spec.command)
85
+ PuppetlabsOnceover::CLI::Run.command.add_command(PuppetlabsOnceover::CLI::Run::Acceptance.command)