Browse Source

oslo db: check puppet resource instead of actual config in spec

Change-Id: Ie511b047870974096e2db52c6d7a381cb59b78a1
ZhongShengping 2 years ago
parent
commit
45bd308020
2 changed files with 38 additions and 30 deletions
  1. 18
    14
      spec/classes/glance_api_db_spec.rb
  2. 20
    16
      spec/classes/glance_registry_db_spec.rb

+ 18
- 14
spec/classes/glance_api_db_spec.rb View File

@@ -4,13 +4,15 @@ describe 'glance::api::db' do
4 4
 
5 5
   shared_examples 'glance::api::db' do
6 6
     context 'with default parameters' do
7
-      it { is_expected.to contain_glance_api_config('database/connection').with_value('sqlite:///var/lib/glance/glance.sqlite').with_secret(true) }
8
-      it { is_expected.to contain_glance_api_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
9
-      it { is_expected.to contain_glance_api_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
10
-      it { is_expected.to contain_glance_api_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
11
-      it { is_expected.to contain_glance_api_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
12
-      it { is_expected.to contain_glance_api_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
13
-      it { is_expected.to contain_glance_api_config('database/max_overflow').with_value('<SERVICE DEFAULT>') }
7
+      it { is_expected.to contain_oslo__db('glance_api_config').with(
8
+        :connection     => 'sqlite:///var/lib/glance/glance.sqlite',
9
+        :idle_timeout   => '<SERVICE DEFAULT>',
10
+        :min_pool_size  => '<SERVICE DEFAULT>',
11
+        :max_pool_size  => '<SERVICE DEFAULT>',
12
+        :max_retries    => '<SERVICE DEFAULT>',
13
+        :retry_interval => '<SERVICE DEFAULT>',
14
+        :max_overflow   => '<SERVICE DEFAULT>',
15
+      )}
14 16
     end
15 17
 
16 18
     context 'with specific parameters' do
@@ -25,13 +27,15 @@ describe 'glance::api::db' do
25 27
         }
26 28
       end
27 29
 
28
-      it { is_expected.to contain_glance_api_config('database/connection').with_value('mysql+pymysql://glance_api:glance@localhost/glance').with_secret(true) }
29
-      it { is_expected.to contain_glance_api_config('database/idle_timeout').with_value('3601') }
30
-      it { is_expected.to contain_glance_api_config('database/min_pool_size').with_value('2') }
31
-      it { is_expected.to contain_glance_api_config('database/max_retries').with_value('11') }
32
-      it { is_expected.to contain_glance_api_config('database/retry_interval').with_value('11') }
33
-      it { is_expected.to contain_glance_api_config('database/max_pool_size').with_value('11') }
34
-      it { is_expected.to contain_glance_api_config('database/max_overflow').with_value('21') }
30
+      it { is_expected.to contain_oslo__db('glance_api_config').with(
31
+        :connection     => 'mysql+pymysql://glance_api:glance@localhost/glance',
32
+        :idle_timeout   => '3601',
33
+        :min_pool_size  => '2',
34
+        :max_pool_size  => '11',
35
+        :max_retries    => '11',
36
+        :retry_interval => '11',
37
+        :max_overflow   => '21',
38
+      )}
35 39
     end
36 40
 
37 41
     context 'with MySQL-python library as backend package' do

+ 20
- 16
spec/classes/glance_registry_db_spec.rb View File

@@ -4,14 +4,16 @@ describe 'glance::registry::db' do
4 4
 
5 5
   shared_examples 'glance::registry::db' do
6 6
     context 'with default parameters' do
7
-      it { is_expected.to contain_glance_registry_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
8
-      it { is_expected.to contain_glance_registry_config('database/connection').with_value('sqlite:///var/lib/glance/glance.sqlite').with_secret(true) }
9
-      it { is_expected.to contain_glance_registry_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
10
-      it { is_expected.to contain_glance_registry_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
11
-      it { is_expected.to contain_glance_registry_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
12
-      it { is_expected.to contain_glance_registry_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
13
-      it { is_expected.to contain_glance_registry_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
14
-      it { is_expected.to contain_glance_registry_config('database/max_overflow').with_value('<SERVICE DEFAULT>') }
7
+      it { is_expected.to contain_oslo__db('glance_registry_config').with(
8
+        :db_max_retries => '<SERVICE DEFAULT>',
9
+        :connection     => 'sqlite:///var/lib/glance/glance.sqlite',
10
+        :idle_timeout   => '<SERVICE DEFAULT>',
11
+        :min_pool_size  => '<SERVICE DEFAULT>',
12
+        :max_pool_size  => '<SERVICE DEFAULT>',
13
+        :max_retries    => '<SERVICE DEFAULT>',
14
+        :retry_interval => '<SERVICE DEFAULT>',
15
+        :max_overflow   => '<SERVICE DEFAULT>',
16
+      )}
15 17
     end
16 18
 
17 19
     context 'with specific parameters' do
@@ -27,14 +29,16 @@ describe 'glance::registry::db' do
27 29
         }
28 30
       end
29 31
 
30
-      it { is_expected.to contain_glance_registry_config('database/db_max_retries').with_value('-1') }
31
-      it { is_expected.to contain_glance_registry_config('database/connection').with_value('mysql+pymysql://glance_registry:glance@localhost/glance').with_secret(true) }
32
-      it { is_expected.to contain_glance_registry_config('database/idle_timeout').with_value('3601') }
33
-      it { is_expected.to contain_glance_registry_config('database/min_pool_size').with_value('2') }
34
-      it { is_expected.to contain_glance_registry_config('database/max_retries').with_value('11') }
35
-      it { is_expected.to contain_glance_registry_config('database/retry_interval').with_value('11') }
36
-      it { is_expected.to contain_glance_registry_config('database/max_pool_size').with_value('11') }
37
-      it { is_expected.to contain_glance_registry_config('database/max_overflow').with_value('21') }
32
+      it { is_expected.to contain_oslo__db('glance_registry_config').with(
33
+        :db_max_retries => '-1',
34
+        :connection     => 'mysql+pymysql://glance_registry:glance@localhost/glance',
35
+        :idle_timeout   => '3601',
36
+        :min_pool_size  => '2',
37
+        :max_pool_size  => '11',
38
+        :max_retries    => '11',
39
+        :retry_interval => '11',
40
+        :max_overflow   => '21',
41
+      )}
38 42
     end
39 43
 
40 44
     context 'with MySQL-python library as backend package' do

Loading…
Cancel
Save