Browse Source

Remove redundantly tested code

Remove code that is redundantly tested.

This should not be tested here but in puppet-oslo
where this logic resides.

If we keep this and we do changes in puppet-oslo we
will break these unit tests, this is something we need
to sort out for all modules.

Change-Id: I96eeeeec72ac565f2917e94359c449bab85577db
tags/14.3.0
Tobias Urdin 4 months ago
parent
commit
ca287bfe48
1 changed files with 11 additions and 61 deletions
  1. 11
    61
      spec/classes/heat_db_spec.rb

+ 11
- 61
spec/classes/heat_db_spec.rb View File

@@ -1,13 +1,11 @@
1 1
 require 'spec_helper'
2 2
 
3 3
 describe 'heat::db' do
4
-
5 4
   shared_examples 'heat::db' do
6
-
7 5
     context 'with default parameters' do
6
+      it { should contain_class('heat::deps') }
8 7
 
9
-      it { is_expected.to contain_class('heat::db::sync') }
10
-      it { is_expected.to contain_oslo__db('heat_config').with(
8
+      it { should contain_oslo__db('heat_config').with(
11 9
         :db_max_retries => '<SERVICE DEFAULT>',
12 10
         :connection     => 'sqlite:////var/lib/heat/heat.sqlite',
13 11
         :idle_timeout   => '<SERVICE DEFAULT>',
@@ -19,11 +17,13 @@ describe 'heat::db' do
19 17
         :pool_timeout   => '<SERVICE DEFAULT>',
20 18
       )}
21 19
 
20
+      it { should contain_class('heat::db::sync') }
22 21
     end
23 22
 
24 23
     context 'with specific parameters' do
25 24
       let :params do
26
-        { :database_connection     => 'mysql+pymysql://heat:heat@localhost/heat',
25
+        {
26
+          :database_connection     => 'mysql+pymysql://heat:heat@localhost/heat',
27 27
           :database_idle_timeout   => '3601',
28 28
           :database_min_pool_size  => '2',
29 29
           :database_max_pool_size  => '12',
@@ -32,11 +32,13 @@ describe 'heat::db' do
32 32
           :database_db_max_retries => '-1',
33 33
           :database_max_overflow   => '21',
34 34
           :database_pool_timeout   => '21',
35
-          :sync_db                 => false }
35
+          :sync_db                 => false
36
+        }
36 37
       end
37 38
 
38
-      it { is_expected.not_to contain_class('heat::db::sync') }
39
-      it { is_expected.to contain_oslo__db('heat_config').with(
39
+      it { should contain_class('heat::deps') }
40
+
41
+      it { should contain_oslo__db('heat_config').with(
40 42
         :db_max_retries => '-1',
41 43
         :connection     => 'mysql+pymysql://heat:heat@localhost/heat',
42 44
         :idle_timeout   => '3601',
@@ -48,45 +50,8 @@ describe 'heat::db' do
48 50
         :pool_timeout   => '21',
49 51
       )}
50 52
 
53
+      it { should_not contain_class('heat::db::sync') }
51 54
     end
52
-
53
-    context 'with MySQL-python library as backend package' do
54
-      let :params do
55
-        { :database_connection => 'mysql://heat:heat@localhost/heat' }
56
-      end
57
-
58
-      it { is_expected.to contain_oslo__db('heat_config').with(
59
-        :connection => 'mysql://heat:heat@localhost/heat',
60
-      )}
61
-    end
62
-
63
-    context 'with postgresql backend' do
64
-      let :params do
65
-        { :database_connection => 'postgresql://heat:heat@localhost/heat', }
66
-      end
67
-
68
-      it 'install the proper backend package' do
69
-        is_expected.to contain_package('python-psycopg2').with(:ensure => 'present')
70
-      end
71
-
72
-    end
73
-
74
-    context 'with incorrect database_connection string' do
75
-      let :params do
76
-        { :database_connection => 'redis://heat:heat@localhost/heat', }
77
-      end
78
-
79
-      it_raises 'a Puppet::Error', /validate_re/
80
-    end
81
-
82
-    context 'with incorrect database_connection string' do
83
-      let :params do
84
-        { :database_connection => 'foo+pymysql://heat:heat@localhost/heat', }
85
-      end
86
-
87
-      it_raises 'a Puppet::Error', /validate_re/
88
-    end
89
-
90 55
   end
91 56
 
92 57
   on_supported_os({
@@ -98,21 +63,6 @@ describe 'heat::db' do
98 63
       end
99 64
 
100 65
       it_behaves_like 'heat::db'
101
-
102
-      context 'using pymysql driver' do
103
-        let :params do
104
-          { :database_connection => 'mysql+pymysql://heat:heat@localhost/heat' }
105
-        end
106
-
107
-        case facts[:osfamily]
108
-        when 'Debian'
109
-          it { is_expected.to contain_package('python-pymysql').with({ :ensure => 'present', :name => 'python-pymysql' }) }
110
-        when 'RedHat'
111
-          it { is_expected.not_to contain_package('python-pymysql') }
112
-        end
113
-      end
114
-
115 66
     end
116 67
   end
117
-
118 68
 end

Loading…
Cancel
Save