client_spec.rb 2.67 KB
Newer Older
1 2 3
require 'spec_helper'

describe 'freeipa::install::client' do
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
  context 'with node not yet configured' do
    on_supported_os.each do |os, os_facts|
      context "on #{os}" do
        let(:facts) { os_facts }
        let(:pre_condition) do
          manifest = <<-EOS
            class{ 'freeipa' :
              ipa_role                    => 'client',
              ipa_master_fqdn             => 'master.example.lan',
              ipa_server_fqdn             => 'foo.example.lan',
              domain                      => 'example.lan',
              password_usedto_joindomain  => 'foobartest',
              admin_password              => 'foobartest',
              directory_services_password => 'foobartest',
              ip_address                  => '10.10.10.35',
            }
          EOS
          manifest
        end

        it { is_expected.to compile }
      end
    end
  end

  context 'with node configured as client' do
    on_supported_os.each do |os, os_facts|
      context "on #{os}" do
        let(:facts) { os_facts.merge(iparole: 'client') }
        let(:pre_condition) do
          manifest = <<-EOS
            class{ 'freeipa' :
              ipa_role                    => 'client',
              ipa_master_fqdn             => 'master.example.lan',
              ipa_server_fqdn             => 'foo.example.lan',
              domain                      => 'example.lan',
              password_usedto_joindomain  => 'foobartest',
              admin_password              => 'foobartest',
              directory_services_password => 'foobartest',
              ip_address                  => '10.10.10.35',
            }
          EOS
          manifest
        end

        it { is_expected.to compile }
50
      end
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    end
  end

  context 'with node configured as master' do
    on_supported_os.each do |os, os_facts|
      context "on #{os}" do
        let(:facts) { os_facts.merge(iparole: 'master') }
        let(:pre_condition) do
          manifest = <<-EOS
            class{ 'freeipa' :
              ipa_role                    => 'client',
              ipa_master_fqdn             => 'master.example.lan',
              ipa_server_fqdn             => 'foo.example.lan',
              domain                      => 'example.lan',
              password_usedto_joindomain  => 'foobartest',
              admin_password              => 'foobartest',
              directory_services_password => 'foobartest',
              ip_address                  => '10.10.10.35',
            }
          EOS
          manifest
        end
73

74 75
        it { is_expected.to compile.and_raise_error(%r{to change ipa_role from 'master' to 'client' is not supported}) }
      end
76 77 78
    end
  end
end