puppet 6.0.10-universal-darwin → 6.1.0-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (748) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +31 -27
  4. data/Guardfile.example +76 -0
  5. data/LICENSE +189 -4
  6. data/MAINTAINERS +47 -0
  7. data/README.md +3 -3
  8. data/lib/hiera/scope.rb +0 -7
  9. data/lib/puppet.rb +6 -5
  10. data/lib/puppet/application.rb +3 -3
  11. data/lib/puppet/application/cert.rb +2 -2
  12. data/lib/puppet/application/device.rb +83 -109
  13. data/lib/puppet/application/filebucket.rb +1 -10
  14. data/lib/puppet/application/ssl.rb +0 -2
  15. data/lib/puppet/configurer.rb +9 -10
  16. data/lib/puppet/confine/false.rb +1 -7
  17. data/lib/puppet/confine/true.rb +1 -7
  18. data/lib/puppet/defaults.rb +39 -51
  19. data/lib/puppet/forge.rb +1 -4
  20. data/lib/puppet/functions/abs.rb +1 -1
  21. data/lib/puppet/functions/call.rb +1 -2
  22. data/lib/puppet/functions/new.rb +1 -1
  23. data/lib/puppet/indirector/request.rb +15 -26
  24. data/lib/puppet/network/http/connection.rb +12 -32
  25. data/lib/puppet/network/http/factory.rb +0 -5
  26. data/lib/puppet/pal/catalog_compiler.rb +96 -0
  27. data/lib/puppet/pal/compiler.rb +221 -0
  28. data/lib/puppet/pal/function_signature.rb +52 -0
  29. data/lib/puppet/pal/json_catalog_encoder.rb +67 -0
  30. data/lib/puppet/pal/pal_api.rb +15 -0
  31. data/lib/puppet/pal/pal_impl.rb +523 -0
  32. data/lib/puppet/pal/plan_signature.rb +71 -0
  33. data/lib/puppet/pal/script_compiler.rb +71 -0
  34. data/lib/puppet/pal/task_signature.rb +58 -0
  35. data/lib/puppet/parser/functions/generate.rb +7 -6
  36. data/lib/puppet/plugins/configuration.rb +5 -1
  37. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -1
  38. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -3
  39. data/lib/puppet/pops/issues.rb +0 -4
  40. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +4 -60
  41. data/lib/puppet/pops/model/factory.rb +4 -38
  42. data/lib/puppet/pops/model/pn_transformer.rb +0 -5
  43. data/lib/puppet/pops/parser/egrammar.ra +2 -2
  44. data/lib/puppet/pops/parser/heredoc_support.rb +7 -17
  45. data/lib/puppet/pops/parser/lexer2.rb +1 -6
  46. data/lib/puppet/pops/parser/locator.rb +86 -106
  47. data/lib/puppet/pops/parser/parser_support.rb +2 -11
  48. data/lib/puppet/pops/types/string_converter.rb +7 -2
  49. data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
  50. data/lib/puppet/pops/types/types.rb +3 -5
  51. data/lib/puppet/pops/validation/checker4_0.rb +13 -0
  52. data/lib/puppet/provider.rb +2 -1
  53. data/lib/puppet/provider/exec.rb +6 -1
  54. data/lib/puppet/provider/file/windows.rb +1 -49
  55. data/lib/puppet/provider/group/windows_adsi.rb +1 -4
  56. data/lib/puppet/provider/package.rb +0 -2
  57. data/lib/puppet/provider/package/dpkg.rb +2 -15
  58. data/lib/puppet/provider/package/gem.rb +42 -102
  59. data/lib/puppet/provider/package/pip.rb +111 -135
  60. data/lib/puppet/provider/package/pip3.rb +1 -1
  61. data/lib/puppet/provider/package/pkgng.rb +37 -21
  62. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  63. data/lib/puppet/provider/package/rpm.rb +16 -27
  64. data/lib/puppet/provider/package/windows.rb +1 -5
  65. data/lib/puppet/provider/package/yum.rb +1 -2
  66. data/lib/puppet/provider/service/systemd.rb +17 -0
  67. data/lib/puppet/provider/service/upstart.rb +5 -17
  68. data/lib/puppet/provider/service/windows.rb +8 -3
  69. data/lib/puppet/provider/user/directoryservice.rb +4 -16
  70. data/lib/puppet/provider/user/useradd.rb +13 -16
  71. data/lib/puppet/resource.rb +3 -1
  72. data/lib/puppet/rest/client.rb +83 -0
  73. data/lib/puppet/rest/route.rb +1 -1
  74. data/lib/puppet/settings.rb +5 -10
  75. data/lib/puppet/settings/server_list_setting.rb +0 -9
  76. data/lib/puppet/ssl/host.rb +11 -0
  77. data/lib/puppet/ssl/validator/default_validator.rb +0 -31
  78. data/lib/puppet/syntax_checkers/epp.rb +34 -0
  79. data/lib/puppet/syntax_checkers/pp.rb +34 -0
  80. data/lib/puppet/transaction.rb +7 -12
  81. data/lib/puppet/transaction/event_manager.rb +5 -1
  82. data/lib/puppet/transaction/resource_harness.rb +0 -1
  83. data/lib/puppet/type.rb +6 -0
  84. data/lib/puppet/type/exec.rb +5 -27
  85. data/lib/puppet/type/file/mode.rb +1 -6
  86. data/lib/puppet/type/file/source.rb +1 -0
  87. data/lib/puppet/type/filebucket.rb +8 -12
  88. data/lib/puppet/type/package.rb +11 -44
  89. data/lib/puppet/type/schedule.rb +0 -4
  90. data/lib/puppet/type/service.rb +12 -0
  91. data/lib/puppet/type/user.rb +1 -1
  92. data/lib/puppet/util/command_line.rb +1 -5
  93. data/lib/puppet/util/connection.rb +6 -15
  94. data/lib/puppet/util/http_proxy.rb +2 -3
  95. data/lib/puppet/util/log.rb +2 -7
  96. data/lib/puppet/util/pidlock.rb +1 -15
  97. data/lib/puppet/util/windows/process.rb +5 -73
  98. data/lib/puppet/util/windows/registry.rb +1 -7
  99. data/lib/puppet/util/windows/security.rb +8 -29
  100. data/lib/puppet/util/windows/service.rb +33 -27
  101. data/lib/puppet/util/windows/user.rb +4 -14
  102. data/lib/puppet/version.rb +1 -1
  103. data/lib/puppet_pal.rb +5 -1132
  104. data/locales/ja/puppet.po +297 -363
  105. data/locales/puppet.pot +445 -517
  106. data/man/man5/puppet.conf.5 +12 -20
  107. data/man/man8/puppet-agent.8 +1 -1
  108. data/man/man8/puppet-apply.8 +1 -1
  109. data/man/man8/puppet-catalog.8 +1 -1
  110. data/man/man8/puppet-config.8 +1 -1
  111. data/man/man8/puppet-describe.8 +1 -1
  112. data/man/man8/puppet-device.8 +1 -1
  113. data/man/man8/puppet-doc.8 +1 -1
  114. data/man/man8/puppet-epp.8 +1 -1
  115. data/man/man8/puppet-facts.8 +1 -1
  116. data/man/man8/puppet-filebucket.8 +2 -6
  117. data/man/man8/puppet-generate.8 +1 -1
  118. data/man/man8/puppet-help.8 +1 -1
  119. data/man/man8/puppet-key.8 +1 -1
  120. data/man/man8/puppet-lookup.8 +1 -1
  121. data/man/man8/puppet-man.8 +1 -1
  122. data/man/man8/puppet-module.8 +1 -1
  123. data/man/man8/puppet-node.8 +1 -1
  124. data/man/man8/puppet-parser.8 +1 -1
  125. data/man/man8/puppet-plugin.8 +1 -1
  126. data/man/man8/puppet-report.8 +1 -1
  127. data/man/man8/puppet-resource.8 +1 -1
  128. data/man/man8/puppet-script.8 +1 -1
  129. data/man/man8/puppet-ssl.8 +1 -1
  130. data/man/man8/puppet-status.8 +1 -1
  131. data/man/man8/puppet.8 +2 -2
  132. data/spec/fixtures/unit/provider/package/pkgng/pkg.query +7 -1
  133. data/spec/fixtures/unit/provider/package/pkgng/pkg.query.zsh +1 -0
  134. data/spec/integration/agent/logging_spec.rb +7 -5
  135. data/spec/integration/application/apply_spec.rb +16 -18
  136. data/spec/integration/application/doc_spec.rb +2 -1
  137. data/spec/integration/application/lookup_spec.rb +5 -5
  138. data/spec/integration/configurer_spec.rb +6 -5
  139. data/spec/integration/defaults_spec.rb +6 -5
  140. data/spec/integration/directory_environments_spec.rb +1 -1
  141. data/spec/integration/faces/config_spec.rb +4 -3
  142. data/spec/integration/faces/documentation_spec.rb +1 -0
  143. data/spec/integration/faces/plugin_spec.rb +1 -1
  144. data/spec/integration/file_bucket/file_spec.rb +4 -2
  145. data/spec/integration/file_serving/content_spec.rb +1 -0
  146. data/spec/integration/file_serving/fileset_spec.rb +1 -0
  147. data/spec/integration/file_serving/metadata_spec.rb +1 -0
  148. data/spec/integration/file_serving/terminus_helper_spec.rb +1 -0
  149. data/spec/integration/indirector/catalog/compiler_spec.rb +11 -10
  150. data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
  151. data/spec/integration/indirector/facts/facter_spec.rb +5 -4
  152. data/spec/integration/indirector/file_content/file_server_spec.rb +8 -7
  153. data/spec/integration/indirector/file_metadata/file_server_spec.rb +8 -7
  154. data/spec/integration/network/authconfig_spec.rb +24 -23
  155. data/spec/integration/network/formats_spec.rb +1 -0
  156. data/spec/integration/node/environment_spec.rb +1 -0
  157. data/spec/integration/node/facts_spec.rb +10 -9
  158. data/spec/integration/node_spec.rb +7 -6
  159. data/spec/integration/parser/catalog_spec.rb +5 -1
  160. data/spec/integration/parser/collection_spec.rb +2 -1
  161. data/spec/integration/parser/compiler_spec.rb +6 -6
  162. data/spec/integration/parser/scope_spec.rb +1 -1
  163. data/spec/integration/parser/undef_param_spec.rb +1 -1
  164. data/spec/integration/provider/service/init_spec.rb +5 -4
  165. data/spec/integration/provider/service/systemd_spec.rb +2 -0
  166. data/spec/integration/provider/service/windows_spec.rb +2 -1
  167. data/spec/integration/reference/providers_spec.rb +2 -1
  168. data/spec/integration/reports_spec.rb +2 -1
  169. data/spec/integration/resource/catalog_spec.rb +17 -14
  170. data/spec/integration/resource/type_collection_spec.rb +5 -4
  171. data/spec/integration/ssl/certificate_request_spec.rb +1 -0
  172. data/spec/integration/ssl/host_spec.rb +2 -1
  173. data/spec/integration/ssl/key_spec.rb +1 -0
  174. data/spec/integration/test/test_helper_spec.rb +1 -0
  175. data/spec/integration/transaction/report_spec.rb +11 -6
  176. data/spec/integration/transaction_spec.rb +19 -18
  177. data/spec/integration/type/exec_spec.rb +1 -0
  178. data/spec/integration/type/file_spec.rb +33 -13
  179. data/spec/integration/type/package_spec.rb +24 -20
  180. data/spec/integration/type/tidy_spec.rb +2 -1
  181. data/spec/integration/type_spec.rb +1 -0
  182. data/spec/integration/util/autoload_spec.rb +2 -1
  183. data/spec/integration/util/rdoc/parser_spec.rb +1 -0
  184. data/spec/integration/util/settings_spec.rb +1 -0
  185. data/spec/integration/util/windows/adsi_spec.rb +5 -3
  186. data/spec/integration/util/windows/principal_spec.rb +1 -0
  187. data/spec/integration/util/windows/process_spec.rb +6 -4
  188. data/spec/integration/util/windows/registry_spec.rb +51 -93
  189. data/spec/integration/util/windows/security_spec.rb +4 -2
  190. data/spec/integration/util/windows/user_spec.rb +20 -37
  191. data/spec/integration/util_spec.rb +7 -4
  192. data/spec/lib/puppet_spec/compiler.rb +1 -1
  193. data/spec/lib/puppet_spec/files.rb +1 -0
  194. data/spec/lib/puppet_spec/module_tool/shared_functions.rb +1 -1
  195. data/spec/lib/puppet_spec/scope.rb +2 -1
  196. data/spec/shared_behaviours/all_parsedfile_providers.rb +1 -1
  197. data/spec/shared_behaviours/file_server_terminus.rb +9 -8
  198. data/spec/shared_behaviours/file_serving.rb +8 -6
  199. data/spec/shared_behaviours/file_serving_model.rb +5 -3
  200. data/spec/shared_behaviours/hiera_indirections.rb +4 -3
  201. data/spec/shared_behaviours/iterative_functions.rb +1 -0
  202. data/spec/shared_behaviours/memory_terminus.rb +2 -2
  203. data/spec/shared_examples/rhel_package_provider.rb +70 -112
  204. data/spec/spec_helper.rb +2 -11
  205. data/spec/unit/agent/disabler_spec.rb +5 -4
  206. data/spec/unit/agent/locker_spec.rb +13 -12
  207. data/spec/unit/agent_spec.rb +85 -80
  208. data/spec/unit/application/agent_spec.rb +93 -88
  209. data/spec/unit/application/apply_spec.rb +83 -82
  210. data/spec/unit/application/config_spec.rb +1 -0
  211. data/spec/unit/application/describe_spec.rb +7 -6
  212. data/spec/unit/application/device_spec.rb +419 -395
  213. data/spec/unit/application/doc_spec.rb +46 -44
  214. data/spec/unit/application/face_base_spec.rb +62 -61
  215. data/spec/unit/application/facts_spec.rb +4 -3
  216. data/spec/unit/application/filebucket_spec.rb +74 -66
  217. data/spec/unit/application/indirection_base_spec.rb +6 -8
  218. data/spec/unit/application/lookup_spec.rb +26 -26
  219. data/spec/unit/application/resource_spec.rb +48 -42
  220. data/spec/unit/application/ssl_spec.rb +3 -8
  221. data/spec/unit/application_spec.rb +98 -86
  222. data/spec/unit/capability_spec.rb +6 -6
  223. data/spec/unit/certificate_factory_spec.rb +5 -3
  224. data/spec/unit/configurer/downloader_spec.rb +21 -20
  225. data/spec/unit/configurer/fact_handler_spec.rb +3 -2
  226. data/spec/unit/configurer/plugin_handler_spec.rb +8 -41
  227. data/spec/unit/configurer_spec.rb +198 -194
  228. data/spec/unit/confine/exists_spec.rb +15 -17
  229. data/spec/unit/confine/false_spec.rb +6 -32
  230. data/spec/unit/confine/feature_spec.rb +5 -7
  231. data/spec/unit/confine/true_spec.rb +6 -32
  232. data/spec/unit/confine/variable_spec.rb +15 -14
  233. data/spec/unit/confine_collection_spec.rb +29 -28
  234. data/spec/unit/confine_spec.rb +14 -13
  235. data/spec/unit/confiner_spec.rb +11 -10
  236. data/spec/unit/context/trusted_information_spec.rb +1 -1
  237. data/spec/unit/daemon_spec.rb +36 -35
  238. data/spec/unit/data_providers/function_data_provider_spec.rb +1 -0
  239. data/spec/unit/data_providers/hiera_data_provider_spec.rb +1 -0
  240. data/spec/unit/datatypes_spec.rb +4 -3
  241. data/spec/unit/defaults_spec.rb +27 -18
  242. data/spec/unit/environments_spec.rb +7 -7
  243. data/spec/unit/etc_spec.rb +32 -30
  244. data/spec/unit/external/pson_spec.rb +1 -0
  245. data/spec/unit/face/catalog_spec.rb +1 -0
  246. data/spec/unit/face/config_spec.rb +35 -31
  247. data/spec/unit/face/epp_face_spec.rb +4 -3
  248. data/spec/unit/face/facts_spec.rb +6 -5
  249. data/spec/unit/face/generate_spec.rb +5 -4
  250. data/spec/unit/face/help_spec.rb +8 -7
  251. data/spec/unit/face/key_spec.rb +1 -0
  252. data/spec/unit/face/man_spec.rb +2 -1
  253. data/spec/unit/face/module/install_spec.rb +5 -3
  254. data/spec/unit/face/module/list_spec.rb +12 -2
  255. data/spec/unit/face/module/search_spec.rb +9 -11
  256. data/spec/unit/face/module/uninstall_spec.rb +8 -4
  257. data/spec/unit/face/node_spec.rb +24 -23
  258. data/spec/unit/face/parser_spec.rb +18 -3
  259. data/spec/unit/face/plugin_spec.rb +9 -36
  260. data/spec/unit/face/status_spec.rb +1 -0
  261. data/spec/unit/file_bucket/dipper_spec.rb +20 -24
  262. data/spec/unit/file_bucket/file_spec.rb +2 -0
  263. data/spec/unit/file_serving/base_spec.rb +15 -14
  264. data/spec/unit/file_serving/configuration/parser_spec.rb +28 -27
  265. data/spec/unit/file_serving/configuration_spec.rb +66 -63
  266. data/spec/unit/file_serving/content_spec.rb +11 -10
  267. data/spec/unit/file_serving/fileset_spec.rb +58 -63
  268. data/spec/unit/file_serving/http_metadata_spec.rb +7 -8
  269. data/spec/unit/file_serving/metadata_spec.rb +36 -36
  270. data/spec/unit/file_serving/mount/file_spec.rb +32 -31
  271. data/spec/unit/file_serving/mount/locales_spec.rb +24 -23
  272. data/spec/unit/file_serving/mount/modules_spec.rb +15 -14
  273. data/spec/unit/file_serving/mount/pluginfacts_spec.rb +24 -23
  274. data/spec/unit/file_serving/mount/plugins_spec.rb +24 -23
  275. data/spec/unit/file_serving/mount/tasks_spec.rb +15 -14
  276. data/spec/unit/file_serving/mount_spec.rb +1 -0
  277. data/spec/unit/file_serving/terminus_helper_spec.rb +42 -37
  278. data/spec/unit/file_serving/terminus_selector_spec.rb +13 -12
  279. data/spec/unit/file_system/uniquefile_spec.rb +4 -4
  280. data/spec/unit/file_system_spec.rb +2 -2
  281. data/spec/unit/forge/errors_spec.rb +1 -1
  282. data/spec/unit/forge/forge_spec.rb +16 -17
  283. data/spec/unit/forge/module_release_spec.rb +18 -18
  284. data/spec/unit/forge/repository_spec.rb +30 -29
  285. data/spec/unit/forge_spec.rb +11 -15
  286. data/spec/unit/functions/binary_file_spec.rb +3 -3
  287. data/spec/unit/functions/contain_spec.rb +2 -0
  288. data/spec/unit/functions/defined_spec.rb +1 -0
  289. data/spec/unit/functions/epp_spec.rb +2 -2
  290. data/spec/unit/functions/find_file_spec.rb +7 -7
  291. data/spec/unit/functions/include_spec.rb +4 -0
  292. data/spec/unit/functions/lookup_fixture_spec.rb +1 -0
  293. data/spec/unit/functions/lookup_spec.rb +2 -1
  294. data/spec/unit/functions/module_directory_spec.rb +12 -12
  295. data/spec/unit/functions/new_spec.rb +0 -15
  296. data/spec/unit/functions/require_spec.rb +3 -0
  297. data/spec/unit/functions/shared.rb +8 -5
  298. data/spec/unit/functions/versioncmp_spec.rb +2 -1
  299. data/spec/unit/functions4_spec.rb +10 -9
  300. data/spec/unit/gettext/config_spec.rb +4 -4
  301. data/spec/unit/gettext/module_loading_spec.rb +7 -7
  302. data/spec/unit/graph/rb_tree_map_spec.rb +2 -0
  303. data/spec/unit/graph/relationship_graph_spec.rb +2 -1
  304. data/spec/unit/graph/simple_graph_spec.rb +10 -9
  305. data/spec/unit/hiera/scope_spec.rb +0 -7
  306. data/spec/unit/hiera_puppet_spec.rb +20 -20
  307. data/spec/unit/indirector/catalog/compiler_spec.rb +149 -147
  308. data/spec/unit/indirector/catalog/json_spec.rb +2 -1
  309. data/spec/unit/indirector/catalog/msgpack_spec.rb +1 -0
  310. data/spec/unit/indirector/catalog/rest_spec.rb +1 -0
  311. data/spec/unit/indirector/catalog/store_configs_spec.rb +1 -0
  312. data/spec/unit/indirector/catalog/yaml_spec.rb +1 -0
  313. data/spec/unit/indirector/certificate/file_spec.rb +1 -0
  314. data/spec/unit/indirector/certificate/rest_spec.rb +10 -8
  315. data/spec/unit/indirector/certificate_request/file_spec.rb +1 -0
  316. data/spec/unit/indirector/certificate_request/rest_spec.rb +1 -0
  317. data/spec/unit/indirector/direct_file_server_spec.rb +18 -17
  318. data/spec/unit/indirector/envelope_spec.rb +2 -1
  319. data/spec/unit/indirector/exec_spec.rb +5 -4
  320. data/spec/unit/indirector/face_spec.rb +9 -9
  321. data/spec/unit/indirector/facts/facter_spec.rb +43 -37
  322. data/spec/unit/indirector/facts/network_device_spec.rb +9 -8
  323. data/spec/unit/indirector/facts/rest_spec.rb +8 -7
  324. data/spec/unit/indirector/facts/store_configs_spec.rb +1 -0
  325. data/spec/unit/indirector/facts/yaml_spec.rb +1 -0
  326. data/spec/unit/indirector/file_bucket_file/file_spec.rb +4 -3
  327. data/spec/unit/indirector/file_bucket_file/rest_spec.rb +1 -0
  328. data/spec/unit/indirector/file_bucket_file/selector_spec.rb +5 -4
  329. data/spec/unit/indirector/file_content/file_server_spec.rb +1 -0
  330. data/spec/unit/indirector/file_content/file_spec.rb +1 -0
  331. data/spec/unit/indirector/file_content/rest_spec.rb +1 -0
  332. data/spec/unit/indirector/file_content/selector_spec.rb +1 -0
  333. data/spec/unit/indirector/file_metadata/file_server_spec.rb +1 -0
  334. data/spec/unit/indirector/file_metadata/file_spec.rb +13 -12
  335. data/spec/unit/indirector/file_metadata/rest_spec.rb +1 -0
  336. data/spec/unit/indirector/file_metadata/selector_spec.rb +1 -0
  337. data/spec/unit/indirector/file_server_spec.rb +87 -87
  338. data/spec/unit/indirector/indirection_spec.rb +226 -242
  339. data/spec/unit/indirector/json_spec.rb +9 -7
  340. data/spec/unit/indirector/key/file_spec.rb +22 -21
  341. data/spec/unit/indirector/memory_spec.rb +7 -6
  342. data/spec/unit/indirector/msgpack_spec.rb +9 -7
  343. data/spec/unit/indirector/node/exec_spec.rb +3 -2
  344. data/spec/unit/indirector/node/memory_spec.rb +4 -2
  345. data/spec/unit/indirector/node/msgpack_spec.rb +1 -0
  346. data/spec/unit/indirector/node/plain_spec.rb +4 -2
  347. data/spec/unit/indirector/node/rest_spec.rb +1 -0
  348. data/spec/unit/indirector/node/store_configs_spec.rb +1 -0
  349. data/spec/unit/indirector/node/yaml_spec.rb +1 -0
  350. data/spec/unit/indirector/none_spec.rb +5 -5
  351. data/spec/unit/indirector/plain_spec.rb +8 -7
  352. data/spec/unit/indirector/report/msgpack_spec.rb +1 -0
  353. data/spec/unit/indirector/report/processor_spec.rb +22 -21
  354. data/spec/unit/indirector/report/rest_spec.rb +12 -11
  355. data/spec/unit/indirector/report/yaml_spec.rb +1 -0
  356. data/spec/unit/indirector/request_spec.rb +12 -11
  357. data/spec/unit/indirector/resource/ral_spec.rb +54 -47
  358. data/spec/unit/indirector/resource/store_configs_spec.rb +1 -0
  359. data/spec/unit/indirector/rest_spec.rb +110 -113
  360. data/spec/unit/indirector/ssl_file_spec.rb +65 -64
  361. data/spec/unit/indirector/status/local_spec.rb +1 -0
  362. data/spec/unit/indirector/status/rest_spec.rb +1 -0
  363. data/spec/unit/indirector/store_configs_spec.rb +1 -0
  364. data/spec/unit/indirector/terminus_spec.rb +27 -27
  365. data/spec/unit/indirector/yaml_spec.rb +6 -5
  366. data/spec/unit/indirector_spec.rb +2 -1
  367. data/spec/unit/info_service_spec.rb +1 -1
  368. data/spec/unit/interface/action_builder_spec.rb +1 -0
  369. data/spec/unit/interface/action_manager_spec.rb +1 -0
  370. data/spec/unit/interface/action_spec.rb +3 -2
  371. data/spec/unit/interface/documentation_spec.rb +1 -0
  372. data/spec/unit/interface/face_collection_spec.rb +12 -19
  373. data/spec/unit/interface_spec.rb +3 -3
  374. data/spec/unit/man_spec.rb +4 -3
  375. data/spec/unit/module_spec.rb +51 -46
  376. data/spec/unit/module_tool/applications/installer_spec.rb +11 -10
  377. data/spec/unit/module_tool/applications/searcher_spec.rb +3 -3
  378. data/spec/unit/module_tool/applications/uninstaller_spec.rb +2 -1
  379. data/spec/unit/module_tool/applications/unpacker_spec.rb +13 -13
  380. data/spec/unit/module_tool/applications/upgrader_spec.rb +5 -5
  381. data/spec/unit/module_tool/install_directory_spec.rb +8 -8
  382. data/spec/unit/module_tool/installed_modules_spec.rb +3 -3
  383. data/spec/unit/module_tool/tar/gnu_spec.rb +6 -6
  384. data/spec/unit/module_tool/tar/mini_spec.rb +12 -12
  385. data/spec/unit/module_tool/tar_spec.rb +13 -12
  386. data/spec/unit/module_tool_spec.rb +12 -7
  387. data/spec/unit/network/auth_config_parser_spec.rb +13 -11
  388. data/spec/unit/network/authconfig_spec.rb +18 -17
  389. data/spec/unit/network/authorization_spec.rb +5 -4
  390. data/spec/unit/network/authstore_spec.rb +1 -0
  391. data/spec/unit/network/format_handler_spec.rb +1 -0
  392. data/spec/unit/network/format_spec.rb +10 -9
  393. data/spec/unit/network/format_support_spec.rb +29 -28
  394. data/spec/unit/network/formats_spec.rb +5 -4
  395. data/spec/unit/network/http/api/indirected_routes_spec.rb +29 -24
  396. data/spec/unit/network/http/api/master/v3/authorization_spec.rb +2 -2
  397. data/spec/unit/network/http/api/master/v3/environment_spec.rb +1 -1
  398. data/spec/unit/network/http/api/master/v3/environments_spec.rb +7 -6
  399. data/spec/unit/network/http/api_spec.rb +2 -0
  400. data/spec/unit/network/http/compression_spec.rb +22 -21
  401. data/spec/unit/network/http/connection_spec.rb +121 -30
  402. data/spec/unit/network/http/factory_spec.rb +6 -11
  403. data/spec/unit/network/http/handler_spec.rb +18 -9
  404. data/spec/unit/network/http/nocache_pool_spec.rb +7 -6
  405. data/spec/unit/network/http/pool_spec.rb +29 -28
  406. data/spec/unit/network/http/request_spec.rb +2 -0
  407. data/spec/unit/network/http/response_spec.rb +13 -11
  408. data/spec/unit/network/http/route_spec.rb +1 -0
  409. data/spec/unit/network/http/session_spec.rb +2 -1
  410. data/spec/unit/network/http/site_spec.rb +1 -0
  411. data/spec/unit/network/http_pool_spec.rb +9 -18
  412. data/spec/unit/network/http_spec.rb +1 -0
  413. data/spec/unit/network/resolver_spec.rb +26 -25
  414. data/spec/unit/network/rights_spec.rb +53 -52
  415. data/spec/unit/node/environment_spec.rb +15 -14
  416. data/spec/unit/node/facts_spec.rb +7 -5
  417. data/spec/unit/node_spec.rb +10 -4
  418. data/spec/unit/other/selinux_spec.rb +1 -0
  419. data/spec/unit/parameter/boolean_spec.rb +2 -1
  420. data/spec/unit/parameter/package_options_spec.rb +2 -1
  421. data/spec/unit/parameter/path_spec.rb +1 -0
  422. data/spec/unit/parameter/value_collection_spec.rb +1 -0
  423. data/spec/unit/parameter/value_spec.rb +1 -0
  424. data/spec/unit/parameter_spec.rb +9 -9
  425. data/spec/unit/parser/ast/block_expression_spec.rb +8 -6
  426. data/spec/unit/parser/ast/leaf_spec.rb +21 -20
  427. data/spec/unit/parser/compiler_spec.rb +96 -84
  428. data/spec/unit/parser/environment_compiler_spec.rb +8 -7
  429. data/spec/unit/parser/files_spec.rb +1 -0
  430. data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
  431. data/spec/unit/parser/functions/digest_spec.rb +1 -0
  432. data/spec/unit/parser/functions/fail_spec.rb +2 -1
  433. data/spec/unit/parser/functions/file_spec.rb +14 -13
  434. data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -5
  435. data/spec/unit/parser/functions/generate_spec.rb +8 -7
  436. data/spec/unit/parser/functions/inline_template_spec.rb +1 -0
  437. data/spec/unit/parser/functions/regsubst_spec.rb +1 -0
  438. data/spec/unit/parser/functions/scanf_spec.rb +1 -0
  439. data/spec/unit/parser/functions/shellquote_spec.rb +1 -0
  440. data/spec/unit/parser/functions/split_spec.rb +1 -0
  441. data/spec/unit/parser/functions/sprintf_spec.rb +1 -0
  442. data/spec/unit/parser/functions/tag_spec.rb +2 -1
  443. data/spec/unit/parser/functions/tagged_spec.rb +3 -2
  444. data/spec/unit/parser/functions/template_spec.rb +13 -13
  445. data/spec/unit/parser/functions/versioncmp_spec.rb +2 -1
  446. data/spec/unit/parser/functions_spec.rb +7 -6
  447. data/spec/unit/parser/relationship_spec.rb +1 -0
  448. data/spec/unit/parser/resource_spec.rb +42 -42
  449. data/spec/unit/parser/scope_spec.rb +35 -39
  450. data/spec/unit/parser/templatewrapper_spec.rb +12 -11
  451. data/spec/unit/parser/type_loader_spec.rb +19 -17
  452. data/spec/unit/pops/adaptable_spec.rb +1 -0
  453. data/spec/unit/pops/benchmark_spec.rb +1 -0
  454. data/spec/unit/pops/evaluator/access_ops_spec.rb +1 -0
  455. data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +1 -0
  456. data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -0
  457. data/spec/unit/pops/evaluator/collections_ops_spec.rb +1 -0
  458. data/spec/unit/pops/evaluator/comparison_ops_spec.rb +1 -0
  459. data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -0
  460. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +47 -10
  461. data/spec/unit/pops/evaluator/logical_ops_spec.rb +1 -0
  462. data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +1 -0
  463. data/spec/unit/pops/evaluator/string_interpolation_spec.rb +1 -0
  464. data/spec/unit/pops/evaluator/variables_spec.rb +1 -0
  465. data/spec/unit/pops/factory_spec.rb +4 -3
  466. data/spec/unit/pops/issues_spec.rb +20 -19
  467. data/spec/unit/pops/loaders/loader_spec.rb +4 -8
  468. data/spec/unit/pops/loaders/loaders_spec.rb +31 -101
  469. data/spec/unit/pops/lookup/context_spec.rb +1 -0
  470. data/spec/unit/pops/lookup/interpolation_spec.rb +3 -2
  471. data/spec/unit/pops/merge_strategy_spec.rb +1 -0
  472. data/spec/unit/pops/migration_spec.rb +5 -3
  473. data/spec/unit/pops/model/model_spec.rb +1 -0
  474. data/spec/unit/pops/model/pn_transformer_spec.rb +1 -4
  475. data/spec/unit/pops/parser/locator_spec.rb +6 -48
  476. data/spec/unit/pops/parser/parse_application_spec.rb +1 -0
  477. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +1 -0
  478. data/spec/unit/pops/parser/parse_calls_spec.rb +1 -0
  479. data/spec/unit/pops/parser/parse_capabilities_spec.rb +1 -0
  480. data/spec/unit/pops/parser/parse_conditionals_spec.rb +1 -0
  481. data/spec/unit/pops/parser/parse_containers_spec.rb +1 -0
  482. data/spec/unit/pops/parser/parse_heredoc_spec.rb +15 -111
  483. data/spec/unit/pops/parser/parse_plan_spec.rb +1 -0
  484. data/spec/unit/pops/parser/parse_resource_spec.rb +1 -0
  485. data/spec/unit/pops/parser/parse_site_spec.rb +1 -0
  486. data/spec/unit/pops/parser/pn_parser_spec.rb +1 -0
  487. data/spec/unit/pops/pn_spec.rb +1 -0
  488. data/spec/unit/pops/resource/resource_type_impl_spec.rb +1 -0
  489. data/spec/unit/pops/serialization/serialization_spec.rb +1 -1
  490. data/spec/unit/pops/serialization/to_from_hr_spec.rb +1 -1
  491. data/spec/unit/pops/types/recursion_guard_spec.rb +10 -10
  492. data/spec/unit/pops/types/ruby_generator_spec.rb +2 -2
  493. data/spec/unit/pops/types/string_converter_spec.rb +5 -1
  494. data/spec/unit/pops/types/type_asserter_spec.rb +2 -2
  495. data/spec/unit/pops/types/type_calculator_spec.rb +30 -30
  496. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +0 -9
  497. data/spec/unit/pops/types/type_parser_spec.rb +13 -13
  498. data/spec/unit/pops/validator/validator_spec.rb +2 -1
  499. data/spec/unit/pops/visitor_spec.rb +1 -0
  500. data/spec/unit/property/boolean_spec.rb +1 -1
  501. data/spec/unit/property/ensure_spec.rb +1 -0
  502. data/spec/unit/property/keyvalue_spec.rb +34 -32
  503. data/spec/unit/property/list_spec.rb +27 -26
  504. data/spec/unit/property/ordered_list_spec.rb +14 -10
  505. data/spec/unit/property_spec.rb +43 -42
  506. data/spec/unit/provider/aix_object_spec.rb +45 -47
  507. data/spec/unit/provider/command_spec.rb +9 -9
  508. data/spec/unit/provider/exec/posix_spec.rb +31 -6
  509. data/spec/unit/provider/exec/shell_spec.rb +1 -0
  510. data/spec/unit/provider/exec/windows_spec.rb +4 -2
  511. data/spec/unit/provider/exec_spec.rb +1 -0
  512. data/spec/unit/provider/file/posix_spec.rb +24 -22
  513. data/spec/unit/provider/file/windows_spec.rb +17 -15
  514. data/spec/unit/provider/group/aix_spec.rb +2 -3
  515. data/spec/unit/provider/group/groupadd_spec.rb +26 -30
  516. data/spec/unit/provider/group/ldap_spec.rb +18 -18
  517. data/spec/unit/provider/group/pw_spec.rb +11 -11
  518. data/spec/unit/provider/group/windows_adsi_spec.rb +53 -59
  519. data/spec/unit/provider/ldap_spec.rb +62 -61
  520. data/spec/unit/provider/nameservice/directoryservice_spec.rb +36 -35
  521. data/spec/unit/provider/nameservice_spec.rb +40 -38
  522. data/spec/unit/provider/package/aix_spec.rb +15 -15
  523. data/spec/unit/provider/package/appdmg_spec.rb +13 -13
  524. data/spec/unit/provider/package/apt_spec.rb +27 -44
  525. data/spec/unit/provider/package/aptitude_spec.rb +7 -6
  526. data/spec/unit/provider/package/aptrpm_spec.rb +12 -7
  527. data/spec/unit/provider/package/base_spec.rb +4 -4
  528. data/spec/unit/provider/package/dnf_spec.rb +20 -18
  529. data/spec/unit/provider/package/dpkg_spec.rb +53 -70
  530. data/spec/unit/provider/package/freebsd_spec.rb +11 -11
  531. data/spec/unit/provider/package/gem_spec.rb +55 -132
  532. data/spec/unit/provider/package/hpux_spec.rb +8 -8
  533. data/spec/unit/provider/package/macports_spec.rb +42 -46
  534. data/spec/unit/provider/package/nim_spec.rb +39 -30
  535. data/spec/unit/provider/package/openbsd_spec.rb +39 -36
  536. data/spec/unit/provider/package/opkg_spec.rb +26 -23
  537. data/spec/unit/provider/package/pacman_spec.rb +118 -97
  538. data/spec/unit/provider/package/pip3_spec.rb +0 -17
  539. data/spec/unit/provider/package/pip_spec.rb +106 -95
  540. data/spec/unit/provider/package/pkg_spec.rb +109 -109
  541. data/spec/unit/provider/package/pkgdmg_spec.rb +63 -65
  542. data/spec/unit/provider/package/pkgin_spec.rb +8 -10
  543. data/spec/unit/provider/package/pkgng_spec.rb +31 -22
  544. data/spec/unit/provider/package/pkgutil_spec.rb +49 -45
  545. data/spec/unit/provider/package/portage_spec.rb +74 -70
  546. data/spec/unit/provider/package/puppet_gem_spec.rb +13 -37
  547. data/spec/unit/provider/package/rpm_spec.rb +76 -154
  548. data/spec/unit/provider/package/sun_spec.rb +18 -16
  549. data/spec/unit/provider/package/tdnf_spec.rb +2 -2
  550. data/spec/unit/provider/package/up2date_spec.rb +4 -2
  551. data/spec/unit/provider/package/urpmi_spec.rb +17 -15
  552. data/spec/unit/provider/package/windows/exe_package_spec.rb +15 -12
  553. data/spec/unit/provider/package/windows/msi_package_spec.rb +22 -19
  554. data/spec/unit/provider/package/windows/package_spec.rb +42 -37
  555. data/spec/unit/provider/package/windows_spec.rb +32 -47
  556. data/spec/unit/provider/package/yum_spec.rb +7 -7
  557. data/spec/unit/provider/package/zypper_spec.rb +87 -87
  558. data/spec/unit/provider/parsedfile_spec.rb +45 -44
  559. data/spec/unit/provider/service/base_spec.rb +5 -4
  560. data/spec/unit/provider/service/bsd_spec.rb +29 -27
  561. data/spec/unit/provider/service/daemontools_spec.rb +35 -35
  562. data/spec/unit/provider/service/debian_spec.rb +38 -38
  563. data/spec/unit/provider/service/freebsd_spec.rb +18 -18
  564. data/spec/unit/provider/service/gentoo_spec.rb +55 -50
  565. data/spec/unit/provider/service/init_spec.rb +52 -53
  566. data/spec/unit/provider/service/launchd_spec.rb +116 -138
  567. data/spec/unit/provider/service/openbsd_spec.rb +50 -50
  568. data/spec/unit/provider/service/openrc_spec.rb +45 -43
  569. data/spec/unit/provider/service/openwrt_spec.rb +31 -26
  570. data/spec/unit/provider/service/rcng_spec.rb +14 -14
  571. data/spec/unit/provider/service/redhat_spec.rb +43 -45
  572. data/spec/unit/provider/service/runit_spec.rb +27 -29
  573. data/spec/unit/provider/service/smf_spec.rb +66 -74
  574. data/spec/unit/provider/service/src_spec.rb +47 -46
  575. data/spec/unit/provider/service/systemd_spec.rb +136 -109
  576. data/spec/unit/provider/service/upstart_spec.rb +93 -77
  577. data/spec/unit/provider/service/windows_spec.rb +41 -33
  578. data/spec/unit/provider/user/aix_spec.rb +31 -31
  579. data/spec/unit/provider/user/directoryservice_spec.rb +114 -146
  580. data/spec/unit/provider/user/hpux_spec.rb +16 -16
  581. data/spec/unit/provider/user/ldap_spec.rb +57 -57
  582. data/spec/unit/provider/user/openbsd_spec.rb +12 -10
  583. data/spec/unit/provider/user/pw_spec.rb +35 -37
  584. data/spec/unit/provider/user/user_role_add_spec.rb +93 -93
  585. data/spec/unit/provider/user/useradd_spec.rb +92 -93
  586. data/spec/unit/provider/user/windows_adsi_spec.rb +60 -59
  587. data/spec/unit/provider_spec.rb +35 -35
  588. data/spec/unit/puppet_pal_2pec.rb +5 -4
  589. data/spec/unit/puppet_pal_spec.rb +1 -0
  590. data/spec/unit/puppet_spec.rb +7 -6
  591. data/spec/unit/relationship_spec.rb +1 -0
  592. data/spec/unit/reports/http_spec.rb +23 -21
  593. data/spec/unit/reports/store_spec.rb +4 -3
  594. data/spec/unit/reports_spec.rb +14 -12
  595. data/spec/unit/resource/capability_finder_spec.rb +17 -15
  596. data/spec/unit/resource/catalog_spec.rb +68 -72
  597. data/spec/unit/resource/status_spec.rb +8 -6
  598. data/spec/unit/resource/type_collection_spec.rb +18 -17
  599. data/spec/unit/resource/type_spec.rb +35 -34
  600. data/spec/unit/resource_spec.rb +63 -36
  601. data/spec/unit/rest/client_spec.rb +135 -0
  602. data/spec/unit/rest/route_spec.rb +6 -6
  603. data/spec/unit/scheduler/job_spec.rb +1 -0
  604. data/spec/unit/scheduler/scheduler_spec.rb +1 -0
  605. data/spec/unit/scheduler/splay_job_spec.rb +2 -1
  606. data/spec/unit/settings/array_setting_spec.rb +1 -1
  607. data/spec/unit/settings/autosign_setting_spec.rb +9 -9
  608. data/spec/unit/settings/certificate_revocation_setting_spec.rb +1 -1
  609. data/spec/unit/settings/config_file_spec.rb +1 -0
  610. data/spec/unit/settings/directory_setting_spec.rb +7 -2
  611. data/spec/unit/settings/duration_setting_spec.rb +2 -1
  612. data/spec/unit/settings/enum_setting_spec.rb +1 -1
  613. data/spec/unit/settings/environment_conf_spec.rb +6 -4
  614. data/spec/unit/settings/file_setting_spec.rb +46 -44
  615. data/spec/unit/settings/path_setting_spec.rb +2 -1
  616. data/spec/unit/settings/priority_setting_spec.rb +2 -1
  617. data/spec/unit/settings/string_setting_spec.rb +15 -14
  618. data/spec/unit/settings/terminus_setting_spec.rb +2 -1
  619. data/spec/unit/settings/value_translator_spec.rb +1 -0
  620. data/spec/unit/settings_spec.rb +224 -253
  621. data/spec/unit/ssl/base_spec.rb +15 -14
  622. data/spec/unit/ssl/certificate_request_spec.rb +58 -62
  623. data/spec/unit/ssl/certificate_spec.rb +25 -23
  624. data/spec/unit/ssl/digest_spec.rb +1 -0
  625. data/spec/unit/ssl/host_spec.rb +149 -166
  626. data/spec/unit/ssl/key_spec.rb +31 -30
  627. data/spec/unit/ssl/validator_spec.rb +39 -40
  628. data/spec/unit/task_spec.rb +45 -44
  629. data/spec/unit/transaction/additional_resource_generator_spec.rb +5 -3
  630. data/spec/unit/transaction/event_manager_spec.rb +88 -87
  631. data/spec/unit/transaction/event_spec.rb +15 -16
  632. data/spec/unit/transaction/persistence_spec.rb +17 -16
  633. data/spec/unit/transaction/report_spec.rb +12 -11
  634. data/spec/unit/transaction/resource_harness_spec.rb +31 -52
  635. data/spec/unit/transaction_spec.rb +87 -140
  636. data/spec/unit/type/component_spec.rb +1 -0
  637. data/spec/unit/type/exec_spec.rb +50 -101
  638. data/spec/unit/type/file/checksum_spec.rb +10 -9
  639. data/spec/unit/type/file/checksum_value_spec.rb +32 -31
  640. data/spec/unit/type/file/content_spec.rb +61 -58
  641. data/spec/unit/type/file/ctime_spec.rb +1 -0
  642. data/spec/unit/type/file/ensure_spec.rb +13 -12
  643. data/spec/unit/type/file/group_spec.rb +7 -5
  644. data/spec/unit/type/file/mode_spec.rb +6 -4
  645. data/spec/unit/type/file/mtime_spec.rb +1 -0
  646. data/spec/unit/type/file/owner_spec.rb +8 -6
  647. data/spec/unit/type/file/selinux_spec.rb +19 -17
  648. data/spec/unit/type/file/source_spec.rb +101 -104
  649. data/spec/unit/type/file/type_spec.rb +1 -0
  650. data/spec/unit/type/file_spec.rb +185 -195
  651. data/spec/unit/type/filebucket_spec.rb +10 -11
  652. data/spec/unit/type/group_spec.rb +8 -6
  653. data/spec/unit/type/noop_metaparam_spec.rb +2 -1
  654. data/spec/unit/type/package/package_settings_spec.rb +23 -44
  655. data/spec/unit/type/package_spec.rb +57 -56
  656. data/spec/unit/type/resources_spec.rb +74 -72
  657. data/spec/unit/type/schedule_spec.rb +26 -24
  658. data/spec/unit/type/service_spec.rb +75 -49
  659. data/spec/unit/type/stage_spec.rb +1 -0
  660. data/spec/unit/type/tidy_spec.rb +62 -61
  661. data/spec/unit/type/user_spec.rb +25 -24
  662. data/spec/unit/type/whit_spec.rb +1 -0
  663. data/spec/unit/type_spec.rb +54 -55
  664. data/spec/unit/util/at_fork_spec.rb +19 -18
  665. data/spec/unit/util/autoload_spec.rb +56 -55
  666. data/spec/unit/util/backups_spec.rb +35 -34
  667. data/spec/unit/util/character_encoding_spec.rb +5 -5
  668. data/spec/unit/util/checksums_spec.rb +39 -38
  669. data/spec/unit/util/colors_spec.rb +2 -1
  670. data/spec/unit/util/command_line_spec.rb +20 -40
  671. data/spec/unit/util/constant_inflector_spec.rb +1 -0
  672. data/spec/unit/util/diff_spec.rb +8 -7
  673. data/spec/unit/util/errors_spec.rb +1 -0
  674. data/spec/unit/util/execution_spec.rb +163 -187
  675. data/spec/unit/util/execution_stub_spec.rb +1 -0
  676. data/spec/unit/util/feature_spec.rb +14 -21
  677. data/spec/unit/util/filetype_spec.rb +49 -49
  678. data/spec/unit/util/http_proxy_spec.rb +12 -12
  679. data/spec/unit/util/inifile_spec.rb +31 -26
  680. data/spec/unit/util/json_lockfile_spec.rb +5 -3
  681. data/spec/unit/util/ldap/connection_spec.rb +25 -26
  682. data/spec/unit/util/ldap/generator_spec.rb +1 -0
  683. data/spec/unit/util/ldap/manager_spec.rb +101 -102
  684. data/spec/unit/util/lockfile_spec.rb +1 -0
  685. data/spec/unit/util/log/destinations_spec.rb +33 -30
  686. data/spec/unit/util/log_spec.rb +34 -48
  687. data/spec/unit/util/logging_spec.rb +72 -58
  688. data/spec/unit/util/metric_spec.rb +1 -0
  689. data/spec/unit/util/monkey_patches_spec.rb +9 -7
  690. data/spec/unit/util/multi_match_spec.rb +1 -0
  691. data/spec/unit/util/network_device/config_spec.rb +1 -0
  692. data/spec/unit/util/network_device/transport/base_spec.rb +6 -5
  693. data/spec/unit/util/network_device_spec.rb +9 -7
  694. data/spec/unit/util/package_spec.rb +1 -0
  695. data/spec/unit/util/pidlock_spec.rb +15 -60
  696. data/spec/unit/util/plist_spec.rb +33 -40
  697. data/spec/unit/util/posix_spec.rb +51 -54
  698. data/spec/unit/util/rdoc_spec.rb +10 -9
  699. data/spec/unit/util/reference_spec.rb +1 -0
  700. data/spec/unit/util/resource_template_spec.rb +20 -20
  701. data/spec/unit/util/retry_action_spec.rb +8 -7
  702. data/spec/unit/util/rubygems_spec.rb +8 -7
  703. data/spec/unit/util/run_mode_spec.rb +4 -3
  704. data/spec/unit/util/selinux_spec.rb +72 -79
  705. data/spec/unit/util/splayer_spec.rb +9 -8
  706. data/spec/unit/util/ssl_spec.rb +1 -0
  707. data/spec/unit/util/storage_spec.rb +23 -22
  708. data/spec/unit/util/suidmanager_spec.rb +54 -45
  709. data/spec/unit/util/symbolic_file_mode_spec.rb +1 -0
  710. data/spec/unit/util/tag_set_spec.rb +1 -0
  711. data/spec/unit/util/tagging_spec.rb +1 -0
  712. data/spec/unit/util/terminal_spec.rb +10 -9
  713. data/spec/unit/util/user_attr_spec.rb +2 -1
  714. data/spec/unit/util/warnings_spec.rb +4 -3
  715. data/spec/unit/util/watcher/periodic_watcher_spec.rb +2 -2
  716. data/spec/unit/util/watcher_spec.rb +21 -51
  717. data/spec/unit/util/windows/access_control_entry_spec.rb +1 -0
  718. data/spec/unit/util/windows/access_control_list_spec.rb +1 -0
  719. data/spec/unit/util/windows/adsi_spec.rb +138 -136
  720. data/spec/unit/util/windows/api_types_spec.rb +1 -0
  721. data/spec/unit/util/windows/eventlog_spec.rb +12 -9
  722. data/spec/unit/util/windows/file_spec.rb +1 -0
  723. data/spec/unit/util/windows/root_certs_spec.rb +1 -0
  724. data/spec/unit/util/windows/security_descriptor_spec.rb +2 -0
  725. data/spec/unit/util/windows/service_spec.rb +103 -100
  726. data/spec/unit/util/windows/sid_spec.rb +13 -11
  727. data/spec/unit/util/windows/string_spec.rb +1 -0
  728. data/spec/unit/util_spec.rb +57 -55
  729. data/spec/unit/version_spec.rb +6 -6
  730. metadata +20 -32
  731. data/CODEOWNERS +0 -30
  732. data/ext/autotest/Rakefile +0 -8
  733. data/ext/autotest/config +0 -43
  734. data/ext/autotest/readme.rst +0 -16
  735. data/lib/puppet/confine/boolean.rb +0 -45
  736. data/lib/puppet/provider/package_targetable.rb +0 -68
  737. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load2.rb +0 -11
  738. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load3.rb +0 -11
  739. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load4.rb +0 -11
  740. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load5.rb +0 -12
  741. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/good_func_load.rb +0 -9
  742. data/spec/fixtures/unit/provider/package/pkgng/pkg.info +0 -7
  743. data/spec/fixtures/unit/provider/package/pkgng/pkg.query_absent +0 -1
  744. data/spec/integration/network/http_pool_spec.rb +0 -120
  745. data/spec/integration/provider/file/windows_spec.rb +0 -162
  746. data/spec/lib/puppet_spec/https.rb +0 -166
  747. data/spec/unit/settings/server_list_setting_spec.rb +0 -21
  748. data/spec/watchr.rb +0 -137
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
  require 'puppet_spec/compiler'
