|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +# Copyright (c) 2022 The Regents of the University of Michigan. |
| 4 | +# All Rights Reserved. Licensed according to the terms of the Revised |
| 5 | +# BSD License. See LICENSE.txt for details. |
| 6 | +require 'spec_helper' |
| 7 | + |
| 8 | +describe 'nebula::profile::client_cert' do |
| 9 | + on_supported_os.each do |os, os_facts| |
| 10 | + context "on #{os}" do |
| 11 | + let(:facts) { os_facts } |
| 12 | + |
| 13 | + it { is_expected.to compile } |
| 14 | + |
| 15 | + context 'on a host called default.invalid' do |
| 16 | + let(:node) { 'default.invalid' } |
| 17 | + let(:cert_path) { '/etc/ssl/private/default.invalid.pem' } |
| 18 | + let(:puppet_ssl) { '/etc/puppetlabs/puppet/ssl' } |
| 19 | + |
| 20 | + it { is_expected.to compile } |
| 21 | + it { is_expected.to contain_concat(cert_path) } |
| 22 | + it { is_expected.to contain_concat__fragment("#{cert_path} cert").with_target(cert_path) } |
| 23 | + it { is_expected.to contain_concat__fragment("#{cert_path} cert").with_source("#{puppet_ssl}/certs/default.invalid.pem") } |
| 24 | + it { is_expected.to contain_concat__fragment("#{cert_path} key").with_target(cert_path) } |
| 25 | + it { is_expected.to contain_concat__fragment("#{cert_path} key").with_source("#{puppet_ssl}/private_keys/default.invalid.pem") } |
| 26 | + end |
| 27 | + |
| 28 | + context 'on a host called abc' do |
| 29 | + let(:node) { 'abc' } |
| 30 | + let(:cert_path) { '/etc/ssl/private/abc.pem' } |
| 31 | + let(:puppet_ssl) { '/etc/puppetlabs/puppet/ssl' } |
| 32 | + |
| 33 | + it { is_expected.to compile } |
| 34 | + it { is_expected.to contain_concat(cert_path) } |
| 35 | + it { is_expected.to contain_concat__fragment("#{cert_path} cert").with_target(cert_path) } |
| 36 | + it { is_expected.to contain_concat__fragment("#{cert_path} cert").with_source("#{puppet_ssl}/certs/abc.pem") } |
| 37 | + it { is_expected.to contain_concat__fragment("#{cert_path} key").with_target(cert_path) } |
| 38 | + it { is_expected.to contain_concat__fragment("#{cert_path} key").with_source("#{puppet_ssl}/private_keys/abc.pem") } |
| 39 | + end |
| 40 | + end |
| 41 | + end |
| 42 | +end |
0 commit comments