
In Chef Infra Client 16.2, resources have to be named using the provides method. The resource_name method has not been changed in order to be compatible with Chef Infra Client <16.2. Also fix URI.encode and URI.decode deprecations. Update etcd depends to ~> 6.0 to fix Chef 16 deprecation warnings. Backport ChefSpec fix for cookstyle. Depends-On: https://review.opendev.org/749561 Change-Id: Ia520aa74197c30f61424dd2b6ff1ccfb359f7163 Signed-off-by: Henrique Santos <hfigueiredosantos@tecnico.ulisboa.pt> Signed-off-by: Lance Albertson <lance@osuosl.org>
39 lines
1.4 KiB
Ruby
39 lines
1.4 KiB
Ruby
# encoding: UTF-8
|
|
require_relative 'spec_helper'
|
|
require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'wrappers'
|
|
|
|
describe 'openstack-common::default' do
|
|
describe 'Openstack wrappers' do
|
|
let(:runner) { ChefSpec::SoloRunner.new(CHEFSPEC_OPTS) }
|
|
let(:node) { runner.node }
|
|
cached(:chef_run) do
|
|
runner.converge(described_recipe)
|
|
end
|
|
let(:subject) { Object.new.extend(Openstack) }
|
|
|
|
include_context 'library-stubs'
|
|
|
|
describe '#recipe_included' do
|
|
it 'returns boolean for recipe list' do
|
|
node_hash = {
|
|
'recipes' => 'included_recipe',
|
|
}
|
|
allow(subject).to receive(:node).and_return(node_hash)
|
|
expect(subject.recipe_included?('included_recipe')).to be_truthy
|
|
expect(subject.recipe_included?('not_included_recipe')).to be_falsey
|
|
end
|
|
end
|
|
|
|
describe '#role_included' do
|
|
it 'returns boolean for role list' do
|
|
node_hash_true = double('node', automatic: { 'roles' => 'included_role' }, role?: true)
|
|
node_hash_false = double('node', automatic: { 'roles' => 'included_role' }, role?: false)
|
|
allow(subject).to receive(:node).and_return(node_hash_true)
|
|
expect(subject.role_included?('included_role')).to be_truthy
|
|
allow(subject).to receive(:node).and_return(node_hash_false)
|
|
expect(subject.role_included?('not_included_role')).to be_falsey
|
|
end
|
|
end
|
|
end
|
|
end
|