3
4
 
@@ -8,7 +9,7 @@ describe 'Capability types' do
8
9
  let(:loaders) { Puppet::Pops::Loaders.new(env) }
9
10
 
10
11
  before(:each) do
11
- allow_any_instance_of(Puppet::Parser::Compiler).to receive(:loaders).and_return(loaders)
12
+ Puppet::Parser::Compiler.any_instance.stubs(:loaders).returns(loaders)
12
13
  Puppet.push_context({:loaders => loaders, :current_environment => env})
13
14
  Puppet::Type.newtype :cap, :is_capability => true do
14
15
  newparam :name
@@ -85,7 +86,7 @@ describe 'Capability types' do
85
86
  parse_results << parser.parse
86
87
 
87
88
  main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results))
88
- allow_any_instance_of(Puppet::Node::Environment).to receive(:perform_initial_import).and_return(main)
89
+ Puppet::Node::Environment.any_instance.stubs(:perform_initial_import).returns main
89
90
 
90
91
  type = compile_to_catalog(nil).environment_instance.known_resource_types.definition(:test)
91
92
  expect(type.produces).to be_instance_of(Array)
@@ -119,7 +120,7 @@ describe 'Capability types' do
119
120
  parse_results << parser.parse
120
121
 
121
122
  main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results))
