File tree Expand file tree Collapse file tree 15 files changed +183
-111
lines changed Expand file tree Collapse file tree 15 files changed +183
-111
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ Metrics/LineLength:
88 Max : 88
99
1010# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
11+ Metrics/BlockLength :
12+ Max : 36
Original file line number Diff line number Diff line change @@ -21,17 +21,14 @@ stages:
2121 - name : release
2222 if : branch = master AND type != pull_request
2323jobs :
24- allow_failures :
25- - env : Lint_rubocop
26- fast_finish : true
2724 include :
2825 # # Define the test stage that runs the linters (and testing matrix, if applicable)
2926
30- # Run all of the linters in a single job (except `rubocop`)
27+ # Run all of the linters in a single job
3128 - language : node_js
3229 node_js : lts/*
3330 env : Lint
34- name : ' Lint: salt-lint, yamllint & commitlint'
31+ name : ' Lint: salt-lint, yamllint, rubocop & commitlint'
3532 before_install : skip
3633 script :
3734 # Install and run `salt-lint`
@@ -42,21 +39,13 @@ jobs:
4239 # Need at least `v1.17.0` for the `yaml-files` setting
4340 - pip install --user yamllint>=1.17.0
4441 - yamllint -s .
42+ # Install and run `rubocop`
43+ - gem install rubocop
44+ - rubocop -d
4545 # Install and run `commitlint`
4646 - npm i -D @commitlint/config-conventional
4747 @commitlint/travis-cli
4848 - commitlint-travis
49- # Run the `rubocop` linter in a separate job that is allowed to fail
50- # Once these lint errors are fixed, this can be merged into a single job
51- - language : node_js
52- node_js : lts/*
53- env : Lint_rubocop
54- name : ' Lint: rubocop'
55- before_install : skip
56- script :
57- # Install and run `rubocop`
58- - gem install rubocop
59- - rubocop -d
6049
6150 # # Define the rest of the matrix based on Kitchen testing
6251 # Make sure the instances listed below match up with
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ ignore: |
1212 node_modules/
1313 test/**/states/**/*.sls
1414 .kitchen/
15+ test/salt/pillar/default.sls
1516
1617yaml-files :
1718 # Default settings
Original file line number Diff line number Diff line change 22
33source 'https://rubygems.org'
44
5+ gem 'inspec'
56gem 'kitchen-docker' , '>= 2.9'
67gem 'kitchen-inspec' , '>= 1.1'
78gem 'kitchen-salt' , '>= 0.6.0'
9+ gem 'rspec-retry'
10+
11+ group :vagrant do
12+ gem 'kitchen-vagrant'
13+ end
Original file line number Diff line number Diff line change @@ -131,3 +131,65 @@ Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``veri
131131^^^^^^^^^^^^^^^^^^^^^
132132
133133Gives you SSH access to the instance for manual testing.
134+
135+ Testing with Vagrant
136+ --------------------
137+
138+ Windows testing is done with ``kitchen-salt ``.
139+
140+ Requirements
141+ ^^^^^^^^^^^^
142+
143+ * Ruby
144+ * Virtualbox
145+ * Vagrant
146+
147+ Setup
148+ ^^^^^
149+
150+ .. code-block :: bash
151+
152+ $ gem install bundler
153+ $ bundle install --with=vagrant
154+ $ bin/kitchen test [platform]
155+
156+ Where ``[platform] `` is the platform name defined in ``kitchen.yml ``,
157+ e.g. ``windows-81-2019-2-py3 ``.
158+
159+ Note
160+ ^^^^
161+
162+ When testing using Vagrant you must set the environment variable ``KITCHEN_LOCAL_YAML `` to ``kitchen.vagrant.yml ``. For example:
163+
164+ .. code-block :: bash
165+
166+ $ KITCHEN_LOCAL_YAML=kitchen.vagrant.yml bin/kitchen test # Alternatively,
167+ $ export KITCHEN_LOCAL_YAML=kitchen.vagrant.yml
168+ $ bin/kitchen test
169+
170+ Then run the following commands as needed.
171+
172+ ``bin/kitchen converge ``
173+ ^^^^^^^^^^^^^^^^^^^^^^^^
174+
175+ Creates the Vagrant instance and runs the ``openvpn `` main state, ready for testing.
176+
177+ ``bin/kitchen verify ``
178+ ^^^^^^^^^^^^^^^^^^^^^^
179+
180+ Runs the ``inspec `` tests on the actual instance.
181+
182+ ``bin/kitchen destroy ``
183+ ^^^^^^^^^^^^^^^^^^^^^^^
184+
185+ Removes the Vagrant instance.
186+
187+ ``bin/kitchen test ``
188+ ^^^^^^^^^^^^^^^^^^^^
189+
190+ Runs all of the stages above in one go: i.e. ``destroy `` + ``converge `` + ``verify `` + ``destroy ``.
191+
192+ ``bin/kitchen login ``
193+ ^^^^^^^^^^^^^^^^^^^^^
194+
195+ 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-2019-2-py3
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\openvpn.sls
17+ source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls
18+ skip_verify=True makedirs=True
Original file line number Diff line number Diff line change 22# vim: ft=yaml
33---
44openvpn :
5+ bin_dir : ~
56 conf_dir : /etc/openvpn
67 conf_ext : conf
78 dh_files : ['2048', '4096']
Original file line number Diff line number Diff line change 88 {%- set dh_file = config_dir ~ " /dh" ~ dh ~ " .pem" % }
99openvpn_create_dh_{{ dh }}:
1010 cmd.run:
11- - name: openssl dhparam {% if map .dsaparam % }- dsaparam {% endif % }- out {{ dh_file }} {{ dh }}
11+ - name: ' " {{ map.bin_dir | default( ' ' , true) }} openssl" dhparam {% if map.dsaparam %}-dsaparam {% endif %}-out " {{ dh_file }} " {{ dh }} '
1212 - creates: {{ dh_file }}
1313 - require:
1414 - pkg: openvpn_pkgs
Original file line number Diff line number Diff line change 33include:
44 - openvpn.repo
55 - openvpn.install
6+ - openvpn.adapters
67 - openvpn.dhparams
78 - openvpn.service
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ FreeBSD:
2626 manage_user : false
2727 manage_group : false
2828Windows :
29+ bin_dir : C:\Program Files\OpenVPN\bin\
2930 conf_dir : C:\Program Files\OpenVPN\config
3031 conf_ext : ovpn
3132 service : OpenVPNServiceInteractive
You can’t perform that action at this time.
0 commit comments