File: swift_memcache_spec.rb

package info (click to toggle)
puppet-module-swift 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,480 kB
  • sloc: ruby: 9,604; python: 33; makefile: 10; sh: 10
file content (70 lines) | stat: -rw-r--r-- 2,809 bytes parent folder | download | duplicates (2)
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
require 'spec_helper'

describe 'swift::memcache' do
  shared_examples 'swift::memcache' do

    describe 'when using default parameters' do
      it { is_expected.to contain_file('/etc/swift/memcache.conf').with(
        :ensure => 'file',
        :owner  => 'root',
        :group  => 'swift',
        :mode   => '0640',
      )}

      it { is_expected.to contain_swift_memcache_config(
        'memcache/memcache_servers').with_value(['127.0.0.1:11211']) }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/memcache_serialization_support').with_value('<SERVICE DEFAULT>') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/memcache_max_connections').with_value('<SERVICE DEFAULT>') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/connect_timeout').with_value('<SERVICE DEFAULT>') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/pool_timeout').with_value('<SERVICE DEFAULT>') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/tries').with_value('<SERVICE DEFAULT>') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/io_timeout').with_value('<SERVICE DEFAULT>') }
    end

    describe 'when overriding parameters' do
      let :params do
        {
          :memcache_servers               => ['1.1.1.1:11211', '2.2.2.2:11211'],
          :memcache_serialization_support => 1,
          :memcache_max_connections       => 3,
          :connect_timeout                => '0.5',
          :pool_timeout                   => '2.0',
          :tries                          => 5,
          :io_timeout                     => '1.0'
        }
      end
      it { is_expected.to contain_swift_memcache_config(
        'memcache/memcache_servers').with_value('1.1.1.1:11211,2.2.2.2:11211') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/memcache_serialization_support').with_value('1') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/memcache_max_connections').with_value('3') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/connect_timeout').with_value('0.5') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/pool_timeout').with_value('2.0') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/tries').with_value('5') }
      it {  is_expected.to contain_swift_memcache_config(
        'memcache/io_timeout').with_value('1.0') }
    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_configures 'swift::memcache'
    end
  end
end