diff options
Diffstat (limited to 'spec')
18 files changed, 93 insertions, 108 deletions
diff --git a/spec/data/windows_certificates/base64_test.cer b/spec/data/windows_certificates/base64_test.cer index 0d90bf81e3..763216f86a 100644 --- a/spec/data/windows_certificates/base64_test.cer +++ b/spec/data/windows_certificates/base64_test.cer @@ -1,22 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIQNH6iXZnEKbFOEQ7D9f9iCTANBgkqhkiG9w0BAQsFADBK -MSMwIQYDVQQDDBpBIEJhc2U2NCBEdW1teSBDZXJ0aWZpY2F0ZTEjMCEGCSqGSIb3 -DQEJARYUdGVzdGJ5cnNwZWNAY2hlZi5jb20wHhcNMTkwMjEyMDk1ODM2WhcNMjAw -MjEyMTAxODM2WjBKMSMwIQYDVQQDDBpBIEJhc2U2NCBEdW1teSBDZXJ0aWZpY2F0 -ZTEjMCEGCSqGSIb3DQEJARYUdGVzdGJ5cnNwZWNAY2hlZi5jb20wggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDSy2Qlf2k1X3y/YgEjnvD0K8NeKgXKKi62 -RHRMTJ2+6KSg+I1MqHZC+BVrfzehuJVby5kM7tGLF8FvM3q7X/5oSPg8pvLZzIV0 -pBrpVPCTYw8fnlmFKBt/+m2XOqsWyL59yP+p66SHAKmoLYTGu8dkGvgJn3dwKNen -VFmwadteVfKs2wFW/ZwUxH4aLloCa8KSyqstIXrYQmdqqFOSuEgkynalD19dozSv -QtkQ9FZPuFGDwNpdO7OrcjE1lTUlzuth7CqV/pj4GYJhK/PPtO8Ing/BtwZm5XB8 -2yvvLVnL7Y/hikg2ENKA9fOYk52zR/kkd7d8qoJva7WlYEXTZvpdAgMBAAGjcDBu -MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEw -HgYDVR0RBBcwFYITd3d3LnRlc3RieXJzcGVjLmNvbTAdBgNVHQ4EFgQUuL1l247K -h+cVH9LehmQ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CEGA1UdEQQaMBiCFnd3dy5kdW1teWNoZWZ0ZXN0cy5j +b20wHQYDVR0OBBYEFGQa7l1ZPNbhj0s64g1/nyY+xULdMA0GCSqGSIb3DQEBCwUA +A4IBAQCS3chRs1LUvlq7Hj1kx3CtAhjTE75eEWz8wzWZ+DGppGnMUQg0vwrw7JPd +s3ODAFor62J97Fmb1sQ9/lSGan0CwBtCMqzHr3hoKbpVR9aFKu/Kt21zE4pEvFgZ +NVrxOFofmZ072VRdRpRK3RcnV58I02Xyb+5VR8lTbHpIsUOj+i9+y5ZuuOXoRDpI +G+AdIAfvcBbshPkI62gSFvBUdic0fcMVPZ5rFWaDjW2XFXZ6s/e5mPHNjpGpSZy7 +2y9ku9kB6ywBQXx9U21DBoIDxfprSylQGxtUuXaeCwnRvpT0Ifto5/KaeH4IzJQq +ZYGdPzBO7WBpk/AsO6buw3kQ9M5h -----END CERTIFICATE----- diff --git a/spec/data/windows_certificates/othertest.cer b/spec/data/windows_certificates/othertest.cer Binary files differindex 353f792252..f4ff69eb08 100644 --- a/spec/data/windows_certificates/othertest.cer +++ b/spec/data/windows_certificates/othertest.cer diff --git a/spec/data/windows_certificates/test.cer b/spec/data/windows_certificates/test.cer Binary files differindex 0f32d742c1..1c358b5035 100644 --- a/spec/data/windows_certificates/test.cer +++ b/spec/data/windows_certificates/test.cer diff --git a/spec/data/windows_certificates/test.p7b b/spec/data/windows_certificates/test.p7b Binary files differindex cf8cfae58c..bd46d5eccd 100644 --- a/spec/data/windows_certificates/test.p7b +++ b/spec/data/windows_certificates/test.p7b diff --git a/spec/data/windows_certificates/test.pem b/spec/data/windows_certificates/test.pem index cfbec5d188..1c358b5035 100644 --- a/spec/data/windows_certificates/test.pem +++ b/spec/data/windows_certificates/test.pem @@ -1,21 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDgDCCAmigAwIBAgIQEyXvJXC8z6lBIxwnT7/d5jANBgkqhkiG9w0BAQsFADBD -MRwwGgYDVQQDDBNBIER1bW15IENlc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XssrLp877sqpNLeXloXBmAlT39SwQTP9ImZaV5R6udqlvo +Gfgm5PH/WeK6MV3n5ik0v1rS0LwR2o82WlIB6a4iSEbzY3qSLsWOwt8o5QjAVzCR +tNdbdS3U8nrG73iA2clmF57ARQWC -----END CERTIFICATE----- diff --git a/spec/data/windows_certificates/test.pfx b/spec/data/windows_certificates/test.pfx Binary files differindex c774e12efd..2c208bf7c6 100644 --- a/spec/data/windows_certificates/test.pfx +++ b/spec/data/windows_certificates/test.pfx diff --git a/spec/functional/resource/windows_certificate_spec.rb b/spec/functional/resource/windows_certificate_spec.rb index 9b79de6a77..99b7840f9c 100644 --- a/spec/functional/resource/windows_certificate_spec.rb +++ b/spec/functional/resource/windows_certificate_spec.rb @@ -47,7 +47,7 @@ module WindowsCertificateHelper end end -describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do +describe Chef::Resource::WindowsCertificate, :windows_only do include WindowsCertificateHelper let(:stdout) { StringIO.new } @@ -65,11 +65,11 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do let(:p7b_path) { File.join(certificate_path, "test.p7b") } let(:pfx_path) { File.join(certificate_path, "test.pfx") } let(:out_path) { File.join(certificate_path, "testout.pem") } - let(:tests_thumbprint) { "3180B3E3217862600BD7B2D28067B03D41576A4F" } + let(:tests_thumbprint) { "e45a4a7ff731e143cf20b8bfb9c7c4edd5238bb3" } let(:other_cer_path) { File.join(certificate_path, "othertest.cer") } - let(:others_thumbprint) { "AD393859B2D2D4161D224F16CBD3D16555753A20" } - let(:p7b_thumbprint) { "50954A52DDFA2043F36EA9026FDD95EC252048D0" } - let(:p7b_nested_thumbprint) { "4A3333FC4E1274995AF5A95810881C86F2DF7FBD" } + let(:others_thumbprint) { "6eae1deefaf59daf1a97c9ceeff39c98b3da38cb" } + let(:p7b_thumbprint) { "f867e25b928061318ed2c36ca517681774b06260" } + let(:p7b_nested_thumbprint) { "dc395eae6be5b69951b8b6e1090cfc33df30d2cd" } before do opts = { store_name: store } @@ -221,7 +221,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do expect(win_certificate).not_to be_updated_by_last_action end it "Nested certificates are also imported" do - expect(no_of_certificates).to eq(2) + expect(no_of_certificates).to eq(3) end end @@ -322,7 +322,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do win_certificate.run_action(:verify) end it "Initial check if certificate is present" do - expect(no_of_certificates).to eq(2) + expect(no_of_certificates).to eq(3) end it "Displays correct message" do expect(stdout.string.strip).to eq("Certificate is valid") @@ -338,7 +338,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do win_certificate.run_action(:verify) end it "Initial check if certificate is present" do - expect(no_of_certificates).to eq(2) + expect(no_of_certificates).to eq(3) end it "Displays correct message" do expect(stdout.string.strip).to eq("Certificate is valid") @@ -354,7 +354,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do win_certificate.run_action(:verify) end it "Initial check if certificate is present" do - expect(no_of_certificates).to eq(2) + expect(no_of_certificates).to eq(3) end it "Displays correct message" do expect(stdout.string.strip).to eq("Certificate not found") diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb index 999b235df1..1ebffd1833 100644 --- a/spec/functional/resource/windows_service_spec.rb +++ b/spec/functional/resource/windows_service_spec.rb @@ -18,8 +18,7 @@ require "spec_helper" -describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only, :appveyor_only, broken: true do - # Marking as broken. This test is causing appveyor tests to exit with 116. +describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only do include_context "using Win32::Service" diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb index d9a8bd2d0e..08a2c84e90 100644 --- a/spec/functional/run_lock_spec.rb +++ b/spec/functional/run_lock_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2012-2016, Chef Software, Inc. +# Copyright:: Copyright 2012-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -404,6 +404,12 @@ describe Chef::RunLock do example.log_event("#{name}.stop finished (pid #{pid} wasn't running)") end end + + # close the IO.pipes so we don't leak them as open filehandles + @read_from_process.close rescue nil + @write_to_tests.close rescue nil + @read_from_tests.close rescue nil + @write_to_process.close rescue nil end def fire_event(event) diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb index bb8ed54c0e..220cc3c183 100644 --- a/spec/functional/win32/service_manager_spec.rb +++ b/spec/functional/win32/service_manager_spec.rb @@ -33,7 +33,7 @@ end # directories. # -describe "Chef::Application::WindowsServiceManager", :windows_only, :system_windows_service_gem_only, :appveyor_only do +describe "Chef::Application::WindowsServiceManager", :windows_only, :system_windows_service_gem_only do include_context "using Win32::Service" diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index b1763da1f0..e2d1c9532e 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -540,8 +540,7 @@ describe "chef-client" do end end - # Fails on appveyor, but works locally on windows and on windows hosts in Ci. - context "when using recipe-url", :skip_appveyor do + context "when using recipe-url" do before(:each) do start_tiny_server end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3154e2f255..ade3ec9404 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,18 +24,16 @@ module Shell IRB = nil unless defined? IRB end -# Ruby 1.9 Compat -$:.unshift File.expand_path("../..", __FILE__) +$LOAD_PATH.unshift File.expand_path("../..", __FILE__) + +$LOAD_PATH.unshift File.expand_path("../../chef-config/lib", __FILE__) +$LOAD_PATH.unshift File.expand_path("../../chef-utils/lib", __FILE__) require "rubygems" require "rspec/mocks" require "webmock/rspec" -$:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) -$:.unshift(File.expand_path("../lib", __FILE__)) -$:.unshift(File.dirname(__FILE__)) - if ENV["COVERAGE"] require "simplecov" SimpleCov.start do @@ -140,9 +138,6 @@ RSpec.configure do |config| config.filter_run_excluding volatile_on_solaris: true if solaris? config.filter_run_excluding volatile_from_verify: false - config.filter_run_excluding skip_appveyor: true if ENV["APPVEYOR"] - config.filter_run_excluding appveyor_only: true unless ENV["APPVEYOR"] - config.filter_run_excluding skip_buildkite: true if ENV["BUILDKITE"] config.filter_run_excluding windows_only: true unless windows? diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb index 83d7d9dfe6..3c158afd6b 100644 --- a/spec/support/shared/unit/script_resource.rb +++ b/spec/support/shared/unit/script_resource.rb @@ -30,7 +30,7 @@ shared_examples_for "a script resource" do expect(script_resource.resource_name).to eql(resource_name) end - it "should set command to nil on the resource", chef: ">= 13" do + it "should set command to nil on the resource" do expect(script_resource.command).to be nil end @@ -44,7 +44,7 @@ shared_examples_for "a script resource" do expect(script_resource.flags.strip).to eql("-f") end - it "should raise an exception if users set command on the resource", chef: ">= 13" do + it "should raise an exception if users set command on the resource" do expect { script_resource.command("foo") }.to raise_error(Chef::Exceptions::Script) end diff --git a/spec/unit/cookbook/gem_installer_spec.rb b/spec/unit/cookbook/gem_installer_spec.rb index 807e801aaf..5cb995e33b 100644 --- a/spec/unit/cookbook/gem_installer_spec.rb +++ b/spec/unit/cookbook/gem_installer_spec.rb @@ -1,5 +1,5 @@ require "spec_helper" -require "bundler/dsl" +require "bundler" describe Chef::Cookbook::GemInstaller do let(:cookbook_collection) do diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb index 7f66fe0c32..8af992e34b 100644 --- a/spec/unit/cookbook/metadata_spec.rb +++ b/spec/unit/cookbook/metadata_spec.rb @@ -267,16 +267,7 @@ describe Chef::Cookbook::Metadata do end end - it "strips out self-dependencies", chef: "< 13" do - metadata.name("foo") - expect(Chef::Log).to receive(:warn).with( - "Ignoring self-dependency in cookbook foo, please remove it (in the future this will be fatal)." - ) - metadata.depends("foo") - expect(metadata.dependencies).to eql({}) - end - - it "errors on self-dependencies", chef: ">= 13" do + it "errors on self-dependencies" do metadata.name("foo") expect { metadata.depends("foo") }.to raise_error # FIXME: add the error type diff --git a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb index f8fcb654d9..f7968dd3fb 100644 --- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb @@ -85,7 +85,7 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do end end - context "when encryption version is 3", :aes_256_gcm_only, ruby: "~> 2.0.0" do + context "when encryption version is 3", :aes_256_gcm_only do include_examples "encryption detected" do let(:version) { 3 } let(:encryptor) { Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor } diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb index f406aa2ad0..64f62c6d21 100644 --- a/spec/unit/encrypted_data_bag_item_spec.rb +++ b/spec/unit/encrypted_data_bag_item_spec.rb @@ -97,7 +97,7 @@ describe Chef::EncryptedDataBagItem::Encryptor do Chef::Config[:data_bag_encrypt_version] = 3 end - context "on supported platforms", :aes_256_gcm_only, ruby: "~> 2.0.0" do + context "on supported platforms", :aes_256_gcm_only do it "creates a version 3 encryptor" do expect(encryptor).to be_a_instance_of(Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor) @@ -166,7 +166,7 @@ describe Chef::EncryptedDataBagItem::Decryptor do context "when decrypting a version 3 (JSON+aes-256-gcm+random iv+auth tag) encrypted value" do - context "on supported platforms", :aes_256_gcm_only, ruby: "~> 2.0.0" do + context "on supported platforms", :aes_256_gcm_only do let(:encrypted_value) do Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor.new(plaintext_data, encryption_key).for_encrypted_item diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index afa3687a15..f2b0295bf6 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -246,35 +246,33 @@ describe Chef::Mixin::ShellOut do let(:new_resource) { CustomResource.new("foo") } let(:provider) { new_resource.provider_for_action(:install) } - describe "on Chef-15", chef: ">= 15" do - %i{shell_out shell_out!}.each do |method| - stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! - it "#{method} defaults to 900 seconds" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 900) - provider.send(method, "foo") - end - it "#{method} overrides the default timeout with its options" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 1) - provider.send(method, "foo", timeout: 1) - end - it "#{method} overrides the new_resource.timeout with the timeout option" do - new_resource.timeout(99) - expect(provider).to receive(stubbed_method).with("foo", timeout: 1) - provider.send(method, "foo", timeout: 1) - end - it "#{method} defaults to 900 seconds and preserves options" do - expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900) - provider.send(method, "foo", env: nil) - end - it "#{method} overrides the default timeout with its options and preserves options" do - expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) - provider.send(method, "foo", timeout: 1, env: nil) - end - it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do - new_resource.timeout(99) - expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) - provider.send(method, "foo", timeout: 1, env: nil) - end + %i{shell_out shell_out!}.each do |method| + stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! + it "#{method} defaults to 900 seconds" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 900) + provider.send(method, "foo") + end + it "#{method} overrides the default timeout with its options" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 1) + provider.send(method, "foo", timeout: 1) + end + it "#{method} overrides the new_resource.timeout with the timeout option" do + new_resource.timeout(99) + expect(provider).to receive(stubbed_method).with("foo", timeout: 1) + provider.send(method, "foo", timeout: 1) + end + it "#{method} defaults to 900 seconds and preserves options" do + expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900) + provider.send(method, "foo", env: nil) + end + it "#{method} overrides the default timeout with its options and preserves options" do + expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) + provider.send(method, "foo", timeout: 1, env: nil) + end + it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do + new_resource.timeout(99) + expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil) + provider.send(method, "foo", timeout: 1, env: nil) end end end |