From f22840500e7daccd899087ee194c06a76db0d02b Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Fri, 19 Apr 2024 15:37:47 +0200 Subject: [PATCH] DNM: test bundler 2.4.22 Depends-On: https://review.opendev.org/c/openstack/puppet-openstack-integration/+/916425 Change-Id: I5e2445d0b9c6dd20fe9d34f7af37e3c9f835e604 --- manifests/init.pp | 1 + spec/classes/nova_compute_provider_spec.rb | 210 ++++++++++----------- 2 files changed, 98 insertions(+), 113 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 72dd6e0b9..d8352479f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,3 +1,4 @@ +# test3 # == Class: nova # # This class is used to specify configuration parameters that are common diff --git a/spec/classes/nova_compute_provider_spec.rb b/spec/classes/nova_compute_provider_spec.rb index a20cfd3bf..1b00ae656 100644 --- a/spec/classes/nova_compute_provider_spec.rb +++ b/spec/classes/nova_compute_provider_spec.rb @@ -4,13 +4,11 @@ require 'spec_helper' describe 'nova::compute::provider' do - let :params do {} end - shared_examples_for 'nova custom resource providers' do - + shared_examples 'nova::compute::provider' do it 'configure nova.conf with default parameters' do is_expected.to contain_nova_config('compute/provider_config_location').with_value('/etc/nova/provider_config') end @@ -28,7 +26,7 @@ describe 'nova::compute::provider' do end context 'when providing custom inventory single inventory without uuid or name set' do - before :each do + before do params.merge!( :custom_inventories => [ { @@ -55,35 +53,32 @@ describe 'nova::compute::provider' do end it 'configure provider.yaml on compute nodes' do - is_expected.to contain_file('/etc/nova/provider_config/provider.yaml') - verify_contents(catalogue, '/etc/nova/provider_config/provider.yaml', [ - "meta:", - " schema_version: \'1.0\'", - "providers:", - " # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html", - " - identification:", - " uuid: \'$COMPUTE_NODE\'", - " inventories:", - " additional:", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_1:", - " allocation_ratio: 1.0", - " max_unit: 10", - " min_unit: 1", - " reserved: 0", - " step_size: 1", - " total: 100", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_2:", - " total: 100", - " traits:", - " additional:", - " - \'CUSTOM_P_STATE_ENABLED\'", - " - \'CUSTOM_C_STATE_ENABLED\'" - ]) + is_expected.to contain_file('/etc/nova/provider_config/provider.yaml').with_content("meta: + schema_version: \'1.0\' +providers: + # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html + - identification: + uuid: \'$COMPUTE_NODE\' + inventories: + additional: + - CUSTOM_EXAMPLE_RESOURCE_CLASS_1: + total: 100 + reserved: 0 + min_unit: 1 + max_unit: 10 + step_size: 1 + allocation_ratio: 1.0 + - CUSTOM_EXAMPLE_RESOURCE_CLASS_2: + total: 100 + traits: + additional: + - \'CUSTOM_P_STATE_ENABLED\' + - \'CUSTOM_C_STATE_ENABLED\'") end end context 'when providing custom inventory single inventory with uuid set' do - before :each do + before do params.merge!( :custom_inventories => [ { @@ -111,35 +106,32 @@ describe 'nova::compute::provider' do end it 'configure provider.yaml on compute nodes' do - is_expected.to contain_file('/etc/nova/provider_config/provider.yaml') - verify_contents(catalogue, '/etc/nova/provider_config/provider.yaml', [ - "meta:", - " schema_version: \'1.0\'", - "providers:", - " # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html", - " - identification:", - " uuid: \'5213b75d-9260-42a6-b236-f39b0fd10561\'", - " inventories:", - " additional:", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_1:", - " allocation_ratio: 1.0", - " max_unit: 10", - " min_unit: 1", - " reserved: 0", - " step_size: 1", - " total: 100", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_2:", - " total: 100", - " traits:", - " additional:", - " - \'CUSTOM_P_STATE_ENABLED\'", - " - \'CUSTOM_C_STATE_ENABLED\'" - ]) + is_expected.to contain_file('/etc/nova/provider_config/provider.yaml').with_content("meta: + schema_version: \'1.0\' +providers: + # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html + - identification: + uuid: \'5213b75d-9260-42a6-b236-f39b0fd10561\' + inventories: + additional: + - CUSTOM_EXAMPLE_RESOURCE_CLASS_1: + total: 100 + reserved: 0 + min_unit: 1 + max_unit: 10 + step_size: 1 + allocation_ratio: 1.0 + - CUSTOM_EXAMPLE_RESOURCE_CLASS_2: + total: 100 + traits: + additional: + - \'CUSTOM_P_STATE_ENABLED\' + - \'CUSTOM_C_STATE_ENABLED\'") end end context 'when providing custom inventory single inventory with name set' do - before :each do + before do params.merge!( :custom_inventories => [ { @@ -167,35 +159,32 @@ describe 'nova::compute::provider' do end it 'configure provider.yaml on compute nodes' do - is_expected.to contain_file('/etc/nova/provider_config/provider.yaml') - verify_contents(catalogue, '/etc/nova/provider_config/provider.yaml', [ - "meta:", - " schema_version: \'1.0\'", - "providers:", - " # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html", - " - identification:", - " name: \'EXAMPLE_RESOURCE_PROVIDER\'", - " inventories:", - " additional:", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_1:", - " allocation_ratio: 1.0", - " max_unit: 10", - " min_unit: 1", - " reserved: 0", - " step_size: 1", - " total: 100", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_2:", - " total: 100", - " traits:", - " additional:", - " - \'CUSTOM_P_STATE_ENABLED\'", - " - \'CUSTOM_C_STATE_ENABLED\'" - ]) + is_expected.to contain_file('/etc/nova/provider_config/provider.yaml').with_content("meta: + schema_version: \'1.0\' +providers: + # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html + - identification: + name: \'EXAMPLE_RESOURCE_PROVIDER\' + inventories: + additional: + - CUSTOM_EXAMPLE_RESOURCE_CLASS_1: + total: 100 + reserved: 0 + min_unit: 1 + max_unit: 10 + step_size: 1 + allocation_ratio: 1.0 + - CUSTOM_EXAMPLE_RESOURCE_CLASS_2: + total: 100 + traits: + additional: + - \'CUSTOM_P_STATE_ENABLED\' + - \'CUSTOM_C_STATE_ENABLED\'") end end context 'when providing custom inventory with multiple providers' do - before :each do + before do params.merge!( :custom_inventories => [ { @@ -231,39 +220,34 @@ describe 'nova::compute::provider' do end it 'configure provider.yaml on compute nodes' do - is_expected.to contain_file('/etc/nova/provider_config/provider.yaml') - verify_contents(catalogue, '/etc/nova/provider_config/provider.yaml', [ - "meta:", - " schema_version: \'1.0\'", - "providers:", - " # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html", - " - identification:", - " uuid: \'$COMPUTE_NODE\'", - " inventories:", - " additional:", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_1:", - " allocation_ratio: 1.0", - " max_unit: 10", - " min_unit: 1", - " reserved: 0", - " step_size: 1", - " total: 100", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS_2:", - " total: 100", - " traits:", - " additional:", - " - \'CUSTOM_P_STATE_ENABLED\'", - " - \'CUSTOM_C_STATE_ENABLED\'", - " - identification:", - " name: \'EXAMPLE_RESOURCE_PROVIDER\'", - " inventories:", - " additional:", - " - CUSTOM_EXAMPLE_RESOURCE_CLASS:", - " reserved: 100", - " total: 10000", - " traits:", - " additional:" - ]) + is_expected.to contain_file('/etc/nova/provider_config/provider.yaml').with_content("meta: + schema_version: \'1.0\' +providers: + # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html + - identification: + uuid: \'$COMPUTE_NODE\' + inventories: + additional: + - CUSTOM_EXAMPLE_RESOURCE_CLASS_1: + total: 100 + reserved: 0 + min_unit: 1 + max_unit: 10 + step_size: 1 + allocation_ratio: 1.0 + - CUSTOM_EXAMPLE_RESOURCE_CLASS_2: + total: 100 + traits: + additional: + - \'CUSTOM_P_STATE_ENABLED\' + - \'CUSTOM_C_STATE_ENABLED\' + - identification: + name: \'EXAMPLE_RESOURCE_PROVIDER\' + inventories: + additional: + - CUSTOM_EXAMPLE_RESOURCE_CLASS: + total: 10000 + reserved: 100") end end end @@ -276,7 +260,7 @@ describe 'nova::compute::provider' do facts.merge!(OSDefaults.get_facts()) end - it_configures 'nova custom resource providers' + it_behaves_like 'nova::compute::provider' end end end