File: nova_db_spec.rb

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (99 lines) | stat: -rw-r--r-- 4,065 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
require 'spec_helper'

describe 'nova::db' do
  let :params do
    {}
  end

  shared_examples 'nova::db' do
    context 'with default parameters' do
      it { should contain_oslo__db('nova_config').with(
        :connection              => '<SERVICE DEFAULT>',
        :slave_connection        => '<SERVICE DEFAULT>',
        :db_max_retries          => '<SERVICE DEFAULT>',
        :connection_recycle_time => '<SERVICE DEFAULT>',
        :max_pool_size           => '<SERVICE DEFAULT>',
        :max_retries             => '<SERVICE DEFAULT>',
        :retry_interval          => '<SERVICE DEFAULT>',
        :max_overflow            => '<SERVICE DEFAULT>',
        :pool_timeout            => '<SERVICE DEFAULT>',
        :mysql_enable_ndb        => '<SERVICE DEFAULT>',
      )}
      it { should contain_oslo__db('api_database').with(
        :config                  => 'nova_config',
        :config_group            => 'api_database',
        :connection              => '<SERVICE DEFAULT>',
        :slave_connection        => '<SERVICE DEFAULT>',
        :connection_recycle_time => '<SERVICE DEFAULT>',
        :max_pool_size           => '<SERVICE DEFAULT>',
        :max_retries             => '<SERVICE DEFAULT>',
        :retry_interval          => '<SERVICE DEFAULT>',
        :max_overflow            => '<SERVICE DEFAULT>',
        :pool_timeout            => '<SERVICE DEFAULT>',
      )}
    end

    context 'with overridden parameters' do
      before :each do
        params.merge!(
          :database_connection                  => 'mysql+pymysql://user:pass@db/db1',
          :slave_connection                     => 'mysql+pymysql://user:pass@slave/db1',
          :database_connection_recycle_time     => '1800',
          :database_max_pool_size               => '30',
          :database_max_retries                 => '20',
          :database_retry_interval              => '15',
          :database_max_overflow                => '5',
          :database_pool_timeout                => '20',
          :database_db_max_retries              => '10',
          :mysql_enable_ndb                     => 'true',
          :api_database_connection              => 'mysql+pymysql://user:pass@db/db2',
          :api_slave_connection                 => 'mysql+pymysql://user:pass@slave/db2',
          :api_database_connection_recycle_time => '600',
          :api_database_max_pool_size           => '20',
          :api_database_max_retries             => '10',
          :api_database_retry_interval          => '5',
          :api_database_max_overflow            => '0',
          :api_database_pool_timeout            => '30',
        )
      end

      it { should contain_oslo__db('nova_config').with(
        :connection              => 'mysql+pymysql://user:pass@db/db1',
        :slave_connection        => 'mysql+pymysql://user:pass@slave/db1',
        :connection_recycle_time => '1800',
        :max_pool_size           => '30',
        :max_retries             => '20',
        :retry_interval          => '15',
        :max_overflow            => '5',
        :pool_timeout            => '20',
        :db_max_retries          => '10',
        :mysql_enable_ndb        => 'true',
      )}

      it { should contain_oslo__db('api_database').with(
        :config                  => 'nova_config',
        :config_group            => 'api_database',
        :connection              => 'mysql+pymysql://user:pass@db/db2',
        :slave_connection        => 'mysql+pymysql://user:pass@slave/db2',
        :connection_recycle_time => '600',
        :max_pool_size           => '20',
        :max_retries             => '10',
        :retry_interval          => '5',
        :max_overflow            => '0',
        :pool_timeout            => '30',
      )}
    end
  end

  on_supported_os({
    :supported_os => OSDefaults.get_supported_os
  }).each do |os,facts|
    context "on #{os}" do
      let (:facts) do
        facts.merge!(OSDefaults.get_facts())
      end

      it_behaves_like 'nova::db'
    end
  end
end