beaker 4.38.1 → 4.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +12 -0
  3. data/.rubocop.yml +62 -0
  4. data/.rubocop_todo.yml +215 -0
  5. data/CHANGELOG.md +72 -33
  6. data/Gemfile +8 -1
  7. data/HISTORY.md +103 -0
  8. data/Rakefile +10 -9
  9. data/acceptance/fixtures/module/Gemfile +1 -1
  10. data/acceptance/fixtures/module/Rakefile +2 -2
  11. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -11
  12. data/acceptance/fixtures/module/spec/classes/init_spec.rb +1 -1
  13. data/acceptance/lib/helpers/test_helper.rb +3 -3
  14. data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +6 -6
  15. data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +6 -6
  16. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +6 -12
  17. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +4 -4
  18. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +1 -1
  19. data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +7 -7
  20. data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +4 -4
  21. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +4 -4
  22. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +8 -11
  23. data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +2 -2
  24. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +6 -11
  25. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +5 -9
  26. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +2 -2
  27. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +1 -1
  28. data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +4 -4
  29. data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +1 -1
  30. data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +1 -1
  31. data/acceptance/tests/base/dsl/structure_test.rb +4 -10
  32. data/acceptance/tests/base/host/file_test.rb +7 -7
  33. data/acceptance/tests/base/host/group_test.rb +2 -2
  34. data/acceptance/tests/base/host/host_test.rb +5 -5
  35. data/acceptance/tests/base/host/packages.rb +26 -28
  36. data/acceptance/tests/base/host/packages_unix.rb +4 -4
  37. data/acceptance/tests/base/host/user_test.rb +2 -2
  38. data/acceptance/tests/install/from_file.rb +2 -2
  39. data/beaker.gemspec +9 -9
  40. data/docs/concepts/style_guide.md +1 -1
  41. data/docs/how_to/debug_beaker_tests.md +1 -1
  42. data/docs/how_to/test_arbitrary_beaker_versions.md +2 -2
  43. data/lib/beaker/cli.rb +6 -8
  44. data/lib/beaker/command.rb +3 -3
  45. data/lib/beaker/command_factory.rb +2 -2
  46. data/lib/beaker/dsl/assertions.rb +1 -1
  47. data/lib/beaker/dsl/helpers/hocon_helpers.rb +2 -2
  48. data/lib/beaker/dsl/helpers/host_helpers.rb +11 -11
  49. data/lib/beaker/dsl/helpers/web_helpers.rb +3 -3
  50. data/lib/beaker/dsl/outcomes.rb +4 -4
  51. data/lib/beaker/dsl/roles.rb +2 -2
  52. data/lib/beaker/dsl/structure.rb +10 -10
  53. data/lib/beaker/host/aix/group.rb +3 -3
  54. data/lib/beaker/host/aix/user.rb +3 -3
  55. data/lib/beaker/host/cisco.rb +11 -11
  56. data/lib/beaker/host/eos.rb +2 -2
  57. data/lib/beaker/host/mac/exec.rb +1 -1
  58. data/lib/beaker/host/mac/group.rb +7 -7
  59. data/lib/beaker/host/mac/pkg.rb +6 -6
  60. data/lib/beaker/host/mac/user.rb +6 -6
  61. data/lib/beaker/host/pswindows/exec.rb +8 -8
  62. data/lib/beaker/host/pswindows/file.rb +1 -1
  63. data/lib/beaker/host/pswindows/group.rb +3 -3
  64. data/lib/beaker/host/pswindows/pkg.rb +6 -6
  65. data/lib/beaker/host/pswindows/user.rb +2 -2
  66. data/lib/beaker/host/unix/exec.rb +6 -6
  67. data/lib/beaker/host/unix/file.rb +3 -4
  68. data/lib/beaker/host/unix/group.rb +3 -3
  69. data/lib/beaker/host/unix/pkg.rb +17 -17
  70. data/lib/beaker/host/unix/user.rb +3 -3
  71. data/lib/beaker/host/unix.rb +10 -9
  72. data/lib/beaker/host/windows/exec.rb +3 -3
  73. data/lib/beaker/host/windows/file.rb +2 -2
  74. data/lib/beaker/host/windows/group.rb +3 -3
  75. data/lib/beaker/host/windows/pkg.rb +6 -6
  76. data/lib/beaker/host/windows/user.rb +2 -2
  77. data/lib/beaker/host/windows.rb +2 -2
  78. data/lib/beaker/host.rb +7 -7
  79. data/lib/beaker/host_prebuilt_steps.rb +38 -45
  80. data/lib/beaker/hypervisor.rb +4 -4
  81. data/lib/beaker/local_connection.rb +3 -3
  82. data/lib/beaker/logger.rb +5 -11
  83. data/lib/beaker/logger_junit.rb +2 -2
  84. data/lib/beaker/network_manager.rb +2 -2
  85. data/lib/beaker/options/command_line_parser.rb +1 -1
  86. data/lib/beaker/options/hosts_file_parser.rb +21 -4
  87. data/lib/beaker/options/options_file_parser.rb +1 -1
  88. data/lib/beaker/options/options_hash.rb +1 -3
  89. data/lib/beaker/options/parser.rb +6 -6
  90. data/lib/beaker/options/presets.rb +2 -2
  91. data/lib/beaker/options/validator.rb +2 -2
  92. data/lib/beaker/perf.rb +9 -9
  93. data/lib/beaker/platform.rb +1 -1
  94. data/lib/beaker/shared/host_manager.rb +4 -5
  95. data/lib/beaker/shared/repetition.rb +4 -4
  96. data/lib/beaker/shared/semvar.rb +2 -2
  97. data/lib/beaker/shared/timed.rb +2 -2
  98. data/lib/beaker/ssh_connection.rb +9 -9
  99. data/lib/beaker/subcommand.rb +6 -6
  100. data/lib/beaker/tasks/quick_start.rb +2 -2
  101. data/lib/beaker/tasks/rake_task.rb +3 -3
  102. data/lib/beaker/test_suite.rb +2 -2
  103. data/lib/beaker/test_suite_result.rb +8 -11
  104. data/lib/beaker/version.rb +1 -1
  105. data/spec/beaker/cli_spec.rb +46 -43
  106. data/spec/beaker/command_spec.rb +17 -7
  107. data/spec/beaker/dsl/assertions_spec.rb +2 -11
  108. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +7 -7
  109. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +2 -2
  110. data/spec/beaker/dsl/outcomes_spec.rb +1 -0
  111. data/spec/beaker/dsl/roles_spec.rb +48 -5
  112. data/spec/beaker/dsl/structure_spec.rb +22 -15
  113. data/spec/beaker/dsl/test_tagging_spec.rb +16 -16
  114. data/spec/beaker/dsl/wrappers_spec.rb +7 -7
  115. data/spec/beaker/host/cisco_spec.rb +8 -8
  116. data/spec/beaker/host/freebsd/exec_spec.rb +3 -3
  117. data/spec/beaker/host/freebsd/pkg_spec.rb +6 -3
  118. data/spec/beaker/host/mac/exec_spec.rb +3 -3
  119. data/spec/beaker/host/mac_spec.rb +6 -6
  120. data/spec/beaker/host/pswindows/exec_spec.rb +8 -5
  121. data/spec/beaker/host/pswindows/file_spec.rb +6 -3
  122. data/spec/beaker/host/pswindows_spec.rb +1 -1
  123. data/spec/beaker/host/unix/exec_spec.rb +24 -24
  124. data/spec/beaker/host/unix/file_spec.rb +18 -17
  125. data/spec/beaker/host/unix/pkg_spec.rb +26 -22
  126. data/spec/beaker/host/unix_spec.rb +8 -8
  127. data/spec/beaker/host/windows/exec_spec.rb +4 -4
  128. data/spec/beaker/host/windows/file_spec.rb +4 -4
  129. data/spec/beaker/host/windows/group_spec.rb +12 -12
  130. data/spec/beaker/host/windows/pkg_spec.rb +5 -5
  131. data/spec/beaker/host_prebuilt_steps_spec.rb +26 -20
  132. data/spec/beaker/host_spec.rb +72 -63
  133. data/spec/beaker/hypervisor/hypervisor_spec.rb +14 -14
  134. data/spec/beaker/localhost_connection_spec.rb +6 -4
  135. data/spec/beaker/logger_junit_spec.rb +16 -17
  136. data/spec/beaker/logger_spec.rb +54 -52
  137. data/spec/beaker/network_manager_spec.rb +5 -5
  138. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  139. data/spec/beaker/options/data/hosts_preserved.yml +395 -0
  140. data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
  141. data/spec/beaker/options/options_file_parser_spec.rb +1 -1
  142. data/spec/beaker/options/options_hash_spec.rb +4 -4
  143. data/spec/beaker/options/parser_spec.rb +23 -23
  144. data/spec/beaker/options/presets_spec.rb +2 -2
  145. data/spec/beaker/options/subcommand_options_parser_spec.rb +4 -3
  146. data/spec/beaker/options/validator_spec.rb +18 -18
  147. data/spec/beaker/perf_spec.rb +29 -28
  148. data/spec/beaker/platform_spec.rb +3 -2
  149. data/spec/beaker/shared/error_handler_spec.rb +1 -1
  150. data/spec/beaker/shared/fog_credentials_spec.rb +12 -12
  151. data/spec/beaker/shared/host_manager_spec.rb +7 -7
  152. data/spec/beaker/shared/repetition_spec.rb +9 -9
  153. data/spec/beaker/ssh_connection_spec.rb +14 -12
  154. data/spec/beaker/subcommand/subcommand_util_spec.rb +9 -4
  155. data/spec/beaker/subcommand_spec.rb +30 -28
  156. data/spec/beaker/test_case_spec.rb +11 -15
  157. data/spec/beaker/test_suite_spec.rb +24 -24
  158. data/spec/matchers.rb +1 -1
  159. data/spec/mocks.rb +5 -5
  160. data/spec/spec_helper.rb +0 -3
  161. metadata +59 -59
  162. data/spec/mock_fission.rb +0 -60
  163. data/spec/mock_vsphere.rb +0 -314
  164. data/spec/mock_vsphere_helper.rb +0 -183
