diff options
Diffstat (limited to 'acceptance')
13 files changed, 157 insertions, 149 deletions
diff --git a/acceptance/.gitignore b/acceptance/.gitignore index c2ab70737d..4b0b151d75 100644 --- a/acceptance/.gitignore +++ b/acceptance/.gitignore @@ -1 +1,3 @@ .acceptance_logs +.acceptance_data +data-collector/Berksfile.lock diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml index 40228829bb..dfe3d888a0 100644 --- a/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml @@ -213,18 +213,7 @@ platforms: image-type: machine user_data: | <powershell> - $logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log" - #PS Remoting and & winrm.cmd basic config - Enable-PSRemoting -Force -SkipNetworkProfileCheck - & winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile - & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile - & winrm.cmd set winrm/config/winrs '@{MaxShellsPerUser="50"}' >> $logfile - #Server settings - support username/password login - & winrm.cmd set winrm/config/service/auth '@{Basic="true"}' >> $logfile - & winrm.cmd set winrm/config/service '@{AllowUnencrypted="true"}' >> $logfile - & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile - #Firewall Config - & netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any >> $logfile + & netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any #Set script execution to unrestricted & Set-ExecutionPolicy Unrestricted -Force </powershell> diff --git a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb index d36909e8b3..d5d2e1380b 100644 --- a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +++ b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb @@ -1,3 +1,5 @@ +require 'chef/mixin/shell_out' + module KitchenAcceptance class Kitchen < Chef::Resource resource_name :kitchen @@ -33,18 +35,33 @@ module KitchenAcceptance property :kitchen_options, String, default: lazy { ENV["PROJECT_NAME"] ? "-c -l debug" : "-c" } action :run do - execute "bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}#{kitchen_options ? " #{kitchen_options}" : ""}" do - cwd kitchen_dir - env({ - "KITCHEN_DRIVER" => driver, - "KITCHEN_INSTANCES" => instances, - "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), - "KITCHEN_CHEF_PRODUCT" => chef_product, - "KITCHEN_CHEF_CHANNEL" => chef_channel, - "KITCHEN_CHEF_VERSION" => chef_version, - "ARTIFACTORY_USERNAME" => artifactory_username, - "ARTIFACTORY_PASSWORD" => artifactory_password - }.merge(new_resource.env)) + + ruby_block "copy_kitchen_logs_to_data_path" do + block do + cmd_env = { + "KITCHEN_DRIVER" => driver, + "KITCHEN_INSTANCES" => instances, + "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), + "KITCHEN_CHEF_PRODUCT" => chef_product, + "KITCHEN_CHEF_CHANNEL" => chef_channel, + "KITCHEN_CHEF_VERSION" => chef_version, + "ARTIFACTORY_USERNAME" => artifactory_username, + "ARTIFACTORY_PASSWORD" => artifactory_password + }.merge(new_resource.env) + suite = kitchen_dir.split("/").last + kitchen_log_path = ENV["WORKSPACE"] ? "#{ENV["WORKSPACE"]}/chef-acceptance-data/logs" : "#{kitchen_dir}/../.acceptance_data/logs/" + + begin + shell_out!("bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}#{kitchen_options ? " #{kitchen_options}" : ""}", + env: cmd_env, + timeout: 60 * 30, + live_stream: STDOUT, + cwd: kitchen_dir) + ensure + FileUtils.mkdir_p("#{kitchen_log_path}/#{suite}/#{command}") + FileUtils.cp_r("#{kitchen_dir}/.kitchen/logs/.", "#{kitchen_log_path}/#{suite}/#{command}") + end + end end end end diff --git a/acceptance/Gemfile b/acceptance/Gemfile index 185437ed71..b521df8607 100644 --- a/acceptance/Gemfile +++ b/acceptance/Gemfile @@ -1,13 +1,16 @@ source "https://rubygems.org" gem "chef-acceptance", github: "chef/chef-acceptance" -gem "test-kitchen" gem "kitchen-ec2" -gem "kitchen-inspec" gem "inspec" # Pinning to github for kitchen-vagrant because 0.19.0 incorrectly # puts in a box_url for bento when a vagrant box in atlas is specified gem "kitchen-vagrant" gem "windows_chef_zero" -gem "winrm-fs" +gem "kitchen-inspec", :github => "mwrock/kitchen-inspec", :branch => "winrm-v2" +gem "test-kitchen", :github => "test-kitchen", :branch => "winrm-v2" +gem "train", :github => "chef/train", :branch => "winrm-v2" +gem "winrm", :github => "winrb/winrm", :branch => "winrm-v2" +gem "winrm-fs", :github => "winrb/winrm-fs", :branch => "winrm-v2" +gem "winrm-elevated", :github => "winrb/winrm-elevated", :branch => "winrm-v2" gem "berkshelf" diff --git a/acceptance/Gemfile.lock b/acceptance/Gemfile.lock index 6abf73932f..ff9d439b5b 100644 --- a/acceptance/Gemfile.lock +++ b/acceptance/Gemfile.lock @@ -6,17 +6,88 @@ GIT mixlib-shellout (~> 2.0) thor (~> 0.19) +GIT + remote: git://github.com/chef/train.git + revision: cc92f89267f128ee78bc12da803722268e2f6af2 + branch: winrm-v2 + specs: + train (0.15.0) + docker-api (~> 1.26) + json (~> 1.8) + mixlib-shellout (~> 2.0) + net-scp (~> 1.2) + net-ssh (>= 2.9, < 4.0) + winrm (~> 2.0) + winrm-fs (~> 1.0) + +GIT + remote: git://github.com/mwrock/kitchen-inspec.git + revision: d63240a44667974070298ad4fca20394257c92bd + branch: winrm-v2 + specs: + kitchen-inspec (0.14.0) + inspec (>= 0.22.0, < 1.0.0) + test-kitchen (~> 1.6) + +GIT + remote: git://github.com/test-kitchen/test-kitchen.git + revision: 06d7c0168ed6390c87a821ae8958e7d80c4d1912 + branch: winrm-v2 + specs: + test-kitchen (1.10.2) + mixlib-install (~> 1.0, >= 1.0.4) + mixlib-shellout (>= 1.2, < 3.0) + net-scp (~> 1.1) + net-ssh (>= 2.9, < 4.0) + safe_yaml (~> 1.0) + thor (~> 0.18) + +GIT + remote: git://github.com/winrb/winrm-elevated.git + revision: 160bf424e018b2539fdde73079443e565ae57260 + branch: winrm-v2 + specs: + winrm-elevated (1.0.0) + winrm (~> 2.0) + winrm-fs (~> 1.0) + +GIT + remote: git://github.com/winrb/winrm-fs.git + revision: ceb883b87fb81898e73e9249f287457ccb9d549f + branch: winrm-v2 + specs: + winrm-fs (1.0.0) + erubis (~> 2.7) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 1.1) + winrm + +GIT + remote: git://github.com/winrb/winrm.git + revision: 0f35bbd963024b32cc8e262f25e6110c6abf5794 + branch: winrm-v2 + specs: + winrm (2.0.0) + builder (>= 2.1.2) + erubis (~> 2.7) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0) + GEM remote: https://rubygems.org/ specs: addressable (2.4.0) - artifactory (2.3.2) - aws-sdk (2.3.14) - aws-sdk-resources (= 2.3.14) - aws-sdk-core (2.3.14) + artifactory (2.3.3) + aws-sdk (2.4.2) + aws-sdk-resources (= 2.4.2) + aws-sdk-core (2.4.2) jmespath (~> 1.0) - aws-sdk-resources (2.3.14) - aws-sdk-core (= 2.3.14) + aws-sdk-resources (2.4.2) + aws-sdk-core (= 2.4.2) berkshelf (4.3.5) addressable (~> 2.3, >= 2.3.4) berkshelf-api-client (~> 2.0, >= 2.0.2) @@ -53,21 +124,21 @@ GEM celluloid-io (0.16.2) celluloid (>= 0.16.0) nio4r (>= 1.1.0) - chef-config (12.11.18) + chef-config (12.12.15) fuzzyurl (~> 0.8.0) mixlib-config (~> 2.0) mixlib-shellout (~> 2.0) cleanroom (1.0.0) coderay (1.1.1) diff-lcs (1.2.5) - docker-api (1.28.0) + docker-api (1.29.1) excon (>= 0.38.0) json erubis (2.7.0) - excon (0.49.0) + excon (0.51.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) - ffi (1.9.10) + ffi (1.9.14) fuzzyurl (0.8.0) gssapi (1.2.0) ffi (>= 1.0.1) @@ -87,19 +158,14 @@ GEM rubyzip (~> 1.1) thor (~> 0.19) train (~> 0.13) - jmespath (1.2.4) - json_pure (>= 1.8.1) + jmespath (1.3.1) json (1.8.3) - json_pure (1.8.3) - kitchen-ec2 (1.0.0) + kitchen-ec2 (1.0.1) aws-sdk (~> 2) excon multi_json retryable (~> 2.0) test-kitchen (~> 1.4, >= 1.4.1) - kitchen-inspec (0.14.0) - inspec (>= 0.22.0, < 1.0.0) - test-kitchen (~> 1.6) kitchen-vagrant (0.20.0) test-kitchen (~> 1.4) little-plugger (1.1.4) @@ -108,11 +174,12 @@ GEM multi_json (~> 1.10) method_source (0.8.2) minitar (0.5.4) - mixlib-archive (0.1.0) + mixlib-archive (0.2.0) + mixlib-log mixlib-authentication (1.4.1) mixlib-log mixlib-config (2.2.1) - mixlib-install (1.0.13) + mixlib-install (1.1.0) artifactory mixlib-shellout mixlib-versioning @@ -124,18 +191,18 @@ GEM multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (3.1.1) + net-ssh (3.2.0) nio4r (1.2.1) nori (2.6.0) octokit (4.3.0) sawyer (~> 0.7.0, >= 0.5.3) - pry (0.10.3) + pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) rainbow (2.1.0) - retryable (2.0.3) - ridley (4.5.1) + retryable (2.0.4) + ridley (4.6.0) addressable buff-config (~> 1.0) buff-extensions (~> 1.0) @@ -153,22 +220,22 @@ GEM retryable (~> 2.0) semverse (~> 1.1) varia_model (~> 0.4.0) - rspec (3.4.0) - rspec-core (~> 3.4.0) - rspec-expectations (~> 3.4.0) - rspec-mocks (~> 3.4.0) - rspec-core (3.4.4) - rspec-support (~> 3.4.0) - rspec-expectations (3.4.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.1) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.4.0) + rspec-support (~> 3.5.0) rspec-its (1.2.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.4.1) + rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.4.0) - rspec-support (3.4.1) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) rubyntlm (0.6.0) rubyzip (1.2.0) safe_yaml (1.0.4) @@ -180,42 +247,14 @@ GEM solve (2.0.3) molinillo (~> 0.4.2) semverse (~> 1.1) - test-kitchen (1.9.2) - mixlib-install (~> 1.0, >= 1.0.4) - mixlib-shellout (>= 1.2, < 3.0) - net-scp (~> 1.1) - net-ssh (>= 2.9, < 4.0) - safe_yaml (~> 1.0) - thor (~> 0.18) thor (0.19.1) timers (4.0.4) hitimes - train (0.13.1) - docker-api (~> 1.26) - json (~> 1.8) - mixlib-shellout (~> 2.0) - net-scp (~> 1.2) - net-ssh (>= 2.9, < 4.0) - winrm (~> 1.6) - winrm-fs (~> 0.3) varia_model (0.4.1) buff-extensions (~> 1.0) hashie (>= 2.0.2, < 4.0.0) windows_chef_zero (2.0.0) test-kitchen (>= 1.2.1) - winrm (1.8.1) - builder (>= 2.1.2) - gssapi (~> 1.2) - gyoku (~> 1.0) - httpclient (~> 2.2, >= 2.2.0.2) - logging (>= 1.6.1, < 3.0) - nori (~> 2.0) - rubyntlm (~> 0.6.0) - winrm-fs (0.4.2) - erubis (~> 2.7) - logging (>= 1.6.1, < 3.0) - rubyzip (~> 1.1) - winrm (~> 1.5) PLATFORMS ruby @@ -225,11 +264,14 @@ DEPENDENCIES chef-acceptance! inspec kitchen-ec2 - kitchen-inspec + kitchen-inspec! kitchen-vagrant - test-kitchen + test-kitchen! + train! windows_chef_zero - winrm-fs + winrm! + winrm-elevated! + winrm-fs! BUNDLED WITH 1.12.5 diff --git a/acceptance/data-collector/Berksfile.lock b/acceptance/data-collector/Berksfile.lock deleted file mode 100644 index 39f4ce30dc..0000000000 --- a/acceptance/data-collector/Berksfile.lock +++ /dev/null @@ -1,6 +0,0 @@ -DEPENDENCIES - data-collector-test - path: .acceptance/data-collector-test - -GRAPH - data-collector-test (0.1.0) diff --git a/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb b/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb index be15b96429..f9d365ac58 100644 --- a/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +++ b/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb @@ -110,6 +110,7 @@ shared_examples_for "run_converge.success payload check" do expanded_run_list message_type message_version + node node_name organization_name resources @@ -150,6 +151,7 @@ shared_examples_for "run_converge.failure payload check" do expanded_run_list message_type message_version + node node_name organization_name resources @@ -178,44 +180,6 @@ shared_examples_for "run_converge.failure payload check" do end end -shared_examples_for "node-update payload check" do - describe "node update message" do - let(:required_fields) do - %w{ - entity_name - entity_type - entity_uuid - id - message_type - message_version - organization_name - recorded_at - remote_hostname - requestor_name - requestor_type - run_id - service_hostname - source - task - user_agent - } - end - let(:optional_fields) { %{data} } - - it "is not missing any required fields" do - payload = JSON.load(command("curl http://localhost:9292/cache/action").stdout) - missing_fields = required_fields.select { |key| !payload.key?(key) } - expect(missing_fields).to eq([]) - end - - it "does not have any extra fields" do - payload = JSON.load(command("curl http://localhost:9292/cache/action").stdout) - extra_fields = payload.keys.select { |key| !required_fields.include?(key) && !optional_fields.include?(key) } - expect(extra_fields).to eq([]) - end - end -end - describe "CCR with no data collector URL configured" do include_examples "successful chef run", "chef-client -z -c /etc/chef/no-endpoint.rb" include_examples "counter checks", { "run_start" => nil, "run_converge.success" => nil, "run_converge.failure" => nil } @@ -226,7 +190,6 @@ describe "CCR, local mode, config in solo mode" do include_examples "counter checks", { "run_start" => 1, "run_converge.success" => 1, "run_converge.failure" => nil } include_examples "run_start payload check" include_examples "run_converge.success payload check" - include_examples "node-update payload check" end describe "CCR, local mode, config in client mode" do @@ -239,7 +202,6 @@ describe "CCR, local mode, config in both mode" do include_examples "counter checks", { "run_start" => 1, "run_converge.success" => 1, "run_converge.failure" => nil } include_examples "run_start payload check" include_examples "run_converge.success payload check" - include_examples "node-update payload check" end describe "CCR, local mode, config in solo mode, failed run" do @@ -247,5 +209,4 @@ describe "CCR, local mode, config in solo mode, failed run" do include_examples "counter checks", { "run_start" => 1, "run_converge.success" => nil, "run_converge.failure" => 1 } include_examples "run_start payload check" include_examples "run_converge.failure payload check" - include_examples "node-update payload check" end diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb index 203ea9809a..73f5151bca 100644 --- a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb @@ -3,6 +3,8 @@ class TopCookbooks < Chef::Resource property :command, String, name_property: true + # Disabling all windows tests until winrm issue is properly settled. + # action :run do cookbook_kitchen "#{command} docker" do end @@ -33,8 +35,6 @@ class TopCookbooks < Chef::Resource repository "adamedx/winbox" end - # Temporarily disabling windows and chocolatey to eliminate - # transient errors on the builders # cookbook_kitchen "#{command} windows" do # end diff --git a/acceptance/trivial/.kitchen.yml b/acceptance/trivial/.kitchen.yml index 1e0af03503..0db67c468f 100644 --- a/acceptance/trivial/.kitchen.yml +++ b/acceptance/trivial/.kitchen.yml @@ -3,5 +3,5 @@ verifier: suites: - name: chef-current-install - includes: [windows-2012r2] + includes: [ubuntu-14.04, windows-server-2012r2] run_list: diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb index e2d663ac2f..e12f938cf3 100644 --- a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb +++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb @@ -1 +1 @@ -kitchen "destroy" +#kitchen "destroy" diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb index 5726c0e7b5..cec9de4e5d 100644 --- a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb +++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb @@ -1 +1 @@ -kitchen "converge" +#kitchen "converge" diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb index 05ac94ce66..52e3560cf6 100644 --- a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb +++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb @@ -1 +1 @@ -kitchen "verify" +#kitchen "verify" diff --git a/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb b/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb index a791177362..75383b69bf 100644 --- a/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb +++ b/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb @@ -13,7 +13,7 @@ describe service("chef-client") do it { should_not be_running } end -describe command("chef-service-manager -a install") do +describe command("/opscode/chef/bin/chef-service-manager.bat -a install") do its("exit_status") { should eq 0 } its(:stdout) { should match /Service 'chef-client' has successfully been installed./ } end @@ -24,7 +24,7 @@ describe service("chef-client") do it { should_not be_running } end -describe command("chef-service-manager -a start") do +describe command("/opscode/chef/bin/chef-service-manager.bat -a start") do its("exit_status") { should eq 0 } its(:stdout) { should match /Service 'chef-client' is now 'running'/ } end @@ -35,7 +35,7 @@ describe service("chef-client") do it { should be_running } end -describe command("chef-service-manager -a stop") do +describe command("/opscode/chef/bin/chef-service-manager.bat -a stop") do its("exit_status") { should eq 0 } its(:stdout) { should match /Service 'chef-client' is now 'stopped'/ } end @@ -46,7 +46,7 @@ describe service("chef-client") do it { should_not be_running } end -describe command("chef-service-manager -a uninstall") do +describe command("/opscode/chef/bin/chef-service-manager.bat -a uninstall") do its("exit_status") { should eq 0 } its(:stdout) { should match /Service chef-client deleted/ } end |