122
- allow_any_instance_of(Puppet::Node::Environment).to receive(:perform_initial_import).and_return(main)
123
+ Puppet::Node::Environment.any_instance.stubs(:perform_initial_import).returns main
123
124
 
124
125
  type = compile_to_catalog(nil).environment_instance.known_resource_types.definition('Mod::Test')
125
126
  expect(type.produces).to be_instance_of(Array)
@@ -130,7 +131,6 @@ describe 'Capability types' do
130
131
  expect(cns[:mappings]).to be_instance_of(Hash)
131
132
  expect(cns[:mappings]['host']).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression)
132
133
  end
133
-
134
134
  it "does not allow operator '+>' in a mapping" do
135
135
  expect do
136
136
  compile_to_catalog(<<-MANIFEST, node)
@@ -256,12 +256,12 @@ test { one: hostname => "ahost", export => Cap[two] }
256
256
  def mock_cap_finding
257
257
  cap = Puppet::Resource.new("Cap", "two")
258
258
  cap["host"] = "ahost"
259
- expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap)
259
+ Puppet::Resource::CapabilityFinder.expects(:find).returns(cap)
260
260
  cap
261
261
  end
262
262
 
263
263
  it "does not fetch a consumed resource when consume metaparam not set" do
264
- expect(Puppet::Resource::CapabilityFinder).not_to receive(:find)
264
+ Puppet::Resource::CapabilityFinder.expects(:find).never
265
265
  catalog = make_catalog("test { one: }")
