summaryrefslogtreecommitdiff
path: root/spec/classes/onionbalance_spec.rb
blob: ff9bb2759fd731ecc780fbeafa67450588c11a38 (plain)
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
require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper'))

describe 'tor::onionbalance', :type => 'class' do
  let(:default_facts) {
    {
      :osfamily        => 'RedHat',
      :operatingsystem => 'CentOS',
    }
  }
  let(:facts){ default_facts }
  let(:pre_condition){'Exec{path => "/bin"}' }
  let(:params){
    {
      :services  => {
        'keyname_of_service1' => {
          'name1'        => 'onionservice_addr_3',
          'name2'        => 'onionservice_addr_2',
          '_key_content' => 'content_of_key_of_onionbalanced_service1',
        },
      },
    }
  }
  describe 'with standard' do
    it { is_expected.to compile.with_all_deps }

    it { is_expected.to contain_package('python2-onionbalance').with(
      :ensure => 'installed',
    ) }
    it { is_expected.to contain_service('tor@onionbalance').with(
      :ensure => 'running',
      :enable => true,
    ) }
    it { is_expected.to contain_service('onionbalance').with(
      :ensure    => 'running',
      :enable    => true,
      :subscribe => 'Service[tor@onionbalance]',
    ) }
    context 'on Debian' do
      let(:facts) {
        {
          :osfamily        => 'Debian',
          :operatingsystem => 'Debian',
        }
      }
      it { is_expected.to compile.with_all_deps }
      it { is_expected.to contain_package('onionbalance').with(
        :ensure => 'installed',
      ) }
      it { is_expected.to contain_service('tor@onionbalance').with(
        :ensure => 'running',
        :enable => true,
      ) }
      it { is_expected.to contain_service('onionbalance').with(
        :ensure    => 'running',
        :enable    => true,
        :subscribe => 'Service[tor@onionbalance]',
      ) }
    end
  end
end