File tree 6 files changed +123
-8
lines changed
test/integration/v3000-py3
6 files changed +123
-8
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,7 @@ source 'https://rubygems.org'
5
5
gem 'kitchen-docker' , '>= 2.9'
6
6
gem 'kitchen-inspec' , '>= 1.1'
7
7
gem 'kitchen-salt' , '>= 0.6.0'
8
+
9
+ group :vagrant do
10
+ gem 'kitchen-vagrant'
11
+ end
Original file line number Diff line number Diff line change @@ -251,3 +251,65 @@ Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``veri
251
251
^^^^^^^^^^^^^^^^^^^^^
252
252
253
253
Gives you SSH access to the instance for manual testing.
254
+
255
+ Testing with Vagrant
256
+ --------------------
257
+
258
+ Windows testing is done with ``kitchen-salt ``.
259
+
260
+ Requirements
261
+ ^^^^^^^^^^^^
262
+
263
+ * Ruby
264
+ * Virtualbox
265
+ * Vagrant
266
+
267
+ Setup
268
+ ^^^^^
269
+
270
+ .. code-block :: bash
271
+
272
+ $ gem install bundler
273
+ $ bundle install --with=vagrant
274
+ $ bin/kitchen test [platform]
275
+
276
+ Where ``[platform] `` is the platform name defined in ``kitchen.yml ``,
277
+ e.g. ``windows ``.
278
+
279
+ Note
280
+ ^^^^
281
+
282
+ When testing using Vagrant you must set the environment variable ``KITCHEN_LOCAL_YAML `` to ``kitchen.vagrant.yml ``. For example:
283
+
284
+ .. code-block :: bash
285
+
286
+ $ KITCHEN_LOCAL_YAML=kitchen.vagrant.yml bin/kitchen test # Alternatively,
287
+ $ export KITCHEN_LOCAL_YAML=kitchen.vagrant.yml
288
+ $ bin/kitchen test
289
+
290
+ Then run the following commands as needed.
291
+
292
+ ``bin/kitchen converge ``
293
+ ^^^^^^^^^^^^^^^^^^^^^^^^
294
+
295
+ Creates the Vagrant instance and runs the ``salt.minion `` main state, ready for testing.
296
+
297
+ ``bin/kitchen verify ``
298
+ ^^^^^^^^^^^^^^^^^^^^^^
299
+
300
+ Runs the ``inspec `` tests on the actual instance.
301
+
302
+ ``bin/kitchen destroy ``
303
+ ^^^^^^^^^^^^^^^^^^^^^^^
304
+
305
+ Removes the Vagrant instance.
306
+
307
+ ``bin/kitchen test ``
308
+ ^^^^^^^^^^^^^^^^^^^^
309
+
310
+ Runs all of the stages above in one go: i.e. ``destroy `` + ``converge `` + ``verify `` + ``destroy ``.
311
+
312
+ ``bin/kitchen login ``
313
+ ^^^^^^^^^^^^^^^^^^^^^
314
+
315
+ Gives you RDP access to the instance for manual testing.
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # vim: ft=yaml
3
+ ---
4
+ driver :
5
+ name : vagrant
6
+
7
+ platforms :
8
+ - name : windows-81
9
+ driver :
10
+ box : techneg/win81x64-pro-salt
11
+ gui : false
12
+ linked_clone : true
13
+ provisioner :
14
+ init_environment : >
15
+ salt-call --local state.single file.managed
16
+ C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-minion-py3.sls
17
+ source=https://github.com/saltstack/salt-winrepo-ng/raw/master/salt-minion-py3.sls
18
+ skip_verify=True makedirs=True
19
+
20
+ suites :
21
+ - name : v3000-py3
22
+ provisioner :
23
+ state_top :
24
+ base :
25
+ ' * ' :
26
+ - salt.minion
27
+ pillars :
28
+ top.sls :
29
+ base :
30
+ ' * ' :
31
+ - salt
32
+ - v3000-py3
33
+ pillars_from_files :
34
+ salt.sls : test/salt/pillar/salt.sls
35
+ v3000-py3.sls : test/salt/pillar/v3000-py3.sls
36
+ verifier :
37
+ inspec_tests :
38
+ - path : test/integration/v3000-py3
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
+ pkgs =
4
+ case platform [ :family ]
5
+ when 'windows'
6
+ %w[ Salt\ Minion ]
7
+ else
8
+ %w[ salt-master salt-minion ]
9
+ end
10
+
3
11
control 'salt packages' do
4
12
title 'should be installed'
5
13
6
14
version = '3000.3'
7
15
8
- %w[
9
- salt-master
10
- salt-minion
11
- ] . each do |p |
16
+ pkgs . each do |p |
12
17
describe package ( p ) do
13
18
it { should be_installed }
14
19
its ( 'version' ) { should match ( /^#{ version } / ) }
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
+ services =
4
+ case platform [ :family ]
5
+ when 'windows'
6
+ %w[ salt-minion ]
7
+ else
8
+ %w[ salt-master salt-minion ]
9
+ end
10
+
3
11
control 'salt services' do
4
12
title 'should be running'
5
13
6
- %w[
7
- salt-master
8
- salt-minion
9
- ] . each do |p |
14
+ services . each do |p |
10
15
describe service ( p ) do
11
16
it { should be_installed }
12
17
it { should be_enabled }
Original file line number Diff line number Diff line change @@ -17,3 +17,4 @@ supports:
17
17
- platform-name : amazon
18
18
- platform-name : oracle
19
19
- platform-name : arch
20
+ - platform : windows
You can’t perform that action at this time.
0 commit comments