266
266
  expect(catalog.resource_keys.find { |type, _| type == "Cap" }).to be_nil
267
267
  expect(catalog.resource("Test", "one")["hostname"]).to eq("nohost")
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
  require 'puppet/test_ca'
3
4
 
@@ -19,7 +20,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
19
20
  it "should return a new X509 certificate" do
20
21
  a = subject.build(:server, csr, issuer, serial)
21
22
  b = subject.build(:server, csr, issuer, serial)
22
- # The two instances are equal in every aspect except that they are
23
+ # The two instances are equal in every aspect except that they are
23
24
  # different instances - they are `==`, but not hash `eql?`
24
25
  expect(a).not_to eql(b)
25
26
  end
@@ -62,7 +63,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
62
63
 
63
64
  it "should respect a custom TTL for the CA" do
64
65
  now = Time.now.utc
65
- expect(Time).to receive(:now).at_least(:once).and_return(now)
66
+ Time.expects(:now).at_least_once.returns(now)
66
67
  cert = subject.build(:server, csr, issuer, serial, 12)
67
68
  expect(cert.not_after.to_i).to eq(now.to_i + 12)
68
69
  end
@@ -86,6 +87,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
86
87
  )
87
88
  end
88
89
 
90
+
89
91
  it "should add an extension for the authorityKeyIdentifer" do
90
92
  cert = subject.build(:server, csr, issuer, serial)
91
93
  ef = OpenSSL::X509::ExtensionFactory.new(issuer, cert)
@@ -129,7 +131,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
129
131
  csr = Puppet::SSL::CertificateRequest.new(name)
130
132
  csr.generate(key)
131
133
 