@@ -0,0 +1,395 @@
1
+ --- !ruby/hash:Beaker::Options::OptionsHash
2
+ :project: Beaker
3
+ :department: unknown
4
+ :created_by: rspec
5
+ :host_tags: !ruby/hash:Beaker::Options::OptionsHash {}
6
+ :openstack_api_key:
7
+ :openstack_username:
8
+ :openstack_auth_url: "/tokens"
9
+ :openstack_tenant:
10
+ :openstack_keyname:
11
+ :openstack_network:
12
+ :openstack_region:
13
+ :openstack_volume_support: true
14
+ :jenkins_build_url:
15
+ :validate: true
16
+ :configure: true
17
+ :log_level: debug
18
+ :trace_limit: 10
19
+ :master-start-curl-retries: 120
20
+ :masterless: false
21
+ :options_file:
22
+ :type: pe
23
+ :provision: true
24
+ :preserve_hosts: always
25
+ :root_keys: false
26
+ :quiet: false
27
+ :project_root: "/path/to/project"
28
+ :xml_dir: junit
29
+ :xml_file: beaker_junit.xml
30
+ :xml_time: beaker_times.xml
31
+ :xml_time_enabled: false
32
+ :xml_stylesheet: junit.xsl
33
+ :default_log_prefix: beaker_logs
34
+ :log_dir: log
35
+ :log_sut_event: sut.log
36
+ :color: true
37
+ :dry_run: false
38
+ :test_tag_and: &3 []
39
+ :test_tag_or: &4 []
40
+ :test_tag_exclude: &5 []
41
+ :timeout: 900
42
+ :fail_mode: slow
43
+ :test_results_file: ''
44
+ :accept_all_exit_codes: false
45
+ :timesync: false
46
+ :disable_iptables: false
47
+ :set_env: true
48
+ :disable_updates: true
49
+ :repo_proxy: false
50
+ :package_proxy: false
51
+ :add_el_extras: false
52
+ :epel_url: http://dl.fedoraproject.org/pub/epel
53
+ :consoleport: 443
54
+ :pe_dir: "/opt/enterprise/dists"
55
+ :pe_version_file: LATEST
56
+ :pe_version_file_win: LATEST-win
57
+ :host_env: !ruby/hash:Beaker::Options::OptionsHash {}
58
+ :host_name_prefix:
59
+ :ssh_env_file: "~/.ssh/environment"
60
+ :profile_d_env_file: "/etc/profile.d/beaker_env.sh"
61
+ :dot_fog: "/home/user/.fog"
62
+ :ec2_yaml: config/image_templates/ec2.yaml
63
+ :help: false
64
+ :collect_perf_data: none
65
+ :puppetdb_port_ssl: 8081
66
+ :puppetdb_port_nonssl: 8080
67
+ :puppetserver_port: 8140
68
+ :nodeclassifier_port: 4433
69
+ :cache_files_locally: false
70
+ :aws_keyname_modifier: '1234567890'
71
+ :run_in_parallel: &6 []
72
+ :use_fog_credentials: true
73
+ :ssh: !ruby/hash:Beaker::Options::OptionsHash
74
+ :config: true
75
+ :verify_host_key: false
76
+ :auth_methods: &7
77
+ - publickey
78
+ :port: 22
79
+ :forward_agent: 'true'
80
+ :keys: &8
81
+ - "/home/user/.ssh/id_rsa"
82
+ :user_known_hosts_file: "/home/user/.ssh/known_hosts"
83
+ :keepalive: true
84
+ :logger: &9 !ruby/object:Logger
85
+ level: 4
86
+ progname:
87
+ default_formatter: !ruby/object:Logger::Formatter
88
+ datetime_format:
89
+ formatter:
90
+ logdev: !ruby/object:Logger::LogDevice
91
+ shift_period_suffix:
92
+ shift_size:
93
+ shift_age:
94
+ filename:
95
+ dev: !ruby/object:IO {}
96
+ binmode: false
97
+ mon_data: !ruby/object:Monitor {}
98
+ mon_data_owner_object_id: 4980
99
+ :password_prompt: &10 !ruby/object:Net::SSH::Prompt {}
100
+ :user: root
101
+ :helper: &11
102
+ - lib/beaker_helper.rb
103
+ :keyfile: "/home/user/.ssh/id_rsa"
104
+ :hosts_file: "/path/to/hosts.cfg"
105
+ :pre_suite: &12 []
106
+ :command_line: "/path/to/beaker
107
+ --helper lib/beaker_helper.rb --debug --keyfile /home/user/.ssh/id_rsa
108
+ --hosts=hosts.cfg --pre-suite=setup/install.rb"
109
+ :HOSTS:
110
+ primary.host: !ruby/hash:Beaker::Options::OptionsHash
111
+ :pe_dir: https://where.we.keep.pe
112
+ :pe_ver: 2021.5.0
113
+ :pe_upgrade_dir: https://where.we.keep.pe/upgrade
114
+ :pe_upgrade_ver: 2021.7.0
115
+ :platform: &1 !ruby/string:Beaker::Platform
116
+ str: el-7-x86_64
117
+ variant: !ruby/string:Beaker::Platform el
118
+ arch: !ruby/string:Beaker::Platform x86_64
119
+ version: !ruby/string:Beaker::Platform '7'
120
+ codename:
121
+ :template: redhat-7-x86_64
122
+ :hypervisor: vmpooler
123
+ :roles:
124
+ - agent
125
+ - master
126
+ - dashboard
127
+ - database
128
+ - default
129
+ :host_tags: !ruby/hash:Beaker::Options::OptionsHash {}
130
+ :user: root
131
+ :group: puppet
132
+ :pathseparator: ":"
133
+ :packaging_platform: *1
134
+ :ssh_connection_preference:
135
+ - :ip
136
+ - :vmhostname
137
+ - :hostname
138
+ :vmhostname: primary.host
139
+ :ip:
140
+ :puppetserver-confdir: "/etc/puppetlabs/puppetserver/conf.d"
141
+ :puppetservice: pe-puppetserver
142
+ :puppetpath: "/etc/puppetlabs/puppet"
143
+ :puppetconfdir: "/etc/puppetlabs/puppet"
144
+ :puppetbin: "/opt/puppet/bin/puppet"
145
+ :puppetbindir: "/opt/puppetlabs/bin"
146
+ :puppetsbindir: "/opt/puppet/sbin"
147
+ :privatebindir: "/opt/puppetlabs/puppet/bin"
148
+ :puppetvardir: "/var/opt/lib/pe-puppet"
149
+ :hieradatadir: "/var/lib/hiera"
150
+ :hieraconf: "/etc/puppetlabs/puppet/hiera.yaml"
151
+ :distmoduledir: "/etc/puppetlabs/code/modules"
152
+ :sitemoduledir: "/opt/puppetlabs/puppet/modules"
153
+ :type: pe
154
+ :pe_installer: puppet-enterprise-installer
155
+ :dist: puppet-enterprise-2021.5.0-el-7-x86_64
156
+ :working_dir: "/tmp/workingdir"
157
+ :pe_installer_conf_file: "/tmp/workingdir/pe.conf"
158
+ :pe_installer_conf_setting: "-c /tmp/workingdir/pe.conf"
159
+ :answers: !ruby/hash:Beaker::Options::OptionsHash
160
+ :q_install: y
161
+ :q_vendor_packages_install: y
162
+ :q_puppetagent_install: y
163
+ :q_verify_packages: y
164
+ :q_puppet_symlinks_install: y
165
+ :q_puppetagent_certname: primary.host
166
+ :q_puppetmaster_install: y
167
+ :q_all_in_one_install: y
168
+ :q_puppet_enterpriseconsole_install: y
169
+ :q_puppetdb_install: y
170
+ :q_database_install: y
171
+ :q_puppetagent_server: primary.host
172
+ :q_puppetdb_hostname: primary.host
173
+ :q_puppetdb_port: 8081
174
+ :q_puppetmaster_dnsaltnames: primary.host,puppet
175
+ :q_puppetmaster_enterpriseconsole_hostname: primary.host
176
+ :q_puppetmaster_enterpriseconsole_port: 443
177
+ :q_puppetmaster_certname: primary.host
178
+ :q_puppetdb_database_name: pe-puppetdb
179
+ :q_puppetdb_database_user: pdb_user
180
+ :q_puppetdb_database_password: "''"
181
+ :q_puppet_enterpriseconsole_auth_database_name: console_auth
182
+ :q_puppet_enterpriseconsole_auth_database_user: console_auth_user
183
+ :q_puppet_enterpriseconsole_auth_database_password: "''"
184
+ :q_puppet_enterpriseconsole_database_name: console
185
+ :q_puppet_enterpriseconsole_database_user: console_database_user
186
+ :q_puppet_enterpriseconsole_database_password: "''"
187
+ :q_database_host: primary.host
188
+ :q_database_port:
189
+ :q_pe_database: y
190
+ :q_puppet_enterpriseconsole_inventory_hostname: primary.host
191
+ :q_puppet_enterpriseconsole_inventory_certname: primary.host
192
+ :q_puppet_enterpriseconsole_inventory_dnsaltnames: primary.host
193
+ :q_puppet_enterpriseconsole_inventory_port: 8140
194
+ :q_puppet_enterpriseconsole_master_hostname: primary.host
195
+ :q_puppet_enterpriseconsole_auth_user_email: "''"
196
+ :q_puppet_enterpriseconsole_auth_password: "''"
197
+ :q_puppet_enterpriseconsole_httpd_port: 443
198
+ :q_puppet_enterpriseconsole_smtp_host: "'primary.host'"
199
+ :q_puppet_enterpriseconsole_smtp_use_tls: "''"
200
+ :q_puppet_enterpriseconsole_smtp_port: "''"
201
+ :q_database_root_password: "'supersecurepassword'"
202
+ :q_database_root_user: pe-postgres
203
+ :q_pe_check_for_updates: n
204
+ :q_classifier_database_user: classifier_user
205
+ :q_classifier_database_name: pe-classifier
206
+ :q_classifier_database_password: "''"
207
+ :q_activity_database_user: activity_user
208
+ :q_activity_database_name: pe-activity
209
+ :q_activity_database_password: "''"
210
+ :q_rbac_database_user: rbac_user
211
+ :q_rbac_database_name: pe-rbac
212
+ :q_rbac_database_password: "''"
213
+ :q_exit_for_nc_migrate: n
214
+ :q_enable_future_parser: n
215
+ :q_update_server_host: primary.host
216
+ :q_install_update_server: y
217
+ :q_orchestrator_database_name:
218
+ :q_orchestrator_database_user:
219
+ :q_orchestrator_database_password: "''"
220
+ :q_use_application_services: y
221
+ :nfs_server: none
222
+ :forge_host: forge.puppet.com
223
+ :pooling_api: https://pooler.host
224
+ :home: "/home/user"
225
+ :load_path: &13 []
226
+ :tests: &14 []
227
+ :post_suite: &15 []
228
+ :install: &16 []
229
+ :pre_cleanup: &17 []
230
+ :modules: &18 []
231
+ :logger: !ruby/object:Beaker::Logger
232
+ color: true
233
+ sublog: &2 !ruby/object:StringIO {}
234
+ log_level: :debug
235
+ last_result: !ruby/object:Beaker::Result
236
+ host: redhat7-64-1
237
+ cmd: puppet agent -t
238
+ stdout: "Things happened here"
239
+ stderr: ''
240
+ output: "Things happened here"
241
+ exit_code: 2
242
+ raw_stdout: "Things happened here"
243
+ raw_stderr: ''
244
+ raw_output: "Things happened here"
245
+ line_prefix: ''
246
+ destinations:
247
+ - !ruby/object:IO {}
248
+ - *2
249
+ log_colors:
250
+ :error: "\e[00;31m"
251
+ :warn: "\e[01;31m"
252
+ :success: "\e[00;35m"
253
+ :notify: "\e[00;34m"
254
+ :info: "\e[00;32m"
255
+ :debug: "\e[00;37m"
256
+ :trace: "\e[01;33m"
257
+ :perf: "\e[01;35m"
258
+ :host: "\e[00;33m"
259
+ :timestamp: 2022-07-28 21:06:27.978864297 +00:00
260
+ :beaker_version: 4.37.1
261
+ :log_prefix: hosts.cfg
262
+ :xml_dated_dir: junit/hosts.cfg/2022-07-28_21_06_27
263
+ :log_dated_dir: log/hosts.cfg/2022-07-28_21_06_27
264
+ :logger_sut: !ruby/object:Beaker::Logger
265
+ color:
266
+ sublog:
267
+ log_level: :verbose
268
+ last_result:
269
+ line_prefix: ''
270
+ destinations:
271
+ - !ruby/object:File {}
272
+ log_colors:
273
+ :error: "\e[00;31m"
274
+ :warn: "\e[01;31m"
275
+ :success: "\e[00;35m"
276
+ :notify: "\e[00;34m"
277
+ :info: "\e[00;32m"
278
+ :debug: "\e[00;37m"
279
+ :trace: "\e[01;33m"
280
+ :perf: "\e[01;35m"
281
+ :host: "\e[00;33m"
282
+ :net_diag_hosts: &19
283
+ - https://host1
284
+ - https://host2
285
+ - http://host3
286
+ - https://host4
287
+ :answers:
288
+ puppet_enterprise::master::recover_configuration::recover_configuration_interval: 0
289
+ :feature_flags: !ruby/hash:StringifyHash {}
290
+ :CONFIG: !ruby/hash:Beaker::Options::OptionsHash
291
+ :project: Beaker
292
+ :department: unknown
293
+ :created_by: user
294
+ :host_tags: !ruby/hash:Beaker::Options::OptionsHash {}
295
+ :openstack_api_key:
296
+ :openstack_username:
297
+ :openstack_auth_url: "/tokens"
298
+ :openstack_tenant:
299
+ :openstack_keyname:
300
+ :openstack_network:
301
+ :openstack_region:
302
+ :openstack_volume_support: true
303
+ :jenkins_build_url:
304
+ :validate: true
305
+ :configure: true
306
+ :log_level: debug
307
+ :trace_limit: 10
308
+ :master-start-curl-retries: 120
309
+ :masterless: false
310
+ :options_file:
311
+ :type: pe
312
+ :provision: false
313
+ :preserve_hosts: always
314
+ :root_keys: false
315
+ :quiet: false
316
+ :project_root: "/path/to/project"
317
+ :xml_dir: junit
318
+ :xml_file: beaker_junit.xml
319
+ :xml_time: beaker_times.xml
320
+ :xml_time_enabled: false
321
+ :xml_stylesheet: junit.xsl
322
+ :log_dir: log
323
+ :log_sut_event: sut.log
324
+ :color: true
325
+ :dry_run: false
326
+ :test_tag_and: *3
327
+ :test_tag_or: *4
328
+ :test_tag_exclude: *5
329
+ :timeout: 900
330
+ :fail_mode: slow
331
+ :test_results_file: ''
332
+ :accept_all_exit_codes: false
333
+ :timesync: false
334
+ :disable_iptables: false
335
+ :set_env: true
336
+ :disable_updates: true
337
+ :repo_proxy: false
338
+ :package_proxy: false
339
+ :add_el_extras: false
340
+ :epel_url: http://dl.fedoraproject.org/pub/epel
341
+ :consoleport: 443
342
+ :pe_dir: "/opt/enterprise/dists"
343
+ :pe_version_file: LATEST
344
+ :pe_version_file_win: LATEST-win
345
+ :host_env: !ruby/hash:Beaker::Options::OptionsHash {}
346
+ :host_name_prefix:
347
+ :ssh_env_file: "~/.ssh/environment"
348
+ :profile_d_env_file: "/etc/profile.d/beaker_env.sh"
349
+ :dot_fog: "/home/user/.fog"
350
+ :ec2_yaml: config/image_templates/ec2.yaml
351
+ :help: false
352
+ :collect_perf_data: none
353
+ :puppetdb_port_ssl: 8081
354
+ :puppetdb_port_nonssl: 8080
355
+ :puppetserver_port: 8140
356
+ :nodeclassifier_port: 4433
357
+ :cache_files_locally: false
358
+ :aws_keyname_modifier: '1234567890'
359
+ :run_in_parallel: *6
360
+ :use_fog_credentials: true
361
+ :ssh: !ruby/hash:Beaker::Options::OptionsHash
362
+ :config: true
363
+ :verify_host_key: false
364
+ :auth_methods: *7
365
+ :port: 22
366
+ :forward_agent: 'true'
367
+ :keys: *8
368
+ :user_known_hosts_file: "/home/user/.ssh/known_hosts"
369
+ :keepalive: true
370
+ :logger: *9
371
+ :password_prompt: *10
372
+ :user: root
373
+ :helper: *11
374
+ :keyfile: "/home/user/.ssh/id_rsa"
375
+ :hosts_file: "/path/to/hosts.cfg"
376
+ :pre_suite: *12
377
+ :command_line: "/path/to/beaker
378
+ --helper lib/beaker_helper.rb --debug --keyfile /home/user/.ssh/id_rsa
379
+ --hosts=hosts.cfg --pre-suite=setup/install.rb"
380
+ :nfs_server: none
381
+ :forge_host: forge.puppet.com
382
+ :pooling_api: https://pooler.host
383
+ :home: "/home/user"
384
+ :load_path: *13
385
+ :tests: *14
386
+ :post_suite: *15
387
+ :install: *16
388
+ :pre_cleanup: *17
389
+ :modules: *18
390
+ :beaker_version: 4.37.1
391
+ :net_diag_hosts: *19
392
+ :answers: !ruby/hash:Beaker::Options::OptionsHash
393
+ :puppet_enterprise::master::recover_configuration::recover_configuration_interval: 0
394
+ :feature_flags: !ruby/hash:Beaker::Options::OptionsHash {}
395
+ :CONFIG: !ruby/hash:Beaker::Options::OptionsHash {}
@@ -4,8 +4,9 @@ module Beaker
4
4
  module Options
