From 59655fb19a86b0649b12eced7b48c2d0d4f1650b Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Sat, 18 Jan 2020 23:13:57 -0500 Subject: [PATCH] (SIMP-MAINT) Add Windows 2016 and 2019 nodesets * Also added a missing requirement to the Gemfile * Requires the following PRs to function: * https://github.com/puppetlabs/beaker-vagrant/pull/26 * https://github.com/puppetlabs/beaker-puppet/pull/129 --- lib/simp/rake/beaker.rb | 1 + .../suites/windows/00_default_spec.rb | 73 +++++++++++-------- .../suites/windows/nodesets/default.yml | 12 +-- .../suites/windows/nodesets/win2016.yml | 35 +++++++++ .../suites/windows/nodesets/win2019.yml | 34 +++++++++ 5 files changed, 114 insertions(+), 41 deletions(-) create mode 100644 spec/acceptance/suites/windows/nodesets/win2016.yml create mode 100644 spec/acceptance/suites/windows/nodesets/win2019.yml diff --git a/lib/simp/rake/beaker.rb b/lib/simp/rake/beaker.rb index e0a454e..84fa2b7 100644 --- a/lib/simp/rake/beaker.rb +++ b/lib/simp/rake/beaker.rb @@ -3,6 +3,7 @@ require 'rake/tasklib' require 'fileutils' require 'puppetlabs_spec_helper/tasks/beaker' +require 'puppetlabs_spec_helper/tasks/fixtures' module Simp; end module Simp::Rake diff --git a/spec/acceptance/suites/windows/00_default_spec.rb b/spec/acceptance/suites/windows/00_default_spec.rb index 6c1c4f5..ba280a6 100644 --- a/spec/acceptance/suites/windows/00_default_spec.rb +++ b/spec/acceptance/suites/windows/00_default_spec.rb @@ -14,42 +14,46 @@ unless ENV['BEAKER_provision'] == 'no' hosts.each do |host| - # Install Puppet - if host.is_pe? - install_pe - else - install_puppet + unless Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed') + # Install Puppet + if host.is_pe? + install_pe + else + install_puppet + end end end end hosts.each do |host| - # https://petersouter.co.uk/testing-windows-puppet-with-beaker/ - case host['platform'] - when /windows/ - GEOTRUST_GLOBAL_CA = <<-EOM.freeze ------BEGIN CERTIFICATE----- -MIIDVDCCAjygAwIBAgIDAjR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L4hmXXeXxx12E6nV -5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== ------END CERTIFICATE----- - EOM - install_cert_on_windows(host, 'geotrustglobal', GEOTRUST_GLOBAL_CA) + unless Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed') + # https://petersouter.co.uk/testing-windows-puppet-with-beaker/ + case host['platform'] + when /windows/ + GEOTRUST_GLOBAL_CA = <<-EOM.freeze + -----BEGIN CERTIFICATE----- + MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT + MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i + YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG + EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg + R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 + 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq + fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv + iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU + 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ + bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW + MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA + ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l + uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn + Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS + tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF + PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un + hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV + 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== + -----END CERTIFICATE----- + EOM + install_cert_on_windows(host, 'geotrustglobal', GEOTRUST_GLOBAL_CA) + end end end @@ -91,8 +95,13 @@ end end - hosts.each do |host| + if Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed') + Simp::BeakerHelpers::Snapshot.restore(host, 'puppet_installed') + else + Simp::BeakerHelpers::Snapshot.save(host, 'puppet_installed') + end + describe 'windows hosts coexising with linux hosts' do context "on #{host}" do it 'should have puppet installed' do diff --git a/spec/acceptance/suites/windows/nodesets/default.yml b/spec/acceptance/suites/windows/nodesets/default.yml index 3d30c83..cff9ce0 100644 --- a/spec/acceptance/suites/windows/nodesets/default.yml +++ b/spec/acceptance/suites/windows/nodesets/default.yml @@ -9,7 +9,6 @@ HOSTS: win: roles: - windows - - ad platform: windows-server-amd64 box: opentable/win-2012r2-standard-amd64-nocm # VBOX ONLY hypervisor: <%= hypervisor %> @@ -18,19 +17,14 @@ HOSTS: user: vagrant communicator: winrm is_cygwin: false - centos7: + + el7: roles: - default - - client platform: el-7-x86_64 box: centos/7 hypervisor: <%= hypervisor %> - centos6: - roles: - - client - platform: el-6-x86_64 - box: centos/6 - hypervisor: <%= hypervisor %> + CONFIG: log_level: verbose type: aio diff --git a/spec/acceptance/suites/windows/nodesets/win2016.yml b/spec/acceptance/suites/windows/nodesets/win2016.yml new file mode 100644 index 0000000..52b4719 --- /dev/null +++ b/spec/acceptance/suites/windows/nodesets/win2016.yml @@ -0,0 +1,35 @@ +<% + if ENV['BEAKER_HYPERVISOR'] + hypervisor = ENV['BEAKER_HYPERVISOR'] + else + hypervisor = 'vagrant' + end +-%> +HOSTS: + win: + roles: + - windows + platform: windows-server-amd64 + box: gusztavvargadr/windows-server + box_version: 1607.0.1909 + hypervisor: <%= hypervisor %> + vagrant_memsize: 2048 + vagrant_cpus: 2 + user: vagrant + communicator: winrm + is_cygwin: false + + el7: + roles: + - default + platform: el-7-x86_64 + box: centos/7 + hypervisor: <%= hypervisor %> + +CONFIG: + log_level: verbose + type: aio + vagrant_memsize: 256 +<% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%> + puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %> +<% end -%> diff --git a/spec/acceptance/suites/windows/nodesets/win2019.yml b/spec/acceptance/suites/windows/nodesets/win2019.yml new file mode 100644 index 0000000..7607f80 --- /dev/null +++ b/spec/acceptance/suites/windows/nodesets/win2019.yml @@ -0,0 +1,34 @@ +<% + if ENV['BEAKER_HYPERVISOR'] + hypervisor = ENV['BEAKER_HYPERVISOR'] + else + hypervisor = 'vagrant' + end +-%> +HOSTS: + win: + roles: + - windows + platform: windows-server-amd64 + box: gusztavvargadr/windows-server + hypervisor: <%= hypervisor %> + vagrant_memsize: 2048 + vagrant_cpus: 2 + user: vagrant + communicator: winrm + is_cygwin: false + + el7: + roles: + - default + platform: el-7-x86_64 + box: centos/7 + hypervisor: <%= hypervisor %> + +CONFIG: + log_level: verbose + type: aio + vagrant_memsize: 256 +<% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%> + puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %> +<% end -%>