132
- allow(csr).to receive(:request_extensions).and_return([
134
+ csr.stubs(:request_extensions).returns([
133
135
  {'oid' => '1.3.6.1.4.1.34380.1.2.1', 'value' => 'some-value'},
134
136
  {'oid' => 'pp_uuid', 'value' => 'some-uuid'},
135
137
  ])
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
 
3
4
  require 'puppet/configurer/downloader'
@@ -89,14 +90,14 @@ describe Puppet::Configurer::Downloader do
89
90
  end
90
91
 
91
92
  it "should always set the owner to the current UID" do
92
- expect(Process).to receive(:uid).and_return(51)
93
+ Process.expects(:uid).returns 51
93
94
 
94
95
  file = generate_file_resource(:path => '/path')
95
96
  expect(file[:owner]).to eq(51)
96
97
  end
97
98
 
98
99
  it "should always set the group to the current GID" do
99
- expect(Process).to receive(:gid).and_return(61)
100
+ Process.expects(:gid).returns 61
100
101
 
101
102
  file = generate_file_resource(:path => '/path')
102
103
  expect(file[:group]).to eq(61)
@@ -160,7 +161,7 @@ describe Puppet::Configurer::Downloader do
160
161
  end
161
162
 
162
163
  it "should not issue a deprecation warning for source_permissions" do
163
- expect(Puppet).not_to receive(:puppet_deprecation_warning)
164
+ Puppet.expects(:puppet_deprecation_warning).never
164
165
  catalog = @dler.catalog
165
166
  expect(catalog.resources.size).to eq(1) # Must consume catalog to fix warnings
166
167
  end
@@ -183,37 +184,37 @@ describe Puppet::Configurer::Downloader do
183
184
  end
184
185
 
185
186
  it "should log that it is downloading" do
186
- expect(Puppet).to receive(:info)
187
+ Puppet.expects(:info)
187
188
 
188
189
  @dler.evaluate
189
190
  end
190
191
 
191
192
  it "should return all changed file paths" do
192
- trans = double('transaction')
193
+ trans = mock 'transaction'
193
194
 
194
- catalog = double('catalog')
195
- expect(@dler).to receive(:catalog).and_return(catalog)
196
- expect(catalog).to receive(:apply).and_yield(trans)
195
+ catalog = mock 'catalog'
196
+ @dler.expects(:catalog).returns(catalog)
197
+ catalog.expects(:apply).yields(trans)
197
198
 
198
- resource = double('resource')
199
- expect(resource).to receive(:[]).with(:path).and_return("/changed/file")
199
+ resource = mock 'resource'
200
+ resource.expects(:[]).with(:path).returns "/changed/file"
200
201
 
201
- expect(trans).to receive(:changed?).and_return([resource])
202
+ trans.expects(:changed?).returns([resource])
202
203
 
203
204
  expect(@dler.evaluate).to eq(%w{/changed/file})
204
205
  end
205
206
 
206
207
  it "should yield the resources if a block is given" do
207
- trans = double('transaction')
208
+ trans = mock 'transaction'
208
209
 
209
- catalog = double('catalog')
210
- expect(@dler).to receive(:catalog).and_return(catalog)
211
- expect(catalog).to receive(:apply).and_yield(trans)
210
+ catalog = mock 'catalog'
211
+ @dler.expects(:catalog).returns(catalog)
212
+ catalog.expects(:apply).yields(trans)
212
213
 
213
- resource = double('resource')
214
- expect(resource).to receive(:[]).with(:path).and_return("/changed/file")
214
+ resource = mock 'resource'
215
+ resource.expects(:[]).with(:path).returns "/changed/file"
215
216
 
216
- expect(trans).to receive(:changed?).and_return([resource])
217
+ trans.expects(:changed?).returns([resource])
217
218
 
218
219
  yielded = nil
219
220
  @dler.evaluate { |r| yielded = r }
@@ -221,10 +222,10 @@ describe Puppet::Configurer::Downloader do
221
222
  end
222
223
 
223
224
  it "should catch and log exceptions" do
224
- expect(Puppet).to receive(:log_exception)
225
+ Puppet.expects(:log_exception)
225
226
  # The downloader creates a new catalog for each apply, and really the only object
226
227
  # that it is possible to stub for the purpose of generating a puppet error
227
- allow_any_instance_of(Puppet::Resource::Catalog).to receive(:apply).and_raise(Puppet::Error, "testing")
228
+ Puppet::Resource::Catalog.any_instance.stubs(:apply).raises(Puppet::Error, "testing")
228
229
 
229
230
  expect { @dler.evaluate }.not_to raise_error
230
231
  end
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
  require 'puppet/configurer'
3
4
  require 'puppet/configurer/fact_handler'
@@ -57,13 +58,13 @@ describe Puppet::Configurer::FactHandler do
57
58
  end
58
59
 
59
60
  it "should fail if finding facts fails" do
60
- expect(Puppet::Node::Facts.indirection).to receive(:find).and_raise(RuntimeError)
61
+ Puppet::Node::Facts.indirection.expects(:find).raises RuntimeError
61
62
 
62
63
  expect { facthandler.find_facts }.to raise_error(Puppet::Error, /Could not retrieve local facts/)
63
64
  end
64
65
 
65
66
  it "should only load fact plugins once" do
66
- expect(Puppet::Node::Facts.indirection).to receive(:find).once
67
+ Puppet::Node::Facts.indirection.expects(:find).once
67
68
  facthandler.find_facts
68
69
  end
69
70
  end
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
  require 'puppet/configurer'
3
4
  require 'puppet/configurer/plugin_handler'
@@ -10,35 +11,21 @@ describe Puppet::Configurer::PluginHandler do
10
11
  before :each do
11
12
  # PluginHandler#load_plugin has an extra-strong rescue clause
12
13
  # this mock is to make sure that we don't silently ignore errors
13
- expect(Puppet).not_to receive(:err)
14
+ Puppet.expects(:err).never
14
15
  # Server_agent version needs to be at 5.3.4 in order to mount locales
15
16
  Puppet.push_context({:server_agent_version => "5.3.4"})
16
17
  end
17
18
 
18
19
  it "downloads plugins, facts, and locales" do
19
- times_called = 0
20
- allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { times_called += 1 }.and_return([])
20
+ Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(3).returns([])
21
21
 
22
22
  pluginhandler.download_plugins(environment)
23
- expect(times_called).to eq(3)
24
23
  end
25
24
 
26
25
  it "returns downloaded plugin, fact, and locale filenames" do
27
- times_called = 0
28
- allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
29
- times_called += 1
30
-
31
- if times_called == 1
32
- %w[/a]
33
- elsif times_called == 2
34
- %w[/b]
35
- else
36
- %w[/c]
37
- end
38
- end
26
+ Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(3).returns(%w[/a]).then.returns(%w[/b]).then.returns(%w[/c])
39
27
 
40
28
  expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b /c])
41
- expect(times_called).to eq(3)
42
29
  end
43
30
  end
44
31
 
@@ -46,25 +33,15 @@ describe Puppet::Configurer::PluginHandler do
46
33
  before :each do
47
34
  # PluginHandler#load_plugin has an extra-strong rescue clause
48
35
  # this mock is to make sure that we don't silently ignore errors
49
- expect(Puppet).not_to receive(:err)
36
+ Puppet.expects(:err).never
50
37
  # Server_agent version needs to be at 5.3.4 in order to mount locales
51
38
  Puppet.push_context({:server_agent_version => "5.3.3"})
52
39
  end
53
40
 
54
41
  it "returns downloaded plugin, fact, but not locale filenames" do
55
- times_called = 0
56
- allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
57
- times_called += 1
58
-
59
- if times_called == 1
60
- %w[/a]
61
- else
62
- %w[/b]
63
- end
64
- end
42
+ Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(2).returns(%w[/a]).then.returns(%w[/b])
65
43
 
66
44
  expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
67
- expect(times_called).to eq(2)
68
45
  end
69
46
  end
70
47
 
@@ -72,26 +49,16 @@ describe Puppet::Configurer::PluginHandler do
72
49
  before :each do
73
50
  # PluginHandler#load_plugin has an extra-strong rescue clause
74
51
  # this mock is to make sure that we don't silently ignore errors
75
- expect(Puppet).not_to receive(:err)
52
+ Puppet.expects(:err).never
76
53
  # Server_agent version needs to be at 5.3.4 in order to mount locales
77
54
  # A blank version will default to 0.0
78
55
  Puppet.push_context({:server_agent_version => ""})
79
56
  end
80
57
 
81
58
  it "returns downloaded plugin, fact, but not locale filenames" do
82
- times_called = 0
83
- allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
84
- times_called += 1
85
-
86
- if times_called == 1
87
- %w[/a]
88
- else
89
- %w[/b]
90
- end
91
- end
59
+ Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(2).returns(%w[/a]).then.returns(%w[/b])
92
60
 
93
61
  expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
94
- expect(times_called).to eq(2)
95
62
  end
96
63
  end
97
64
  end
@@ -1,12 +1,13 @@
1
+ #! /usr/bin/env ruby
1
2
  require 'spec_helper'
2
3
  require 'puppet/configurer'
3
4
 
4
5
  describe Puppet::Configurer do
5
6
  before do
6
- allow(Puppet.settings).to receive(:use).and_return(true)
7
+ Puppet.settings.stubs(:use).returns(true)
7
8
  @agent = Puppet::Configurer.new
8
- allow(@agent).to receive(:init_storage)
9
- allow(Puppet::Util::Storage).to receive(:store)
9
+ @agent.stubs(:init_storage)
10
+ Puppet::Util::Storage.stubs(:store)
10
11
  Puppet[:server] = "puppetmaster"
11
12
  Puppet[:report] = true
12
13
  end
@@ -18,21 +19,21 @@ describe Puppet::Configurer do
18
19
  describe "when executing a pre-run hook" do
19
20
  it "should do nothing if the hook is set to an empty string" do
20
21
  Puppet.settings[:prerun_command] = ""
21
- expect(Puppet::Util).not_to receive(:exec)
22
+ Puppet::Util.expects(:exec).never
22
23
 
23
24
  @agent.execute_prerun_command
24
25
  end
25
26
 
26
27
  it "should execute any pre-run command provided via the 'prerun_command' setting" do
27
28
  Puppet.settings[:prerun_command] = "/my/command"
28
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
29
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
29
30
 
30
31
  @agent.execute_prerun_command
31
32
  end
32
33
 
33
34
  it "should fail if the command fails" do
34
35
  Puppet.settings[:prerun_command] = "/my/command"
35
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
36
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
36
37
 
37
38
  expect(@agent.execute_prerun_command).to be_falsey
38
39
  end
@@ -41,21 +42,21 @@ describe Puppet::Configurer do
41
42
  describe "when executing a post-run hook" do
42
43
  it "should do nothing if the hook is set to an empty string" do
43
44
  Puppet.settings[:postrun_command] = ""
44
- expect(Puppet::Util).not_to receive(:exec)
45
+ Puppet::Util.expects(:exec).never
45
46
 
46
47
  @agent.execute_postrun_command
47
48
  end
48
49
 
49
50
  it "should execute any post-run command provided via the 'postrun_command' setting" do
50
51
  Puppet.settings[:postrun_command] = "/my/command"
51
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
52
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
52
53
 
53
54
  @agent.execute_postrun_command
54
55
  end
55
56
 
56
57
  it "should fail if the command fails" do
57
58
  Puppet.settings[:postrun_command] = "/my/command"
58
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
59
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
59
60
 
60
61
  expect(@agent.execute_postrun_command).to be_falsey
61
62
  end
@@ -63,20 +64,20 @@ describe Puppet::Configurer do
63
64
 
64
65
  describe "when executing a catalog run" do
65
66
  before do
66
- allow(Puppet.settings).to receive(:use).and_return(true)
67
- allow(@agent).to receive(:download_plugins)
67
+ Puppet.settings.stubs(:use).returns(true)
68
+ @agent.stubs(:download_plugins)
68
69
  Puppet::Node::Facts.indirection.terminus_class = :memory
69
70
  @facts = Puppet::Node::Facts.new(Puppet[:node_name_value])
70
71
  Puppet::Node::Facts.indirection.save(@facts)
71
72
 
72
73
  @catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
73
- allow(@catalog).to receive(:to_ral).and_return(@catalog)
74
+ @catalog.stubs(:to_ral).returns(@catalog)
74
75
  Puppet::Resource::Catalog.indirection.terminus_class = :rest
75
- allow(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(@catalog)
76
- allow(@agent).to receive(:send_report)
77
- allow(@agent).to receive(:save_last_run_summary)
76
+ Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog)
77
+ @agent.stubs(:send_report)
78
+ @agent.stubs(:save_last_run_summary)
78
79
 
79
- allow(Puppet::Util::Log).to receive(:close_all)
80
+ Puppet::Util::Log.stubs(:close_all)
80
81
  end
81
82
 
82
83
  after :all do
@@ -85,39 +86,39 @@ describe Puppet::Configurer do
85
86
  end
86
87
 
87
88
  it "should initialize storage" do
88
- expect(Puppet::Util::Storage).to receive(:load)
89
+ Puppet::Util::Storage.expects(:load)
89
90
  @agent.run
90
91
  end
91
92
 
92
93
  it "downloads plugins when told" do
93
- expect(@agent).to receive(:download_plugins)
94
+ @agent.expects(:download_plugins)
94
95
  @agent.run(:pluginsync => true)
95
96
  end
96
97
 
97
98
  it "does not download plugins when told" do
98
- expect(@agent).not_to receive(:download_plugins)
99
+ @agent.expects(:download_plugins).never
99
100
  @agent.run(:pluginsync => false)
100
101
  end
101
102
 
102
103
  it "should carry on when it can't fetch its node definition" do
103
104
  error = Net::HTTPError.new(400, 'dummy server communication error')
104
- expect(Puppet::Node.indirection).to receive(:find).and_raise(error)
105
+ Puppet::Node.indirection.expects(:find).raises(error)
105
106
  expect(@agent.run).to eq(0)
106
107
  end
107
108
 
108
109
  it "applies a cached catalog when it can't connect to the master" do
109
110
  error = Errno::ECONNREFUSED.new('Connection refused - connect(2)')
110
111
 
111
- expect(Puppet::Node.indirection).to receive(:find).and_raise(error)
112
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(:ignore_cache => true)).and_raise(error)
113
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(:ignore_terminus => true)).and_return(@catalog)
112
+ Puppet::Node.indirection.expects(:find).raises(error)
113
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_cache => true)).raises(error)
114
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_terminus => true)).returns(@catalog)
114
115
 
115
116
  expect(@agent.run).to eq(0)
116
117
  end
117
118
 
118
119
  it "should initialize a transaction report if one is not provided" do
