summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-20 15:51:34 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-20 15:51:34 -0700
commit2fcc10204cc6317b5e9303467ff8afe5e520aa00 (patch)
tree075f1f808e32e1a5cbcb0d0f1cb47e5e5ed52551 /spec
parentad6c5532a8faa9e96624d7e6cf74aae587e90fe0 (diff)
parentbad674c731f2243c8f9d9250c19e0afaa956df1f (diff)
downloadchef-2fcc10204cc6317b5e9303467ff8afe5e520aa00.tar.gz
Merge pull request #2263 from opscode/sersut/chef-rc-fixes
Misc RC spec fixes that we ran into in CI.
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/cron_spec.rb8
-rw-r--r--spec/functional/resource/rpm_spec.rb5
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/chef_helpers.rb1
-rw-r--r--spec/support/platform_helpers.rb4
-rw-r--r--spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb2
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb4
7 files changed, 19 insertions, 6 deletions
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index 0a19fae0ed..287b5a1391 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -17,6 +17,7 @@
# limitations under the License.
#
+require 'spec_helper'
require 'functional/resource/base'
require 'chef/mixin/shell_out'
@@ -55,7 +56,12 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
let(:new_resource) do
new_resource = Chef::Resource::Cron.new("Chef functional test cron", run_context)
new_resource.user 'root'
- new_resource.minute '@hourly'
+ # @hourly is not supported on solaris
+ if ohai[:platform] == "solaris" || ohai[:platform] == "solaris2"
+ new_resource.minute "0 * * * *"
+ else
+ new_resource.minute '@hourly'
+ end
new_resource.hour ''
new_resource.day ''
new_resource.month ''
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index 7825377c6b..2e452d7e2e 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -16,6 +16,7 @@
# limitations under the License.
#
+require 'spec_helper'
require 'functional/resource/base'
require 'chef/mixin/shell_out'
@@ -60,12 +61,12 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
@pkg_name = "dummy"
@pkg_version = "1-0"
@pkg_path = "/tmp/dummy-1-0.aix6.1.noarch.rpm"
- FileUtils.cp 'spec/functional/assets/dummy-1-0.aix6.1.noarch.rpm' , @pkg_path
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-1-0.aix6.1.noarch.rpm') , @pkg_path)
when "centos", "redhat", "suse"
@pkg_name = "mytest"
@pkg_version = "1.0-1"
@pkg_path = "/tmp/mytest-1.0-1.noarch.rpm"
- FileUtils.cp 'spec/functional/assets/mytest-1.0-1.noarch.rpm' , @pkg_path
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-1.0-1.noarch.rpm') , @pkg_path)
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e282a88100..d29215f5fe 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -133,6 +133,7 @@ RSpec.configure do |config|
config.filter_run_excluding :ruby_gte_20_and_openssl_gte_101 => true unless (ruby_gte_20? && openssl_gte_101?)
config.filter_run_excluding :openssl_lt_101 => true unless openssl_lt_101?
config.filter_run_excluding :ruby_lt_20 => true unless ruby_lt_20?
+ config.filter_run_excluding :aes_256_gcm_only => true unless aes_256_gcm?
running_platform_arch = `uname -m`.strip
diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb
index f31355f50a..237543748c 100644
--- a/spec/support/chef_helpers.rb
+++ b/spec/support/chef_helpers.rb
@@ -14,6 +14,7 @@
# limitations under the License.
#
CHEF_SPEC_DATA = File.expand_path(File.dirname(__FILE__) + "/../data/")
+CHEF_SPEC_ASSETS = File.expand_path(File.dirname(__FILE__) + "/../functional/assets/")
CHEF_SPEC_BACKUP_PATH = File.join(Dir.tmpdir, 'test-backup-path')
Chef::Config[:log_level] = :fatal
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index f8cad6de7f..8d17af3993 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -165,3 +165,7 @@ end
def openssl_lt_101?
!openssl_gte_101?
end
+
+def aes_256_gcm?
+ OpenSSL::Cipher.ciphers.include?("aes-256-gcm")
+end
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 1da5efb36e..1e2b2a85e8 100644
--- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
+++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
@@ -83,7 +83,7 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
end
end
- context "when encryption version is 3", :ruby_20_only do
+ context "when encryption version is 3", :aes_256_gcm_only, :ruby_20_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 9335889ef3..499fabdcf9 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", :ruby_gte_20_and_openssl_gte_101 do
+ context "on supported platforms", :aes_256_gcm_only, :ruby_20_only do
it "creates a version 3 encryptor" do
encryptor.should be_a_instance_of(Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor)
@@ -182,7 +182,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", :ruby_gte_20_and_openssl_gte_101 do
+ context "on supported platforms", :aes_256_gcm_only, :ruby_20_only do
let(:encrypted_value) do
Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor.new(plaintext_data, encryption_key).for_encrypted_item