5
5
  describe HostsFileParser do
6
6
 
7
- let(:parser) {HostsFileParser}
7
+ let(:parser) {described_class}
8
8
  let(:filepath) {File.join(File.expand_path(File.dirname(__FILE__)), "data", "hosts.cfg")}
9
+ let(:filepath_yaml) {File.join(File.expand_path(File.dirname(__FILE__)), "data", "hosts_preserved.yml")}
9
10
 
10
11
  describe '#parse_hosts_file' do
11
12
  it "can correctly read a host file" do
@@ -57,6 +58,12 @@ module Beaker
57
58
  beaker_options_hash = parser.parse_hosts_file( yaml_string )
58
59
  expect(beaker_options_hash['1 plus 2']).to eq(3)
59
60
  end
61
+
62
+ it "can correctly read a hosts_preserved.yml file" do
63
+ FakeFS.deactivate!
64
+ expect{ parser.parse_hosts_file(filepath_yaml) }.not_to raise_error
65
+ expect(parser.parse_hosts_file(filepath_yaml).dig(:HOSTS, :"primary.host")).not_to be_nil
66
+ end
60
67
  end
61
68
 
62
69
  describe '#parse_hosts_string' do
@@ -114,7 +121,7 @@ module Beaker
114
121
 
115
122
  parser.fix_roles_array( host_options )