119
120
  report = Puppet::Transaction::Report.new
120
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
121
+ Puppet::Transaction::Report.expects(:new).returns report
121
122
 
122
123
  @agent.run
123
124
  end
@@ -134,15 +135,15 @@ describe Puppet::Configurer do
134
135
 
135
136
  it "should pass the new report to the catalog" do
136
137
  report = Puppet::Transaction::Report.new
137
- allow(Puppet::Transaction::Report).to receive(:new).and_return(report)
138
- expect(@catalog).to receive(:apply).with(hash_including(report: report))
138
+ Puppet::Transaction::Report.stubs(:new).returns report
139
+ @catalog.expects(:apply).with{|options| options[:report] == report}
139
140
 
140
141
  @agent.run
141
142
  end
142
143
 
143
144
  it "should use the provided report if it was passed one" do
144
145
  report = Puppet::Transaction::Report.new
145
- expect(@catalog).to receive(:apply).with(hash_including(report: report))
146
+ @catalog.expects(:apply).with {|options| options[:report] == report}
146
147
 
147
148
  @agent.run(:report => report)
148
149
  end
@@ -150,69 +151,69 @@ describe Puppet::Configurer do
150
151
  it "should set the report as a log destination" do
151
152
  report = Puppet::Transaction::Report.new
152
153
 
153
- expect(report).to receive(:<<).with(instance_of(Puppet::Util::Log)).at_least(:once)
154
+ report.expects(:<<).with(instance_of(Puppet::Util::Log)).at_least_once
154
155
 
155
156
  @agent.run(:report => report)
156
157
  end
157
158
 
158
159
  it "should retrieve the catalog" do
159
- expect(@agent).to receive(:retrieve_catalog)
160
+ @agent.expects(:retrieve_catalog)
160
161
 
161
162
  @agent.run
162
163
  end
163
164
 
164
165
  it "should log a failure and do nothing if no catalog can be retrieved" do
165
- expect(@agent).to receive(:retrieve_catalog).and_return(nil)
166
+ @agent.expects(:retrieve_catalog).returns nil
166
167
 
167
- expect(Puppet).to receive(:err).with("Could not retrieve catalog; skipping run")
168
+ Puppet.expects(:err).with "Could not retrieve catalog; skipping run"
168
169
 
169
170
  @agent.run
170
171
  end
171
172
 
172
173
  it "should apply the catalog with all options to :run" do
173
- expect(@agent).to receive(:retrieve_catalog).and_return(@catalog)
174
+ @agent.expects(:retrieve_catalog).returns @catalog
174
175
 
175
- expect(@catalog).to receive(:apply).with(hash_including(one: true))
176
+ @catalog.expects(:apply).with { |args| args[:one] == true }
176
177
  @agent.run :one => true
177
178
  end
178
179
 
179
180
  it "should accept a catalog and use it instead of retrieving a different one" do
180
- expect(@agent).not_to receive(:retrieve_catalog)
181
+ @agent.expects(:retrieve_catalog).never
181
182
 
182
- expect(@catalog).to receive(:apply)
183
+ @catalog.expects(:apply)
183
184
  @agent.run :one => true, :catalog => @catalog
184
185
  end
185
186
 
186
187
  it "should benchmark how long it takes to apply the catalog" do
187
- expect(@agent).to receive(:benchmark).with(:notice, instance_of(String))
188
+ @agent.expects(:benchmark).with(:notice, instance_of(String))
188
189
 
189
- expect(@agent).to receive(:retrieve_catalog).and_return(@catalog)
190
+ @agent.expects(:retrieve_catalog).returns @catalog
190
191
 
191
- expect(@catalog).not_to receive(:apply) # because we're not yielding
192
+ @catalog.expects(:apply).never # because we're not yielding
192
193
  @agent.run
193
194
  end
194
195
 
195
196
  it "should execute post-run hooks after the run" do
196
- expect(@agent).to receive(:execute_postrun_command)
197
+ @agent.expects(:execute_postrun_command)
197
198
 
198
199
  @agent.run
199
200
  end
200
201
 
201
202
  it "should create report with passed transaction_uuid and job_id" do
202
203
  @agent = Puppet::Configurer.new("test_tuuid", "test_jid")
203
- allow(@agent).to receive(:init_storage)
204
+ @agent.stubs(:init_storage)
204
205
 
205
206
  report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
206
- expect(Puppet::Transaction::Report).to receive(:new).with(anything, anything, 'test_tuuid', 'test_jid').and_return(report)
207
- expect(@agent).to receive(:send_report).with(report)
207
+ Puppet::Transaction::Report.expects(:new).with(anything, anything, 'test_tuuid', 'test_jid').returns(report)
208
+ @agent.expects(:send_report).with(report)
208
209
 
209
210
  @agent.run
210
211
  end
211
212
 
212
213
  it "should send the report" do
213
214
  report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
214
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
215
- expect(@agent).to receive(:send_report).with(report)
215
+ Puppet::Transaction::Report.expects(:new).returns(report)
216
+ @agent.expects(:send_report).with(report)
216
217
 
217
218
  expect(report.environment).to eq("test")
218
219
  expect(report.transaction_uuid).to eq("aaaa")
@@ -221,11 +222,11 @@ describe Puppet::Configurer do
221
222
  end
222
223
 
223
224
  it "should send the transaction report even if the catalog could not be retrieved" do
224
- expect(@agent).to receive(:retrieve_catalog).and_return(nil)
225
+ @agent.expects(:retrieve_catalog).returns nil
225
226
 
226
227
  report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
227
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
228
- expect(@agent).to receive(:send_report).with(report)
228
+ Puppet::Transaction::Report.expects(:new).returns(report)
229
+ @agent.expects(:send_report).with(report)
229
230
 
230
231
  expect(report.environment).to eq("test")
231
232
  expect(report.transaction_uuid).to eq("aaaa")
@@ -234,11 +235,11 @@ describe Puppet::Configurer do
234
235
  end
235
236
 
236
237
  it "should send the transaction report even if there is a failure" do
237
- expect(@agent).to receive(:retrieve_catalog).and_raise("whatever")
238
+ @agent.expects(:retrieve_catalog).raises "whatever"
238
239
 
239
240
  report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
240
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
241
- expect(@agent).to receive(:send_report).with(report)
241
+ Puppet::Transaction::Report.expects(:new).returns(report)
242
+ @agent.expects(:send_report).with(report)
242
243
 
243
244
  expect(report.environment).to eq("test")
244
245
  expect(report.transaction_uuid).to eq("aaaa")
@@ -248,7 +249,7 @@ describe Puppet::Configurer do
248
249
 
249
250
  it "should remove the report as a log destination when the run is finished" do
250
251
  report = Puppet::Transaction::Report.new
251
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
252
+ Puppet::Transaction::Report.expects(:new).returns(report)
252
253
 
253
254
  @agent.run
254
255
 
@@ -257,35 +258,35 @@ describe Puppet::Configurer do
257
258
 
258
259
  it "should return the report exit_status as the result of the run" do
259
260
  report = Puppet::Transaction::Report.new
260
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
261
- expect(report).to receive(:exit_status).and_return(1234)
261
+ Puppet::Transaction::Report.expects(:new).returns(report)
262
+ report.expects(:exit_status).returns(1234)
262
263
 
263
264
  expect(@agent.run).to eq(1234)
264
265
  end
265
266
 
266
267
  it "should return nil if catalog application fails" do
267
- expect(@catalog).to receive(:apply).and_raise(Puppet::Error, 'One or more resource dependency cycles detected in graph')
268
+ @catalog.expects(:apply).raises(Puppet::Error, 'One or more resource dependency cycles detected in graph')
268
269
  report = Puppet::Transaction::Report.new
269
270
  expect(@agent.run(catalog: @catalog, report: report)).to be_nil
270
271
  end
271
272
 
272
273
  it "should send the transaction report even if the pre-run command fails" do
273
274
  report = Puppet::Transaction::Report.new
274
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
275
+ Puppet::Transaction::Report.expects(:new).returns(report)
275
276
 
276
277
  Puppet.settings[:prerun_command] = "/my/command"
277
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
278
- expect(@agent).to receive(:send_report).with(report)
278
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
279
+ @agent.expects(:send_report).with(report)
279
280
 
280
281
  expect(@agent.run).to be_nil
281
282
  end
282
283
 
283
284
  it "should include the pre-run command failure in the report" do
284
285
  report = Puppet::Transaction::Report.new
285
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
286
+ Puppet::Transaction::Report.expects(:new).returns(report)
286
287
 
287
288
  Puppet.settings[:prerun_command] = "/my/command"
288
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
289
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
289
290
 
290
291
  expect(@agent.run).to be_nil
291
292
  expect(report.logs.find { |x| x.message =~ /Could not run command from prerun_command/ }).to be
@@ -293,23 +294,23 @@ describe Puppet::Configurer do
293
294
 
294
295
  it "should send the transaction report even if the post-run command fails" do
295
296
  report = Puppet::Transaction::Report.new
296
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
297
+ Puppet::Transaction::Report.expects(:new).returns(report)
297
298
 
298
299
  Puppet.settings[:postrun_command] = "/my/command"
299
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
300
- expect(@agent).to receive(:send_report).with(report)
300
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
301
+ @agent.expects(:send_report).with(report)
301
302
 
302
303
  expect(@agent.run).to be_nil
303
304
  end
304
305
 
305
306
  it "should include the post-run command failure in the report" do
306
307
  report = Puppet::Transaction::Report.new
307
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
308
+ Puppet::Transaction::Report.expects(:new).returns(report)
308
309
 
309
310
  Puppet.settings[:postrun_command] = "/my/command"
310
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
311
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
311
312
 
312
- expect(report).to receive(:<<) { |log, _| expect(log.message).to match(/Could not run command from postrun_command/) }.at_least(:once)
313
+ report.expects(:<<).with { |log| log.message.include?("Could not run command from postrun_command") }
313
314
 
314
315
  expect(@agent.run).to be_nil
315
316
  end
@@ -317,49 +318,49 @@ describe Puppet::Configurer do
317
318
  it "should execute post-run command even if the pre-run command fails" do
318
319
  Puppet.settings[:prerun_command] = "/my/precommand"
319
320
  Puppet.settings[:postrun_command] = "/my/postcommand"
320
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/precommand"]).and_raise(Puppet::ExecutionFailure, "Failed")
321
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/postcommand"])
321
+ Puppet::Util::Execution.expects(:execute).with(["/my/precommand"]).raises(Puppet::ExecutionFailure, "Failed")
322
+ Puppet::Util::Execution.expects(:execute).with(["/my/postcommand"])
322
323
 
323
324
  expect(@agent.run).to be_nil
324
325
  end
325
326
 
326
327
  it "should finalize the report" do
327
328
  report = Puppet::Transaction::Report.new
328
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
329
+ Puppet::Transaction::Report.expects(:new).returns(report)
329
330
 
330
- expect(report).to receive(:finalize_report)
331
+ report.expects(:finalize_report)
331
332
  @agent.run
332
333
  end
333
334
 
334
335
  it "should not apply the catalog if the pre-run command fails" do
335
336
  report = Puppet::Transaction::Report.new
336
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
337
+ Puppet::Transaction::Report.expects(:new).returns(report)
337
338
 
338
339
  Puppet.settings[:prerun_command] = "/my/command"
339
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
340
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
340
341
 
341
- expect(@catalog).not_to receive(:apply)
342
- expect(@agent).to receive(:send_report)
342
+ @catalog.expects(:apply).never()
343
+ @agent.expects(:send_report)
343
344
 
344
345
  expect(@agent.run).to be_nil
345
346
  end
346
347
 
347
348
  it "should apply the catalog, send the report, and return nil if the post-run command fails" do
348
349
  report = Puppet::Transaction::Report.new
349
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
350
+ Puppet::Transaction::Report.expects(:new).returns(report)
350
351
 
351
352
  Puppet.settings[:postrun_command] = "/my/command"
352
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
353
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
353
354
 
354
- expect(@catalog).to receive(:apply)
355
- expect(@agent).to receive(:send_report)
355
+ @catalog.expects(:apply)
356
+ @agent.expects(:send_report)
356
357
 
357
358
  expect(@agent.run).to be_nil
358
359
  end
359
360
 
360
361
  it 'includes total time metrics in the report after successfully applying the catalog' do
361
362
  report = Puppet::Transaction::Report.new
362
- allow(@catalog).to receive(:apply).with(hash_including(report: report))
363
+ @catalog.stubs(:apply).with() {|options| options[:report] == report }
363
364
  @agent.run(report: report)
364
365
 
365
366
  expect(report.metrics['time']).to be
@@ -368,7 +369,7 @@ describe Puppet::Configurer do
368
369
 
369
370
  it 'includes total time metrics in the report even if prerun fails' do
370
371
  Puppet.settings[:prerun_command] = "/my/command"
371
- expect(Puppet::Util::Execution).to receive(:execute).with(["/my/command"]).and_raise(Puppet::ExecutionFailure, "Failed")
372
+ Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
372
373
 
373
374
  report = Puppet::Transaction::Report.new
374
375
  @agent.run(report: report)
@@ -379,7 +380,7 @@ describe Puppet::Configurer do
379
380
 
380
381
  it 'includes total time metrics in the report even if catalog retrieval fails' do
381
382
  report = Puppet::Transaction::Report.new
382
- allow(@agent).to receive(:prepare_and_retrieve_catalog_from_cache).and_raise
383
+ @agent.stubs(:prepare_and_retrieve_catalog_from_cache).raises
383
384
  @agent.run(:report => report)
384
385
 
385
386
  expect(report.metrics['time']).to be
@@ -388,13 +389,13 @@ describe Puppet::Configurer do
388
389
 
389
390
  it "should refetch the catalog if the server specifies a new environment in the catalog" do
390
391
  catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote('second_env'))
391
- expect(@agent).to receive(:retrieve_catalog).and_return(catalog).twice
392
+ @agent.expects(:retrieve_catalog).returns(catalog).twice
392
393
 
393
394
  @agent.run
394
395
  end
395
396
 
396
397
  it "should change the environment setting if the server specifies a new environment in the catalog" do
397
- allow(@catalog).to receive(:environment).and_return("second_env")
398
+ @catalog.stubs(:environment).returns("second_env")
398
399
 
399
400
  @agent.run
400
401
 
