From a002cad4d3d327a900961c87515967aa53cb8cfa Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 9 Jul 2022 11:57:57 +0900 Subject: [PATCH] Extend coverage of config acceptance tests Change-Id: I9ea1a85f4dedcd08f6c9a5463dc390fad5892009 --- ...glance_spec.rb => 10_basic_glance_spec.rb} | 0 ...onfig_spec.rb => 99_glance_config_spec.rb} | 79 +++++++++++++++++++ 2 files changed, 79 insertions(+) rename spec/acceptance/{basic_glance_spec.rb => 10_basic_glance_spec.rb} (100%) rename spec/acceptance/{glance_config_spec.rb => 99_glance_config_spec.rb} (57%) diff --git a/spec/acceptance/basic_glance_spec.rb b/spec/acceptance/10_basic_glance_spec.rb similarity index 100% rename from spec/acceptance/basic_glance_spec.rb rename to spec/acceptance/10_basic_glance_spec.rb diff --git a/spec/acceptance/glance_config_spec.rb b/spec/acceptance/99_glance_config_spec.rb similarity index 57% rename from spec/acceptance/glance_config_spec.rb rename to spec/acceptance/99_glance_config_spec.rb index bd2582e8..d8ea3e54 100644 --- a/spec/acceptance/glance_config_spec.rb +++ b/spec/acceptance/99_glance_config_spec.rb @@ -11,6 +11,8 @@ describe 'basic glance config resource' do File <||> -> Glance_api_config <||> File <||> -> Glance_cache_config <||> File <||> -> Glance_image_import_config <||> + File <||> -> Glance_swift_config <||> + File <||> -> Glance_api_paste_ini <||> file { '/etc/glance' : ensure => directory, @@ -24,6 +26,9 @@ describe 'basic glance config resource' do file { '/etc/glance/glance-image-import.conf' : ensure => file, } + file { '/etc/glance/glance-api-paste.ini' : + ensure => file, + } glance_api_config { 'DEFAULT/thisshouldexist' : value => 'foo', @@ -43,6 +48,10 @@ describe 'basic glance config resource' do ensure_absent_val => 'toto', } + glance_api_config { 'DEFAULT/thisshouldexist3' : + value => ['foo', 'bar'], + } + glance_cache_config { 'DEFAULT/thisshouldexist' : value => 'foo', } @@ -61,6 +70,10 @@ describe 'basic glance config resource' do ensure_absent_val => 'toto', } + glance_cache_config { 'DEFAULT/thisshouldexist3' : + value => ['foo', 'bar'], + } + glance_image_import_config { 'DEFAULT/thisshouldexist' : value => 'foo', } @@ -79,6 +92,46 @@ describe 'basic glance config resource' do ensure_absent_val => 'toto', } + glance_swift_config { 'DEFAULT/thisshouldexist' : + value => 'foo', + } + + glance_swift_config { 'DEFAULT/thisshouldnotexist' : + value => '', + } + + glance_swift_config { 'DEFAULT/thisshouldexist2' : + value => '', + ensure_absent_val => 'toto', + } + + glance_swift_config { 'DEFAULT/thisshouldnotexist2' : + value => 'toto', + ensure_absent_val => 'toto', + } + + glance_api_paste_ini { 'DEFAULT/thisshouldexist' : + value => 'foo', + } + + glance_api_paste_ini { 'DEFAULT/thisshouldnotexist' : + value => '', + } + + glance_api_paste_ini { 'DEFAULT/thisshouldexist2' : + value => '', + ensure_absent_val => 'toto', + } + + glance_api_paste_ini { 'DEFAULT/thisshouldnotexist2' : + value => 'toto', + ensure_absent_val => 'toto', + } + + glance_api_paste_ini { 'DEFAULT/thisshouldexist3' : + value => 'foo', + key_val_separator => ':' + } EOS @@ -91,6 +144,8 @@ describe 'basic glance config resource' do it { is_expected.to exist } it { is_expected.to contain('thisshouldexist=foo') } it { is_expected.to contain('thisshouldexist2=') } + it { is_expected.to contain('thisshouldexist3=foo') } + it { is_expected.to contain('thisshouldexist3=bar') } describe '#content' do subject { super().content } @@ -102,6 +157,8 @@ describe 'basic glance config resource' do it { is_expected.to exist } it { is_expected.to contain('thisshouldexist=foo') } it { is_expected.to contain('thisshouldexist2=') } + it { is_expected.to contain('thisshouldexist3=foo') } + it { is_expected.to contain('thisshouldexist3=bar') } describe '#content' do subject { super().content } @@ -120,5 +177,27 @@ describe 'basic glance config resource' do end end + describe file('/etc/glance/glance-swift.conf') do + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.not_to match /thisshouldnotexist/ } + end + end + + describe file('/etc/glance/glance-api-paste.ini') do + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + it { is_expected.to contain('thisshouldexist3:foo') } + + describe '#content' do + subject { super().content } + it { is_expected.not_to match /thisshouldnotexist/ } + end + end end end