116
123
 
117
- host_options['HOSTS'].each do |host_name, host_hash|
124
+ host_options['HOSTS'].each do |_host_name, host_hash|
118
125
  expect( host_hash['roles'] ).to be === []
119
126
  end
120
127
  end
@@ -4,7 +4,7 @@ module Beaker
4
4
  module Options
5
5
  describe OptionsFileParser do
6
6
 
7
- let(:parser) {Beaker::Options::OptionsFileParser}
7
+ let(:parser) {described_class}
8
8
  let(:simple_opts) {File.join(File.expand_path(File.dirname(__FILE__)), "data", "opts.txt")}
9
9
 
10
10
  it "can correctly read options from a file" do
@@ -3,20 +3,20 @@ require "spec_helper"
3
3
  module Beaker
4
4
  module Options
5
5
  describe OptionsHash do
6
- let(:options) { Beaker::Options::OptionsHash.new }
6
+ let(:options) { described_class.new }
7
7
 
8
8
 
9
9
  it "supports is_pe?, defaults to pe" do
10
- expect(options.is_pe?).to be_truthy
10
+ expect(options).to be_is_pe
11
11
  end
12
12
 
13
13
  it "supports is_pe?, respects :type == foss" do
14
14
  options[:type] = 'foss'
15
- expect(options.is_pe?).to be_falsy
15
+ expect(options).not_to be_is_pe
16
16
  end