@@ -403,11 +404,11 @@ describe Puppet::Configurer do
403
404
 
404
405
  it "should fix the report if the server specifies a new environment in the catalog" do
405
406
  report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
406
- expect(Puppet::Transaction::Report).to receive(:new).and_return(report)
407
- expect(@agent).to receive(:send_report).with(report)
407
+ Puppet::Transaction::Report.expects(:new).returns(report)
408
+ @agent.expects(:send_report).with(report)
408
409
 
409
- allow(@catalog).to receive(:environment).and_return("second_env")
410
- allow(@agent).to receive(:retrieve_catalog).and_return(@catalog)
410
+ @catalog.stubs(:environment).returns("second_env")
411
+ @agent.stubs(:retrieve_catalog).returns(@catalog)
411
412
 
412
413
  @agent.run
413
414
 
@@ -416,24 +417,24 @@ describe Puppet::Configurer do
416
417
 
417
418
  it "sends the transaction uuid in a catalog request" do
418
419
  @agent.instance_variable_set(:@transaction_uuid, 'aaa')
419
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(transaction_uuid: 'aaa'))
420
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:transaction_uuid => 'aaa'))
420
421
  @agent.run
421
422
  end
422
423
 
423
424
  it "sends the transaction uuid in a catalog request" do
424
425
  @agent.instance_variable_set(:@job_id, 'aaa')
425
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(job_id: 'aaa'))
426
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:job_id => 'aaa'))
426
427
  @agent.run
427
428
  end
428
429
 
429
430
  it "sets the static_catalog query param to true in a catalog request" do
430
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(static_catalog: true))
431
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:static_catalog => true))
431
432
  @agent.run
432
433
  end
433
434
 
434
435
  it "sets the checksum_type query param to the default supported_checksum_types in a catalog request" do
435
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything,
436
- hash_including(checksum_type: 'md5.sha256.sha384.sha512.sha224'))
436
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything,
437
+ has_entries(:checksum_type => 'md5.sha256.sha384.sha512.sha224'))
437
438
  @agent.run
438
439
  end
439
440
 
@@ -441,22 +442,22 @@ describe Puppet::Configurer do
441
442
  # Regenerate the agent to pick up the new setting
442
443
  Puppet[:supported_checksum_types] = ['sha256']
443
444
  @agent = Puppet::Configurer.new
444
- allow(@agent).to receive(:init_storage)
445
- allow(@agent).to receive(:download_plugins)
446
- allow(@agent).to receive(:send_report)
447
- allow(@agent).to receive(:save_last_run_summary)
445
+ @agent.stubs(:init_storage)
446
+ @agent.stubs(:download_plugins)
447
+ @agent.stubs(:send_report)
448
+ @agent.stubs(:save_last_run_summary)
448
449
 
449
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(checksum_type: 'sha256'))
450
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:checksum_type => 'sha256'))
450
451
  @agent.run
451
452
  end
452
453
 
453
454
  describe "when not using a REST terminus for catalogs" do
454
455
  it "should not pass any facts when retrieving the catalog" do
455
456
  Puppet::Resource::Catalog.indirection.terminus_class = :compiler
456
- expect(@agent).not_to receive(:facts_for_uploading)
457
- expect(Puppet::Resource::Catalog.indirection).to receive(:find) do |name, options|
457
+ @agent.expects(:facts_for_uploading).never
458
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
458
459
  options[:facts].nil?
459
- end.and_return(@catalog)
460
+ }.returns @catalog
460
461
 
461
462
  @agent.run
462
463
  end
@@ -470,9 +471,11 @@ describe Puppet::Configurer do
470
471
  # call to "encode" - the encode in turn returns mocked data that is asserted as being
471
472
  # presented to the catalog terminus as options.
472
473
  #
473
- expect(@agent).to receive(:find_facts).and_return(12345)
474
- expect(@agent).to receive(:encode_facts).with(12345).and_return(:facts => "myfacts", :facts_format => :foo)
475
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(facts: "myfacts", facts_format: :foo)).and_return(@catalog)
474
+ @agent.expects(:find_facts).returns(12345)
475
+ @agent.expects(:encode_facts).with(12345).returns(:facts => "myfacts", :facts_format => :foo)
476
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
477
+ options[:facts] == "myfacts" and options[:facts_format] == :foo
478
+ }.returns @catalog
476
479
 
477
480
  @agent.run
478
481
  end
@@ -481,7 +484,7 @@ describe Puppet::Configurer do
481
484
 
482
485
  describe "when initialized with a transaction_uuid" do
483
486
  it "stores it" do
484
- expect(SecureRandom).not_to receive(:uuid)
487
+ SecureRandom.expects(:uuid).never
485
488
  configurer = Puppet::Configurer.new('foo')
486
489
  expect(configurer.instance_variable_get(:@transaction_uuid) == 'foo')
487
490
  end
@@ -491,7 +494,7 @@ describe Puppet::Configurer do
491
494
  include PuppetSpec::Files
492
495
 
493
496
  before do
494
- allow(Puppet.settings).to receive(:use).and_return(true)
497
+ Puppet.settings.stubs(:use).returns(true)
495
498
  @configurer = Puppet::Configurer.new
496
499
  Puppet[:lastrunfile] = tmpfile('last_run_file')
497
500
 
@@ -502,53 +505,53 @@ describe Puppet::Configurer do
502
505
  it "should print a report summary if configured to do so" do
503
506
  Puppet.settings[:summarize] = true
504
507
 
505
- expect(@report).to receive(:summary).and_return("stuff")
508
+ @report.expects(:summary).returns "stuff"
506
509
 
507
- expect(@configurer).to receive(:puts).with("stuff")
510
+ @configurer.expects(:puts).with("stuff")
508
511
  @configurer.send_report(@report)
509
512
  end
510
513
 
511
514
  it "should not print a report summary if not configured to do so" do
512
515
  Puppet.settings[:summarize] = false
513
516
 
514
- expect(@configurer).not_to receive(:puts)
517
+ @configurer.expects(:puts).never
515
518
  @configurer.send_report(@report)
516
519
  end
517
520
 
518
521
  it "should save the report if reporting is enabled" do
519
522
  Puppet.settings[:report] = true
520
523
 
521
- expect(Puppet::Transaction::Report.indirection).to receive(:save).with(@report, nil, instance_of(Hash))
524
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil, instance_of(Hash))
522
525
  @configurer.send_report(@report)
523
526
  end
524
527
 
525
528
  it "should not save the report if reporting is disabled" do
526
529
  Puppet.settings[:report] = false
527
530
 
528
- expect(Puppet::Transaction::Report.indirection).not_to receive(:save).with(@report, nil, instance_of(Hash))
531
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil, instance_of(Hash)).never
529
532
  @configurer.send_report(@report)
530
533
  end
531
534
 
532
535
  it "should save the last run summary if reporting is enabled" do
533
536
  Puppet.settings[:report] = true
534
537
 
535
- expect(@configurer).to receive(:save_last_run_summary).with(@report)
538
+ @configurer.expects(:save_last_run_summary).with(@report)
536
539
  @configurer.send_report(@report)
537
540
  end
538
541
 
539
542
  it "should save the last run summary if reporting is disabled" do
540
543
  Puppet.settings[:report] = false
541
544
 
542
- expect(@configurer).to receive(:save_last_run_summary).with(@report)
545
+ @configurer.expects(:save_last_run_summary).with(@report)
543
546
  @configurer.send_report(@report)
544
547
  end
545
548
 
546
549
  it "should log but not fail if saving the report fails" do
547
550
  Puppet.settings[:report] = true
548
551
 
549
- expect(Puppet::Transaction::Report.indirection).to receive(:save).and_raise("whatever")
552
+ Puppet::Transaction::Report.indirection.expects(:save).raises("whatever")
550
553
 
551
- expect(Puppet).to receive(:send_log).with(:err, 'Could not send report: whatever')
554
+ Puppet.expects(:send_log).with(:err, 'Could not send report: whatever')
552
555
  @configurer.send_report(@report)
553
556
  end
554
557
  end
@@ -557,10 +560,10 @@ describe Puppet::Configurer do
557
560
  include PuppetSpec::Files
558
561
 
559
562
  before do
560
- allow(Puppet.settings).to receive(:use).and_return(true)
563
+ Puppet.settings.stubs(:use).returns(true)
561
564
  @configurer = Puppet::Configurer.new
562
565
 
563
- @report = double('report', :raw_summary => {})
566
+ @report = stub 'report', :raw_summary => {}
564
567
 
565
568
  Puppet[:lastrunfile] = tmpfile('last_run_file')
566
569
  end
@@ -571,7 +574,7 @@ describe Puppet::Configurer do
571
574
  end
572
575
 
573
576
  it "should write the raw summary as yaml" do
574
- expect(@report).to receive(:raw_summary).and_return("summary")
577
+ @report.expects(:raw_summary).returns("summary")
575
578
  @configurer.save_last_run_summary(@report)
576
579
  expect(File.read(Puppet[:lastrunfile])).to eq(YAML.dump("summary"))
577
580
  end
@@ -585,14 +588,14 @@ describe Puppet::Configurer do
585
588
  end
586
589
  end.new
587
590
 
588
- expect(Puppet::Util).to receive(:replace_file).and_yield(fh)
591
+ Puppet::Util.expects(:replace_file).yields(fh)
589
592
 
590
- expect(Puppet).to receive(:send_log).with(:err, 'Could not save last run local report: failed to do print')
593
+ Puppet.expects(:send_log).with(:err, 'Could not save last run local report: failed to do print')
591
594
  @configurer.save_last_run_summary(@report)
592
595
  end
593
596
 
594
597
  it "should create the last run file with the correct mode" do
595
- expect(Puppet.settings.setting(:lastrunfile)).to receive(:mode).and_return('664')
598
+ Puppet.settings.setting(:lastrunfile).expects(:mode).returns('664')
596
599
  @configurer.save_last_run_summary(@report)
597
600
 
598
601
  if Puppet::Util::Platform.windows?
@@ -605,66 +608,66 @@ describe Puppet::Configurer do
605
608
  end
606
609
 
607
610
  it "should report invalid last run file permissions" do
608
- expect(Puppet.settings.setting(:lastrunfile)).to receive(:mode).and_return('892')
609
- expect(Puppet).to receive(:send_log).with(:err, /Could not save last run local report.*892 is invalid/)
611
+ Puppet.settings.setting(:lastrunfile).expects(:mode).returns('892')
612
+ Puppet.expects(:send_log).with(:err, regexp_matches(/Could not save last run local report.*892 is invalid/))
610
613
  @configurer.save_last_run_summary(@report)
611
614
  end
612
615
  end
613
616
 
614
617
  describe "when requesting a node" do
615
618
  it "uses the transaction uuid in the request" do
616
- expect(Puppet::Node.indirection).to receive(:find).with(anything, hash_including(transaction_uuid: anything)).twice
619
+ Puppet::Node.indirection.expects(:find).with(anything, has_entries(:transaction_uuid => anything)).twice
617
620
  @agent.run
618
621
  end
619
622
 
620
623
  it "sends an explicitly configured environment request" do
621
- expect(Puppet.settings).to receive(:set_by_config?).with(:environment).and_return(true)
622
- expect(Puppet::Node.indirection).to receive(:find).with(anything, hash_including(configured_environment: Puppet[:environment])).twice
624
+ Puppet.settings.expects(:set_by_config?).with(:environment).returns(true)
625
+ Puppet::Node.indirection.expects(:find).with(anything, has_entries(:configured_environment => Puppet[:environment])).twice
623
626
  @agent.run
624
627
  end
625
628
 
626
629
  it "does not send a configured_environment when using the default" do
627
- expect(Puppet::Node.indirection).to receive(:find).with(anything, hash_including(configured_environment: nil)).twice
630
+ Puppet::Node.indirection.expects(:find).with(anything, has_entries(:configured_environment => nil)).twice
628
631
  @agent.run
629
632
  end
630
633
  end
631
634
 
632
635
  def expects_new_catalog_only(catalog)
633
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(catalog)
634
- expect(Puppet::Resource::Catalog.indirection).not_to receive(:find).with(anything, hash_including(ignore_terminus: true))
636
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns catalog
637
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never
635
638
  end
636
639
 
637
640
  def expects_cached_catalog_only(catalog)
638
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(catalog)
639
- expect(Puppet::Resource::Catalog.indirection).not_to receive(:find).with(anything, hash_including(ignore_cache: true))
641
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns catalog
642
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.never
640
643
  end
641
644
 
642
645
  def expects_fallback_to_cached_catalog(catalog)
643
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(nil)
644
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(catalog)
646
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
647
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns catalog
645
648
  end
646
649
 
647
650
  def expects_fallback_to_new_catalog(catalog)
648
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(nil)
649
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(catalog)
651
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
652
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns catalog
650
653
  end
651
654
 
652
655
  def expects_neither_new_or_cached_catalog
653
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(nil)
654
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(nil)
656
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
657
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
655
658
  end
656
659
 
657
660
  describe "when retrieving a catalog" do
658
661
  before do
659
- allow(Puppet.settings).to receive(:use).and_return(true)
660
- allow(@agent).to receive(:facts_for_uploading).and_return({})
661
- allow(@agent).to receive(:download_plugins)
662
+ Puppet.settings.stubs(:use).returns(true)
663
+ @agent.stubs(:facts_for_uploading).returns({})
664
+ @agent.stubs(:download_plugins)
662
665
 
663
666
  # retrieve a catalog in the current environment, so we don't try to converge unexpectedly
664
667
  @catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
665
668
 
666
669
  # this is the default when using a Configurer instance
667
- allow(Puppet::Resource::Catalog.indirection).to receive(:terminus_class).and_return(:rest)
670
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class).returns :rest
668
671
  end
669
672
 
670
673
  describe "and configured to only retrieve a catalog from the cache" do
@@ -679,17 +682,17 @@ describe Puppet::Configurer do
679
682
  end
680
683
 
681
684
  it "should not make a node request or pluginsync when a cached catalog is successfully retrieved" do
682
- expect(Puppet::Node.indirection).not_to receive(:find)
685
+ Puppet::Node.indirection.expects(:find).never
683
686
  expects_cached_catalog_only(@catalog)
684
- expect(@agent).not_to receive(:download_plugins)
687
+ @agent.expects(:download_plugins).never
685
688
 
686
689
  @agent.run
