-
Notifications
You must be signed in to change notification settings - Fork 113
Windows testing using kitchen-vagrant #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3802024
fix(dhparams): allow generating Diffie Hellman parameters on Windows
dafyddj 3ebcbe9
fix(adapters): call `adapters.sls` in `init.sls`
dafyddj 96c3001
test(windows): add local testing of Windows using Vagrant/Virtualbox
dafyddj 9f82955
ci(travis): merge `rubocop` linter into main `lint` job
dafyddj 0229d14
docs: add steps required for testing using Vagrant
dafyddj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # vim: ft=yaml | ||
| --- | ||
| driver: | ||
| name: vagrant | ||
|
|
||
| platforms: | ||
| - name: windows-81-2019-2-py3 | ||
| driver: | ||
| box: techneg/win81x64-pro-salt | ||
| gui: false | ||
| linked_clone: true | ||
| provisioner: | ||
| init_environment: > | ||
| salt-call --local state.single file.managed | ||
| C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls | ||
| source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls | ||
| skip_verify=True makedirs=True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,5 +3,6 @@ | |
| include: | ||
| - openvpn.repo | ||
| - openvpn.install | ||
| - openvpn.adapters | ||
| - openvpn.dhparams | ||
| - openvpn.service | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,45 @@ | ||
| # Overide by OS | ||
| # frozen_string_literal: true | ||
|
|
||
| if os[:family] == 'windows' | ||
| conf_dir = 'C:\\Program Files\\OpenVPN\\config' | ||
| conf_ext = 'ovpn' | ||
| else | ||
| conf_dir = '/etc/openvpn' | ||
| conf_ext = 'conf' | ||
| end | ||
|
|
||
| user = 'root' | ||
| group = 'openvpn' | ||
|
|
||
| control 'OpenVPN server configuration' do | ||
| title 'should match desired lines' | ||
|
|
||
| %w[server client].each do |role| | ||
| cfgfile = | ||
| case os[:name] | ||
| when 'debian' | ||
| '/etc/openvpn/server/myserver1.conf' | ||
| when 'fedora' | ||
| '/etc/openvpn/server/myserver1.conf' | ||
| when 'ubuntu' | ||
| '/etc/openvpn/server/myserver1.conf' | ||
| when 'debian', 'fedora', 'ubuntu' | ||
| "#{conf_dir}/#{role}/my#{role}1.#{conf_ext}" | ||
| else | ||
| '/etc/openvpn/myserver1.conf' | ||
| "#{conf_dir}/my#{role}1.#{conf_ext}" | ||
| end | ||
|
|
||
| describe file(cfgfile) do | ||
| it { should be_file } | ||
| it { should be_owned_by user } | ||
| it { should be_grouped_into group } | ||
| its('mode') { should cmp '0640' } | ||
| its('content') { should include '# OpenVPN server configuration' } | ||
| its('content') { should include '# Managed by Salt' } | ||
| its('content') { should include 'user' } | ||
| control "OpenVPN #{role} configuration" do | ||
| title 'should match desired lines' | ||
|
|
||
| describe file(cfgfile) do | ||
| it { should be_file } | ||
| its('content') { should include "# OpenVPN #{role} configuration" } | ||
| its('content') { should include '# Managed by Salt' } | ||
| its('content') { should include 'user' } | ||
| end | ||
| end | ||
| end | ||
|
|
||
| control 'OpenVPN client configuration' do | ||
| title 'should match desired lines' | ||
| control "OpenVPN #{role} configuration file permissions" do | ||
| title 'should be correct' | ||
|
|
||
| cfgfile = | ||
| case os[:name] | ||
| when 'debian' | ||
| '/etc/openvpn/client/myclient1.conf' | ||
| when 'fedora' | ||
| '/etc/openvpn/client/myclient1.conf' | ||
| when 'ubuntu' | ||
| '/etc/openvpn/client/myclient1.conf' | ||
| else | ||
| '/etc/openvpn/myclient1.conf' | ||
| end | ||
| only_if('Skip on Windows') { os[:family] != 'windows' } | ||
|
|
||
| describe file(cfgfile) do | ||
| it { should be_file } | ||
| it { should be_owned_by user } | ||
| it { should be_grouped_into group } | ||
| its('mode') { should cmp '0640' } | ||
| its('content') { should include '# OpenVPN client configuration' } | ||
| its('content') { should include '# Managed by Salt' } | ||
| its('content') { should include 'user' } | ||
| describe file(cfgfile) do | ||
| it { should be_owned_by user } | ||
| it { should be_grouped_into group } | ||
| its('mode') { should cmp '0640' } | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| control 'OpenVPN package' do | ||
| title 'should be installed' | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,45 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| control 'OpenVPN service' do | ||
| impact 0.5 | ||
| title 'should be running and enabled' | ||
|
|
||
| # single service | ||
| if os[:name] == 'centos' && os[:release].start_with?('6') | ||
| describe service("openvpn") do | ||
| it { should be_enabled } | ||
| it { should be_running } | ||
| end | ||
| require 'rspec/retry' | ||
|
|
||
| # multiple services | ||
| else | ||
| %w(server client).each do |role| | ||
| log_dir = '/var/log/openvpn/' | ||
|
|
||
| if os[:name] == 'centos' && os[:release].start_with?('6') | ||
| services = ['openvpn'] | ||
| elsif os[:family] == 'windows' | ||
| log_dir = 'C:\\Program Files\\OpenVPN\\log\\' | ||
| services = ['OpenVPNService'] | ||
| else | ||
| services = [] | ||
| %w[server client].each do |role| | ||
| prefix = | ||
| case os[:name] | ||
| when 'debian' | ||
| "openvpn-#{role}" | ||
| when 'fedora' | ||
| "openvpn-#{role}" | ||
| when 'ubuntu' | ||
| when 'debian', 'fedora', 'ubuntu' | ||
| "openvpn-#{role}" | ||
| else | ||
| 'openvpn' | ||
| end | ||
|
|
||
| describe service("#{prefix}@my#{role}1.service") do | ||
| it { should be_enabled } | ||
| it { should be_running } | ||
| end | ||
| services << "#{prefix}@my#{role}1.service" | ||
| end | ||
| end | ||
|
|
||
| %w(server client).each do |role| | ||
| logfile = "/var/log/openvpn/my#{role}1.log" | ||
| services.each do |service| | ||
| describe service(service) do | ||
| it { should be_enabled } | ||
| it { should be_running } | ||
| end | ||
| end | ||
|
|
||
| describe command("sh -c 'for i in $(seq 1 60); do if grep \"Initialization Sequence Completed\" #{logfile}; then exit 0; fi; echo -n '.'; sleep 1; done; cat #{logfile}; exit 1'") do | ||
| its('exit_status') { should be 0 } | ||
| its('stdout') { should include "Initialization Sequence Completed" } | ||
| %w[server client].each do |role| | ||
| logfile = "#{log_dir}my#{role}1.log" | ||
| describe 'Initialization' do | ||
| it 'should be completed', retry: 60, retry_wait: 1 do | ||
| expect(file(logfile).content).to include 'Initialization Sequence Completed' | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,4 @@ supports: | |
| - platform-name: freebsd | ||
| - platform-name: amazon | ||
| - platform-name: arch | ||
| - platform: windows | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.