17
17
 
18
18
  describe '#get_type' do
19
- let(:options) { Beaker::Options::OptionsHash.new }
19
+ let(:options) { described_class.new }
20
20
 
21
21
  it 'returns pe as expected in the normal case' do
22
22
  newhash = options.merge({:type => 'pe'})
@@ -4,12 +4,12 @@ module Beaker
4
4
  module Options
5
5
 
6
6
  describe Parser do
7
- let(:parser) { Parser.new }
7
+ let(:parser) { described_class.new }
8
8
  let(:opts_path) { File.join(File.expand_path(File.dirname(__FILE__)), "data", "opts.txt") }
9
9
  let(:hosts_path) { File.join(File.expand_path(File.dirname(__FILE__)), "data", "hosts.cfg") }
10
10
 
11
11
  it "supports usage function" do
12
- expect { parser.usage }.to_not raise_error
12
+ expect { parser.usage }.not_to raise_error
13
13
  end
14
14
 
15
15
  describe 'parse_git_repos' do
@@ -78,7 +78,7 @@ module Beaker
78
78
  let(:test_dir) { 'tmp/tests' }
79
79
  let(:other_test_dir) { 'tmp/tests2' }
80
80
 
81
- before :each do
81
+ before do
82
82
  files = [
83
83
  '00_EnvSetup.rb', '035_StopFirewall.rb', '05_HieraSetup.rb',
84
84
  '01_TestSetup.rb', '03_PuppetMasterSanity.rb',
@@ -172,7 +172,7 @@ module Beaker
172
172
  }
