File: trusted_facts_spec.rb

package info (click to toggle)
ruby-rspec-puppet 4.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ruby: 6,377; makefile: 6
file content (50 lines) | stat: -rw-r--r-- 1,832 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
# frozen_string_literal: true

require 'spec_helper'

describe 'trusted_facts' do
  context 'FQDN as certname' do
    let(:node) { 'trusted.example.com' }

    it { is_expected.to contain_class('trusted_facts') }
    it { is_expected.to compile.with_all_deps }
    it { is_expected.to contain_notify("certname-#{node}") }
    it { is_expected.to contain_notify('authenticated-remote') }
    it { is_expected.to contain_notify('hostname-trusted') }
    it { is_expected.to contain_notify('domain-example.com') }
    it { is_expected.to contain_notify('no-extensions') }
  end

  context 'shortname as certname' do
    let(:node) { 'trusted' }

    it { is_expected.to contain_class('trusted_facts') }
    it { is_expected.to compile.with_all_deps }
    it { is_expected.to contain_notify("certname-#{node}") }
    it { is_expected.to contain_notify('authenticated-remote') }
    it { is_expected.to contain_notify('hostname-trusted') }
    it { is_expected.to contain_notify('domain-') }
    it { is_expected.to contain_notify('no-extensions') }
  end

  context 'with extensions' do
    extensions = {
      :pp_uuid => 'ED803750-E3C7-44F5-BB08-41A04433FE2E',
      '1.3.6.1.4.1.34380.1.2.1' => 'ssl-termination'
    }
    let(:trusted_facts) { extensions }
    let(:node) { 'trusted.example.com' }

    it { is_expected.to contain_class('trusted_facts') }
    it { is_expected.to compile.with_all_deps }
    it { is_expected.to contain_notify("certname-#{node}") }
    it { is_expected.to contain_notify('authenticated-remote') }
    it { is_expected.to contain_notify('hostname-trusted') }
    it { is_expected.to contain_notify('domain-example.com') }
    it { is_expected.not_to contain_notify('no-extensions') }

    extensions.each do |k, v|
      it { is_expected.to contain_notify("extension-#{k}-#{v}") }
    end
  end
end