summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-03-16 13:29:37 -0700
committerGitHub <noreply@github.com>2020-03-16 13:29:37 -0700
commit1134829725a66534d4a09be05e6ac9ec76615f97 (patch)
tree567988828b5fa4bfae087992a808e4ca600fa112
parent985cad427b225ab572558a15fd1f48318d7a99f7 (diff)
parentc824e081ff641107e1554ceb9b54b5c9d67f9181 (diff)
downloadchef-1134829725a66534d4a09be05e6ac9ec76615f97.tar.gz
Merge pull request #9499 from chef/15_testing
Multiple testing fixes backported from master
-rw-r--r--.expeditor/verify.pipeline.yml17
-rw-r--r--lib/chef/resource/rhsm_register.rb1
-rw-r--r--lib/chef/resource/windows_certificate.rb1
-rwxr-xr-xscripts/bk_tests/bk_container_prep.sh6
-rwxr-xr-xscripts/bk_tests/bk_linux_exec.sh3
-rw-r--r--scripts/bk_tests/bk_win_functional.ps13
-rw-r--r--spec/data/windows_certificates/base64_test.cer38
-rw-r--r--spec/data/windows_certificates/othertest.cerbin912 -> 1216 bytes
-rw-r--r--spec/data/windows_certificates/test.cerbin900 -> 1188 bytes
-rw-r--r--spec/data/windows_certificates/test.p7bbin2613 -> 2619 bytes
-rw-r--r--spec/data/windows_certificates/test.pem37
-rw-r--r--spec/data/windows_certificates/test.pfxbin2701 -> 2637 bytes
-rw-r--r--spec/functional/resource/windows_certificate_spec.rb18
-rw-r--r--spec/functional/resource/windows_service_spec.rb3
-rw-r--r--spec/functional/run_lock_spec.rb8
-rw-r--r--spec/functional/win32/service_manager_spec.rb2
-rw-r--r--spec/integration/client/client_spec.rb3
-rw-r--r--spec/spec_helper.rb13
-rw-r--r--spec/support/shared/unit/script_resource.rb4
-rw-r--r--spec/unit/cookbook/gem_installer_spec.rb2
-rw-r--r--spec/unit/cookbook/metadata_spec.rb11
-rw-r--r--spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb2
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb4
-rw-r--r--spec/unit/mixin/shell_out_spec.rb56
24 files changed, 116 insertions, 116 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml
index e7195c841b..227685dbc7 100644
--- a/.expeditor/verify.pipeline.yml
+++ b/.expeditor/verify.pipeline.yml
@@ -34,6 +34,7 @@ steps:
- label: "Functional Specs Ubuntu :ruby: 2.6"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
+ - apt-get update -y
- apt-get install -y cron locales # needed for functional tests to pass
- cd /workdir; bundle install --jobs=3 --retry=3 --without omnibus_package docgen ruby_prof
- bundle exec rake spec:functional
@@ -262,10 +263,11 @@ steps:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- INTEGRATION_SPECS_25=1
-#
+
- label: "Functional Specs :ruby: 2.5"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
+ - apt-get update -y
- apt-get install -y cron locales # needed for functional tests to pass
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
- bundle exec rake spec:functional
@@ -351,6 +353,19 @@ steps:
docker:
image: rubydistros/ubuntu-18.04
+- label: "Test berkshelf gem :ruby: 2.6"
+ commands:
+ - /workdir/scripts/bk_tests/bk_container_prep.sh
+ - apt-get update -y
+ - apt-get install -y graphviz
+ - gem install bundler -v 1.17.3 # necessary for berks Gemfile.lock for now
+ - bundle install --jobs=3 --retry=3 --without omnibus_package docgen
+ - bundle exec tasks/bin/run_external_test berkshelf/berkshelf master rake
+ expeditor:
+ executor:
+ docker:
+ image: rubydistros/ubuntu-18.04
+
#########################################################################
# START TEST KITCHEN ONLY
#########################################################################
diff --git a/lib/chef/resource/rhsm_register.rb b/lib/chef/resource/rhsm_register.rb
index afe30e4a3a..aa3f47780e 100644
--- a/lib/chef/resource/rhsm_register.rb
+++ b/lib/chef/resource/rhsm_register.rb
@@ -80,7 +80,6 @@ class Chef
not_if { katello_cert_rpm_installed? }
end
-
file "#{Chef::Config[:file_cache_path]}/katello-package.rpm" do
action :delete
end
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index 474f9ad69c..7a561f7fc4 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -309,7 +309,6 @@ class Chef
def import_certificates(cert_objs, is_pfx)
[cert_objs].flatten.each do |cert_obj|
thumbprint = OpenSSL::Digest::SHA1.new(cert_obj.to_der).to_s # Fetch its thumbprint
-
# Need to check if return value is Boolean:true
# If not then the given certificate should be added in certstore
if verify_cert(thumbprint) == true
diff --git a/scripts/bk_tests/bk_container_prep.sh b/scripts/bk_tests/bk_container_prep.sh
index bf4711ec39..bb82b6b140 100755
--- a/scripts/bk_tests/bk_container_prep.sh
+++ b/scripts/bk_tests/bk_container_prep.sh
@@ -2,13 +2,11 @@
# make sure we have the network tools in place for various network specs
if [ -f /etc/debian_version ]; then
- apt-get update -y && apt-get install -y net-tools iproute2
touch /etc/network/interfaces
-elif [ -f /etc/redhat-release ]; then
- yum install -y net-tools
fi
# make sure we have the omnibus_overrides specified version of rubygems / bundler
+echo "--- Install proper rubygems / bundler"
gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
gem --version
gem uninstall bundler -a -x || true
@@ -19,3 +17,5 @@ rm -f .bundle/config
# force all .rspec tests into progress display to reduce line count
echo --color > .rspec
echo -fp >> .rspec
+
+echo "--- Run tests" \ No newline at end of file
diff --git a/scripts/bk_tests/bk_linux_exec.sh b/scripts/bk_tests/bk_linux_exec.sh
index d08bcf38c6..e74f598d40 100755
--- a/scripts/bk_tests/bk_linux_exec.sh
+++ b/scripts/bk_tests/bk_linux_exec.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# Enable IPv6 in docker
+echo "--- Enabling ipv6 on docker"
sudo systemctl stop docker
echo "Enabling IPv6 in Docker config"
dockerd_config="/etc/docker/daemon.json"
@@ -12,9 +13,11 @@ docker version
sudo service docker status
# Install C and C++
+echo "--- Installing package deps"
sudo yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel
# Install omnibus-toolchain for git bundler and gem
+echo "--- Installing omnibus toolchain"
curl -fsSL https://chef.io/chef/install.sh | sudo bash -s -- -P omnibus-toolchain
# Set Environment Variables
diff --git a/scripts/bk_tests/bk_win_functional.ps1 b/scripts/bk_tests/bk_win_functional.ps1
index 992dc371d9..59c2cf30c6 100644
--- a/scripts/bk_tests/bk_win_functional.ps1
+++ b/scripts/bk_tests/bk_win_functional.ps1
@@ -13,8 +13,7 @@ Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyC
$ErrorActionPreference = 'Stop'
echo "Downloading Ruby + DevKit"
-[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
-(New-Object System.Net.WebClient).DownloadFile('https://public-cd-buildkite-cache.s3-us-west-2.amazonaws.com/rubyinstaller-devkit-2.6.5-1-x64.exe', 'c:\\rubyinstaller-devkit-2.6.5-1-x64.exe')
+aws s3 cp s3://public-cd-buildkite-cache/rubyinstaller-devkit-2.6.5-1-x64.exe c:/rubyinstaller-devkit-2.6.5-1-x64.exe
echo "Installing Ruby + DevKit"
Start-Process c:\rubyinstaller-devkit-2.6.5-1-x64.exe -ArgumentList '/verysilent /dir=C:\\ruby26' -Wait
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
-MjEyMTAxODM2WjBKMSMwIQYDVQQDDBpBIEJhc2U2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QGxtUuXaeCwnRvpT0Ifto5/KaeH4IzJQq
+ZYGdPzBO7WBpk/AsO6buw3kQ9M5h
-----END CERTIFICATE-----
diff --git a/spec/data/windows_certificates/othertest.cer b/spec/data/windows_certificates/othertest.cer
index 353f792252..f4ff69eb08 100644
--- a/spec/data/windows_certificates/othertest.cer
+++ b/spec/data/windows_certificates/othertest.cer
Binary files differ
diff --git a/spec/data/windows_certificates/test.cer b/spec/data/windows_certificates/test.cer
index 0f32d742c1..1c358b5035 100644
--- a/spec/data/windows_certificates/test.cer
+++ b/spec/data/windows_certificates/test.cer
Binary files differ
diff --git a/spec/data/windows_certificates/test.p7b b/spec/data/windows_certificates/test.p7b
index cf8cfae58c..bd46d5eccd 100644
--- a/spec/data/windows_certificates/test.p7b
+++ b/spec/data/windows_certificates/test.p7b
Binary files differ
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
-MRwwGgYDVQQDDBNBIER1bW15IENlcnRpZmljYXRlMSMwIQYJKoZIhvcNAQkBFhR0
-ZXN0Ynlyc3BlY0BjaGVmLmNvbTAeFw0xOTAxMjMxODEzNTBaFw0yMDAxMjMxODMz
-NTBaMEMxHDAaBgNVBAMME0EgRHVtbXkgQ2VydGlmaWNhdGUxIzAhBgkqhkiG9w0B
-CQEWFHRlc3RieXJzcGVjQGNoZWYuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEA1IPsH+S+HKVsJJDuHsqgSQnWAWp7SsBqwnx/t/NZAM6g41mbwafP
-EZixFB5G6VAIiUosHcLhFwz00uPwVZIDND1Ez4TxACraF0iJQpy2kmriDq449ccu
-fn/d8k417Vj0Hm7mcNp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n9/dFF4k8KB8Em0sUx7Vq
+J3YhK2N2cAacgP2Frqqf5znpNBBOg968RoZzGx0EiXFvLsqC4y8ggApWTbMXPRk4
+1a7GlpUpSqI3y5cLeEbzwGQKu8I1I+v7P2fTlnJPHarM7sBbL8bieukkFHYu78iV
+u1wpKOCCfs5DTmJu8WN+z1Mar9vyrWMBlt2wBBgNHPz5mcXUzJHTzaI/D9RGgBgF
+V0IkNqISx/IzR62jjj2g6MgTH4G/0mM6O5sxduM4yGmWZNZpVzh0yMLgH619MZlj
+SMQIN3U/SQIDAQABo3MwcTAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB
+BQUHAwIGCCsGAQUFBwMBMCEGA1UdEQQaMBiCFnd3dy5kdW1teWNoZWZ0ZXN0cy5j
+b20wHQYDVR0OBBYEFHwS3gs03m6RcpR+66u4OqGiZdYnMA0GCSqGSIb3DQEBCwUA
+A4IBAQCFHqMjHUfBZahIsKHQIcFCbC1NFh1ZHlJKZzrRBRwRzX19OttHGMyLpDd6
+tM9Ac6LLR8S4QIWg+HF3IrkN+vfTRDZAccj+tIwBRstmdsEz/rAJ79Vb/00mXZQx
+0FPiBDR3hE7On2oo24DU8kJP3v6TrunwtIomVGqrrkwZzvxqyW+WJMB2shGNFw5J
+mKYBiiXsHl4Bi7V4zhXssrLp877sqpNLeXloXBmAlT39SwQTP9ImZaV5R6udqlvo
+Gfgm5PH/WeK6MV3n5ik0v1rS0LwR2o82WlIB6a4iSEbzY3qSLsWOwt8o5QjAVzCR
+tNdbdS3U8nrG73iA2clmF57ARQWC
-----END CERTIFICATE-----
diff --git a/spec/data/windows_certificates/test.pfx b/spec/data/windows_certificates/test.pfx
index c774e12efd..2c208bf7c6 100644
--- a/spec/data/windows_certificates/test.pfx
+++ b/spec/data/windows_certificates/test.pfx
Binary files differ
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