687
690
  end
688
691
 
689
692
  it "should make a node request and pluginsync when a cached catalog cannot be retrieved" do
690
- expect(Puppet::Node.indirection).to receive(:find).and_return(nil)
693
+ Puppet::Node.indirection.expects(:find).returns nil
691
694
  expects_fallback_to_new_catalog(@catalog)
692
- expect(@agent).to receive(:download_plugins)
695
+ @agent.expects(:download_plugins)
693
696
 
694
697
  @agent.run
695
698
  end
@@ -723,7 +726,7 @@ describe Puppet::Configurer do
723
726
  end
724
727
 
725
728
  it "should not attempt to retrieve a cached catalog again if the first attempt failed" do
726
- expect(Puppet::Node.indirection).to receive(:find).and_return(nil)
729
+ Puppet::Node.indirection.expects(:find).returns(nil)
727
730
  expects_neither_new_or_cached_catalog
728
731
 
729
732
  @agent.run
@@ -733,23 +736,23 @@ describe Puppet::Configurer do
733
736
  cached_catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote('second_env'))
734
737
  expects_cached_catalog_only(cached_catalog)
735
738
 
736
- expect(Puppet).to receive(:info).with("Using cached catalog from environment 'second_env'")
739
+ Puppet.expects(:info).with("Using cached catalog from environment 'second_env'")
737
740
  expect(@agent.retrieve_catalog({})).to eq(cached_catalog)
738
741
  end
739
742
  end
740
743
 
741
744
  describe "and strict environment mode is set" do
742
745
  before do
743
- allow(@catalog).to receive(:to_ral).and_return(@catalog)
744
- allow(@catalog).to receive(:write_class_file)
745
- allow(@catalog).to receive(:write_resource_file)
746
- allow(@agent).to receive(:send_report)
747
- allow(@agent).to receive(:save_last_run_summary)
746
+ @catalog.stubs(:to_ral).returns(@catalog)
747
+ @catalog.stubs(:write_class_file)
748
+ @catalog.stubs(:write_resource_file)
749
+ @agent.stubs(:send_report)
750
+ @agent.stubs(:save_last_run_summary)
748
751
  Puppet.settings[:strict_environment_mode] = true
749
752
  end
750
753
 
751
754
  it "should not make a node request" do
752
- expect(Puppet::Node.indirection).not_to receive(:find)
755
+ Puppet::Node.indirection.expects(:find).never
753
756
 
754
757
  @agent.run
755
758
  end
@@ -758,7 +761,7 @@ describe Puppet::Configurer do
758
761
  @agent.instance_variable_set(:@environment, 'second_env')
759
762
  expects_new_catalog_only(@catalog)
760
763
 
761
- expect(Puppet).to receive(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
764
+ Puppet.expects(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
762
765
  expect(@agent.run).to be_nil
763
766
  end
764
767
 
@@ -778,7 +781,7 @@ describe Puppet::Configurer do
778
781
  @agent.instance_variable_set(:@environment, 'second_env')
779
782
  expects_cached_catalog_only(@catalog)
780
783
 
781
- expect(Puppet).to receive(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
784
+ Puppet.expects(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
782
785
  expect(@agent.run).to be_nil
783
786
  end
784
787
 
@@ -793,28 +796,28 @@ describe Puppet::Configurer do
793
796
  end
794
797
 
795
798
  it "should use the Catalog class to get its catalog" do
796
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(@catalog)
799
+ Puppet::Resource::Catalog.indirection.expects(:find).returns @catalog
797
800
 
798
801
  @agent.retrieve_catalog({})
799
802
  end
800
803
 
801
804
  it "should set its cached_catalog_status to 'not_used' when downloading a new catalog" do
802
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(@catalog)
805
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
803
806
 
804
807
  @agent.retrieve_catalog({})
805
808
  expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('not_used')
806
809
  end
807
810
 
808
811
  it "should use its node_name_value to retrieve the catalog" do
809
- allow(Facter).to receive(:value).and_return("eh")
812
+ Facter.stubs(:value).returns "eh"
810
813
  Puppet.settings[:node_name_value] = "myhost.domain.com"
811
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with("myhost.domain.com", anything).and_return(@catalog)
814
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog
812
815
 
813
816
  @agent.retrieve_catalog({})
814
817
  end
815
818
 
816
819
  it "should default to returning a catalog retrieved directly from the server, skipping the cache" do
817
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(@catalog)
820
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
818
821
 
819
822
  expect(@agent.retrieve_catalog({})).to eq(@catalog)
820
823
  end
@@ -822,7 +825,7 @@ describe Puppet::Configurer do
822
825
  it "should log and return the cached catalog when no catalog can be retrieved from the server" do
823
826
  expects_fallback_to_cached_catalog(@catalog)
824
827
 
825
- expect(Puppet).to receive(:info).with("Using cached catalog from environment 'production'")
828
+ Puppet.expects(:info).with("Using cached catalog from environment 'production'")
826
829
  expect(@agent.retrieve_catalog({})).to eq(@catalog)
827
830
  end
828
831
 
@@ -840,15 +843,15 @@ describe Puppet::Configurer do
840
843
  end
841
844
 
842
845
  it "should return the cached catalog when retrieving the remote catalog throws an exception" do
843
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_raise("eh")
844
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(@catalog)
846
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
847
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
845
848
 
846
849
  expect(@agent.retrieve_catalog({})).to eq(@catalog)
847
850
  end
848
851
 
849
852
  it "should set its cached_catalog_status to 'on_failure' when retrieving the remote catalog throws an exception" do
850
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_raise("eh")
851
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_terminus: true)).and_return(@catalog)
853
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
854
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
852
855
 
853
856
  @agent.retrieve_catalog({})
854
857
  expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('on_failure')
@@ -856,16 +859,16 @@ describe Puppet::Configurer do
856
859
 
857
860
  it "should log and return nil if no catalog can be retrieved from the server and :usecacheonfailure is disabled" do
858
861
  Puppet[:usecacheonfailure] = false
859
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(nil)
862
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
860
863
 
861
- expect(Puppet).to receive(:warning).with('Not using cache on failed catalog')
864
+ Puppet.expects(:warning).with('Not using cache on failed catalog')
862
865
 
863
866
  expect(@agent.retrieve_catalog({})).to be_nil
864
867
  end
865
868
 
866
869
  it "should set its cached_catalog_status to 'not_used' if no catalog can be retrieved from the server and :usecacheonfailure is disabled or fails to retrieve a catalog" do
867
870
  Puppet[:usecacheonfailure] = false
868
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true)).and_return(nil)
871
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
869
872
 
870
873
  @agent.retrieve_catalog({})
871
874
  expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('not_used')
@@ -883,7 +886,7 @@ describe Puppet::Configurer do
883
886
 
884
887
  expects_fallback_to_cached_catalog(cached_catalog)
885
888
 
886
- expect(Puppet).to receive(:err).with("Not using cached catalog because its environment 'second_env' does not match 'production'")
889
+ Puppet.expects(:err).with("Not using cached catalog because its environment 'second_env' does not match 'production'")
887
890
  expect(@agent.retrieve_catalog({})).to be_nil
888
891
  end
889
892
 
@@ -918,14 +921,14 @@ describe Puppet::Configurer do
918
921
 
919
922
  it "should not update the cached catalog in noop mode" do
920
923
  Puppet[:noop] = true
921
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true, ignore_cache_save: true)).and_return(@catalog)
924
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:ignore_cache => true, :ignore_cache_save => true)).returns(@catalog)
922
925
 
923
926
  @agent.retrieve_catalog({})
924
927
  end
925
928
 
926
929
  it "should update the cached catalog when not in noop mode" do
927
930
  Puppet[:noop] = false
928
- expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, hash_including(ignore_cache: true, ignore_cache_save: false)).and_return(@catalog)
931
+ Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:ignore_cache => true, :ignore_cache_save => false)).returns(@catalog)
929
932
 
930
933
  @agent.retrieve_catalog({})
931
934
  end
@@ -933,9 +936,9 @@ describe Puppet::Configurer do
933
936
 
934
937
  describe "when converting the catalog" do
935
938
  before do
936
- allow(Puppet.settings).to receive(:use).and_return(true)
939
+ Puppet.settings.stubs(:use).returns(true)
937
940
 
938
- allow(catalog).to receive(:to_ral).and_return(ral_catalog)
941
+ catalog.stubs(:to_ral).returns ral_catalog
939
942
  end
940
943
 
941
944
  let (:catalog) { Puppet::Resource::Catalog.new('tester', Puppet::Node::Environment.remote(Puppet[:environment].to_sym)) }
@@ -946,25 +949,25 @@ describe Puppet::Configurer do
946
949
  end
947
950
 
948
951
  it "should finalize the catalog" do
949
- expect(ral_catalog).to receive(:finalize)
952
+ ral_catalog.expects(:finalize)
950
953
 
951
954
  @agent.convert_catalog(catalog, 10)
952
955
  end
953
956
 
954
957
  it "should record the passed retrieval time with the RAL catalog" do
955
- expect(ral_catalog).to receive(:retrieval_duration=).with(10)
958
+ ral_catalog.expects(:retrieval_duration=).with 10
956
959
 
957
960
  @agent.convert_catalog(catalog, 10)
958
961
  end
959
962
 
960
963
  it "should write the RAL catalog's class file" do
961
- expect(ral_catalog).to receive(:write_class_file)
964
+ ral_catalog.expects(:write_class_file)
962
965
 
963
966
  @agent.convert_catalog(catalog, 10)
964
967
  end
965
968
 
966
969
  it "should write the RAL catalog's resource file" do
967
- expect(ral_catalog).to receive(:write_resource_file)
970
+ ral_catalog.expects(:write_resource_file)
968
971
 
969
972
  @agent.convert_catalog(catalog, 10)
970
973
  end
@@ -972,7 +975,7 @@ describe Puppet::Configurer do
972
975
  it "should set catalog conversion time on the report" do
973
976
  report = Puppet::Transaction::Report.new
974
977
 
975
- expect(report).to receive(:add_times).with(:convert_catalog, kind_of(Numeric))
978
+ report.expects(:add_times).with(:convert_catalog, kind_of(Numeric))
976
979
  @agent.convert_catalog(catalog, 10, {:report => report})
977
980
  end
978
981
  end
@@ -994,22 +997,22 @@ describe Puppet::Configurer do
994
997
  describe "when attempting failover" do
995
998
  it "should not failover if server_list is not set" do
996
999
  Puppet.settings[:server_list] = []
997
- expect(@agent).not_to receive(:find_functional_server)
1000
+ @agent.expects(:find_functional_server).never
998
1001
  @agent.run
999
1002
  end
1000
1003
 
1001
1004
  it "should not failover during an apply run" do
1002
1005
  Puppet.settings[:server_list] = ["myserver:123"]
1003
- expect(@agent).not_to receive(:find_functional_server)
1006
+ @agent.expects(:find_functional_server).never
1004
1007
  catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
1005
1008
  @agent.run :catalog => catalog
1006
1009
  end
1007
1010
 
1008
- it "should select a server when it receives 200 OK response" do
1011
+ it "should select a server when provided" do
1009
1012
  Puppet.settings[:server_list] = ["myserver:123"]
1010
1013
  response = Net::HTTPOK.new(nil, 200, 'OK')
1011
- allow(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('myserver', '123').and_return(double('request', get: response))
1012
- allow(@agent).to receive(:run_internal)
1014
+ Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
1015
+ @agent.stubs(:run_internal)
1013
1016
 
1014
1017
  options = {}
1015
1018
  @agent.run(options)
@@ -1019,10 +1022,10 @@ describe Puppet::Configurer do
1019
1022
  it "queries the simple status for the 'master' service" do
1020
1023
  Puppet.settings[:server_list] = ["myserver:123"]
1021
1024
  response = Net::HTTPOK.new(nil, 200, 'OK')
1022
- http = double('request')
1023
- expect(http).to receive(:get).with('/status/v1/simple/master').and_return(response)
1024
- allow(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('myserver', '123').and_return(http)
1025
- allow(@agent).to receive(:run_internal)
1025
+ http = mock('request')
1026
+ http.expects(:get).with('/status/v1/simple/master').returns(response)
1027
+ Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(http)
1028
+ @agent.stubs(:run_internal)
1026
1029
 
1027
1030
  @agent.run
1028
1031
  end
@@ -1030,27 +1033,28 @@ describe Puppet::Configurer do
1030
1033
  it "should report when a server is unavailable" do
1031
1034
  Puppet.settings[:server_list] = ["myserver:123"]
1032
1035
  response = Net::HTTPInternalServerError.new(nil, 500, 'Internal Server Error')
1033
- allow(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('myserver', '123').and_return(double('request', get: response))
1036
+ Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
1037
+ @agent.stubs(:run_internal)
1034
1038
 
1035
- expect(Puppet).to receive(:debug).with("Puppet server myserver:123 is unavailable: 500 Internal Server Error")
1036
- expect{ @agent.run }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list/)
1039
+ Puppet.expects(:debug).with("Puppet server myserver:123 is unavailable: 500 Internal Server Error")
1040
+ @agent.run
1037
1041
  end
1038
1042
 
1039
- it "should error when no servers in 'server_list' are reachable" do
1043
+ it "should fallback to an empty server when failover fails" do
1040
1044
  Puppet.settings[:server_list] = ["myserver:123"]
1041
1045
  error = Net::HTTPError.new(400, 'dummy server communication error')
1042
- allow(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('myserver', '123').and_return(double('request', get: error))
1046
+ Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(error)
1047
+ @agent.stubs(:run_internal)
1043
1048
 
1044
1049
  options = {}
1045
- expect{ @agent.run(options) }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list/)
1050
+ @agent.run(options)
1046
1051
  expect(options[:report].master_used).to be_nil
1047
1052
  end
1048
1053
 
1049
1054
  it "should not make multiple node requets when the server is found" do
1050
1055
  Puppet.settings[:server_list] = ["myserver:123"]
1051
- response = Net::HTTPOK.new(nil, 200, 'OK')
1052
- allow(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('myserver', '123').and_return(double('request', get: response))
1053
- allow(@agent).to receive(:run_internal)
1056
+ Puppet::Network::HttpPool.expects(:http_ssl_instance).once
1057
+ @agent.stubs(:run_internal)
1054
1058
 
1055
1059
  @agent.run
1056
1060
  end