File: 10_basic_cloudkitty_spec.rb

package info (click to toggle)
puppet-module-cloudkitty 14.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,056 kB
  • sloc: ruby: 2,270; python: 38; sh: 10; makefile: 10
file content (125 lines) | stat: -rw-r--r-- 4,813 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
require 'spec_helper_acceptance'

describe 'basic cloudkitty' do

  context 'default parameters' do

    it 'should work with no errors' do
      pp= <<-EOS
      include openstack_integration
      include openstack_integration::repos
      include openstack_integration::apache
      include openstack_integration::rabbitmq
      include openstack_integration::memcached
      include openstack_integration::mysql
      include openstack_integration::redis
      include openstack_integration::keystone

      if $::openstack_integration::config::ssl {
        openstack_integration::ssl_key { 'cloudkitty':
          notify  => Service['httpd'],
          require => Package['cloudkitty-common'],
        }
        Exec['update-ca-certificates'] ~> Service['httpd']
      }

      openstack_integration::mq_user { 'cloudkitty':
        password => 'an_even_bigger_secret',
        before   => Anchor['cloudkitty::service::begin'],
      }

      # Cloudkitty resources
      class { 'cloudkitty::db':
        database_connection => os_database_connection({
          'dialect'  => 'mysql+pymysql',
          'host'     => $::openstack_integration::config::ip_for_url,
          'username' => 'cloudkitty',
          'password' => 'cloudkitty',
          'database' => 'cloudkitty',
          'charset'  => 'utf8',
          'extra'    => $::openstack_integration::config::db_extra,
        }),
      }
      class { 'cloudkitty::logging':
        debug => true,
      }

      $default_transport_url = os_transport_url({
        'transport' => $::openstack_integration::config::messaging_default_proto,
        'host'      => $::openstack_integration::config::host,
        'port'      => $::openstack_integration::config::messaging_default_port,
        'username'  => 'cloudkitty',
        'password'  => 'an_even_bigger_secret',
      })
      class { 'cloudkitty':
        default_transport_url => $default_transport_url,
        # NOTE(tobias-urdin): Cloudkitty in Stein has moved to storage v2 by default and the
        # only driver available is InfluxDB which we do not deploy. This sets it back to the
        # old sqlalchemy storage driver in version 1.
        storage_backend       => 'sqlalchemy',
        storage_version       => '1',
      }
      class { 'cloudkitty::keystone::auth':
        public_url   => "${::openstack_integration::config::base_url}:8889",
        internal_url => "${::openstack_integration::config::base_url}:8889",
        admin_url    => "${::openstack_integration::config::base_url}:8889",
        roles        => ['admin', 'service'],
        password     => 'a_big_secret',
      }
      class { 'cloudkitty::keystone::authtoken':
        password                     => 'a_big_secret',
        user_domain_name             => 'Default',
        project_domain_name          => 'Default',
        auth_url                     => $::openstack_integration::config::keystone_admin_uri,
        www_authenticate_uri         => $::openstack_integration::config::keystone_auth_uri,
        memcached_servers            => $::openstack_integration::config::memcached_servers,
        service_token_roles_required => true,
      }
      class { 'cloudkitty::db::mysql':
        charset  => $::openstack_integration::params::mysql_charset,
        collate  => $::openstack_integration::params::mysql_collate,
        password => 'cloudkitty',
        host     => $::openstack_integration::config::host,
      }
      class { 'cloudkitty::api':
        service_name => 'httpd',
      }
      include apache
      class { 'cloudkitty::wsgi::apache':
        bind_host => $::openstack_integration::config::host,
        ssl_key   => "/etc/cloudkitty/ssl/private/${facts['networking']['fqdn']}.pem",
        ssl_cert  => $::openstack_integration::params::cert_path,
        ssl       => $::openstack_integration::config::ssl,
        workers   => 2,
      }
      class { 'cloudkitty::processor': }
      class { 'cloudkitty::orchestrator':
        coordination_url => $::openstack_integration::config::tooz_url,
        max_workers      => 2,
        max_threads      => 4,
      }
      class { 'cloudkitty::fetcher::keystone':
        auth_type           => 'password',
        username            => 'cloudkitty',
        password            => 'a_big_secret',
        project_name        => 'services',
        user_domain_name    => 'Default',
        project_domain_name => 'Default',
        auth_url            => $::openstack_integration::config::keystone_admin_uri,
      }
      class { 'cloudkitty::client': }
      EOS


      # Run it twice and test for idempotency
      apply_manifest(pp, :catch_failures => true)
      apply_manifest(pp, :catch_changes => true)
    end

    describe port(8889) do
      it { is_expected.to be_listening }
    end

  end

end