173
173
  }}
174
174
 
175
- before :each do
175
+ before do
176
176
  expect(parser).to receive(:normalize_args).and_return(true)
177
177
  end
178
178
 
@@ -340,8 +340,8 @@ module Beaker
340
340
  describe '#parse_hosts_options' do
341
341
 
342
342
  context 'Hosts file exists' do
343
- before :each do
344
- allow(File).to receive(:exists?).and_return(true)
343
+ before do
344
+ allow(File).to receive(:exist?).and_return(true)
345
345
  end
346
346
 
347
347
  it 'returns the parser\'s output' do
@@ -357,8 +357,8 @@ module Beaker
357
357
 
358
358
  context 'Hosts file does not exist' do
359
359
  require 'beaker-hostgenerator'
360
- before :each do
361
- allow(File).to receive(:exists?).and_return(false)
360
+ before do
361
+ allow(File).to receive(:exist?).and_return(false)
362
362
  end
363
363
 
364
364
  it 'calls beaker-hostgenerator to get hosts information' do
@@ -546,7 +546,7 @@ module Beaker
546
546
  filename
547
547
  end
548
548
 
549
- shared_examples_for(:a_platform_supporting_only_agents) do |platform, _type|
549
+ shared_examples_for('a platform supporting only agents') do |platform, _type|
550
550
 
551
551
  it "restricts #{platform} hosts to agent" do
552
552
  args = []
@@ -556,8 +556,8 @@ module Beaker
556
556
  end
557
557
 
558
558
  context "restricts agents" do
559
- it_should_behave_like(:a_platform_supporting_only_agents, 'windows-version-arch')
560
- it_should_behave_like(:a_platform_supporting_only_agents, 'el-4-arch')
559
+ it_behaves_like('a platform supporting only agents', 'windows-version-arch')
560
+ it_behaves_like('a platform supporting only agents', 'el-4-arch')
561
561
  end
562
562
 
563
563
  context "ssh user" do
@@ -586,10 +586,10 @@ module Beaker
586
586
  end
587
587
 
588
588
  describe '#normalize_tags!' do
589
- let (:test_tag_and ) { @test_tag_and || [] }
590
- let (:test_tag_or ) { @test_tag_or || [] }
591
- let (:test_tag_exclude ) { @test_tag_exclude || [] }
592
- let (:options ) {
589
+ let(:test_tag_and ) { @test_tag_and || [] }
590
+ let(:test_tag_or ) { @test_tag_or || [] }
591
+ let(:test_tag_exclude ) { @test_tag_exclude || [] }
592
+ let(:options ) {
593
593
  opts = Beaker::Options::OptionsHash.new
594
594
  opts[:test_tag_and] = test_tag_and
595
595
  opts[:test_tag_or] = test_tag_or
@@ -644,7 +644,7 @@ module Beaker
644
644
  end
645
645
 
646
646
  describe '#resolve_symlinks' do
647
- let (:options) { Beaker::Options::OptionsHash.new }
647
+ let(:options) { Beaker::Options::OptionsHash.new }
648
648
 
649
649
  it 'calls File.realpath if hosts_file is set' do
650
650
  options[:hosts_file] = opts_path
@@ -658,7 +658,7 @@ module Beaker
658
658
  options[:hosts_file] = nil
659
659
  parser.instance_variable_set(:@options, options)
660
660
 
661
- expect { parser.resolve_symlinks! }.to_not raise_error
661
+ expect { parser.resolve_symlinks! }.not_to raise_error
662
662
  end
663
663
  end
664
664
 
@@ -691,10 +691,10 @@ module Beaker
691
691
  end
692
692
 
693
693
  describe '#check_hypervisor_config' do
694
- let (:options) { Beaker::Options::OptionsHash.new }
695
- let (:invalid_file) { '/tmp/doesnotexist_visor.yml' }
694
+ let(:options) { Beaker::Options::OptionsHash.new }
695
+ let(:invalid_file) { '/tmp/doesnotexist_visor.yml' }
696
696
 
697
- before :each do
697
+ before do
698
698
  FakeFS.deactivate!
699
699
  end
700
700
 
@@ -703,7 +703,7 @@ module Beaker
703
703
  options[:dot_fog] = invalid_file
704
704
  parser.instance_variable_set(:@options, options)
705
705
 
706
- expect { parser.check_hypervisor_config('blimpy') }.to_not raise_error
706
+ expect { parser.check_hypervisor_config('blimpy') }.not_to raise_error
707
707
  end
708
708
 
709
709
  it 'throws an error if ec2_yaml for blimpy is invalid' do
@@ -720,7 +720,7 @@ module Beaker
720
720
  options[:dot_fog] = hosts_path
721
721
  parser.instance_variable_set(:@options, options)
722
722
 
723
- expect { parser.check_hypervisor_config(visor) }.to_not raise_error
723
+ expect { parser.check_hypervisor_config(visor) }.not_to raise_error
724
724
  end
725
725
 
726
726
  it "throws an error if dot_fog for #{visor} is invalid" do
@@ -733,7 +733,7 @@ module Beaker
733
733
  end
734
734
 
735
735
  it 'does not throw error on unknown visor' do
736
- expect { parser.check_hypervisor_config('unknown_visor') }.to_not raise_error
736
+ expect { parser.check_hypervisor_config('unknown_visor') }.not_to raise_error
737
737
  end
738
738
  end
739
739
  end
@@ -4,7 +4,7 @@ module Beaker
4
4
  module Options
5
5
 
6
6
  describe Presets do
7
- let(:presets) { Presets.new }
7
+ let(:presets) { described_class.new }
8
8
 
9
9
  it "returns an env_vars OptionsHash" do
10
10
  expect(presets.env_vars).to be_instance_of(Beaker::Options::OptionsHash)
@@ -34,7 +34,7 @@ module Beaker
34
34
  end
35
35
 
36
36
  it 'has empty host_tags' do
37
- expect(presets.presets.has_key?(:host_tags)).to be_truthy
37
+ expect(presets.presets).to have_key(:host_tags)
38
38
  expect(presets.presets[:host_tags]).to eq({})
39
39
  end
40
40
 
@@ -17,6 +17,7 @@ module Beaker
17
17
 
18
18
  describe 'when the subcommand is init' do
19
19
  let( :argv ) {['init']}
20
+
20
21
  it 'returns an empty OptionsHash' do
21
22
  expect(parser).to be_kind_of(OptionsHash)
22
23
  expect(parser).to be_empty
@@ -25,13 +26,13 @@ module Beaker
25
26
 
26
27
  describe 'when the subcommand is not init' do
27
28
  let( :argv ) {['provision']}
28
- let(:options_file) {Beaker::Subcommands::SubcommandUtil::SUBCOMMAND_OPTIONS}
29
+ let( :options_file ) {home_options_file_path}
30
+
29
31
  it 'calls parse_options_file with subcommand options file when home_dir is false' do
30
32
  allow(parser_mod).to receive(:execute_subcommand?).with('provision').and_return true
31
33
  allow(parser_mod).to receive(:parse_options_file).with(Beaker::Subcommands::SubcommandUtil::SUBCOMMAND_OPTIONS)
32
34
  end
33
35
 
34
- let( :options_file ) {home_options_file_path}
35
36
  it 'calls parse_options_file with home directory options file when home_dir is true' do
36
37
  allow(parser_mod).to receive(:execute_subcommand?).with('provision').and_return true
37
38
  allow(parser_mod).to receive(:parse_options_file).with(home_options_file_path)
@@ -44,7 +45,7 @@ module Beaker
44
45
  expect(file_parser).not_to be_kind_of(OptionsHash)
45
46
  end
46
47
 
47
- let(:options_file) {""}
48
+
48
49
  it 'returns an empty options hash when file does not exist' do
49
50
  allow(File).to receive(:exist?).and_return false
50
51
  expect(parser).to be_kind_of(OptionsHash)