<commit_before>describe 'sys::krb5' do
  let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }

  context 'node.sys.krb5 is empty' do
    it 'does nothing' do
      expect(chef_run.run_context.resource_collection).to be_empty
    end
  end

  context 'with basic attributes' do
    before do
      master = 'master.example.com'
      slave = 'slave.example.com'
      fqdn = 'node.example.com'
      ktutil_command = "ktutil -k /etc/krb5.conf list --keys | grep "
      ktutil_command += "-q host/node.example.com@EXAMPLE.COM"
      stub_command(ktutil_command).and_return(0)
      chef_run.node.default['sys']['krb5']['realm'] = 'example.com'
      chef_run.node.default['sys']['krb5']['master'] = master
      chef_run.node.default['sys']['krb5']['admin_server'] = master
      chef_run.node.default['sys']['krb5']['slave'] = slave
      chef_run.node.default['sys']['krb5']['distribution'] = 'wallet'
      chef_run.node.default['sys']['krb5']['keytab_config'] = [
        { :keytab => "host",
          :place => "/etc/krb5.conf" }
      ]
      chef_run.node.automatic['fqdn'] = fqdn
      chef_run.node.automatic['domain'] = "example.com"
      chef_run.converge(described_recipe)
    end

    it 'manages /etc/krb5.conf' do
      expect(chef_run).to create_template('/etc/krb5.conf').with_mode('0644')
    end

    it 'installs packages' do
      expect(chef_run).to install_package('heimdal-clients')
      expect(chef_run).to install_package('libpam-heimdal')
      expect(chef_run).to install_package('heimdal-kcm')
      expect(chef_run).to install_package('heimdal-docs')
      expect(chef_run).to install_package('libsasl2-modules-gssapi-heimdal')
    end

    it 'defines attributes in /etc/krb5.conf' do
      expect(chef_run).to create_template('/etc/krb5.conf').with(
        :variables => {
          :realm => "EXAMPLE.COM",
          :admin_server => "master.example.com",
          :servers => [ 'master.example.com', 'slave.example.com'],
          :domain => "example.com",
          :wallet_server => nil,
          :use_pkinit => nil
        }
      )

      test = chef_run.find_resource(:template, '/etc/krb5.conf')
      expect(ChefSpec::Renderer.new(chef_run, test).content).to_not include("try_pkinit =")
      expect(ChefSpec::Renderer.new(chef_run, test).content).to_not include("wallet_server =")
      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\texample.com = EXAMPLE.COM\n" +
          "\t.example.com = EXAMPLE.COM"
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\t\tkdc = master.example.com\n" +
          "\t\tkdc = slave.example.com"
      )
    end
  end

  context 'with wallet and pkinit attributes' do
    before do
      master = 'master.example.com'
      slave = 'slave.example.com'
      fqdn = 'node.example.com'
      ktutil_command = "ktutil -k /etc/krb5.conf list --keys | grep "
      ktutil_command += "-q host/node.example.com@EXAMPLE.COM"
      stub_command(ktutil_command).and_return(0)
      chef_run.node.default['sys']['krb5']['keytab_config'] = [
        { :keytab => "host",
          :place => "/etc/krb5.conf" }
      ]
      chef_run.node.default['sys']['krb5']['realm'] = 'example.com'
      chef_run.node.default['sys']['krb5']['master'] = master
      chef_run.node.default['sys']['krb5']['admin_server'] = master
      chef_run.node.default['sys']['krb5']['slave'] = slave
      chef_run.node.default['sys']['krb5']['wallet_server'] = 'wallet.example.com'
      chef_run.node.default['sys']['krb5']['distribution'] = 'wallet'
      chef_run.node.default['sys']['krb5']['use_pkinit'] = true
      chef_run.node.automatic['fqdn'] = fqdn
      chef_run.node.automatic['domain'] = "example.com"
      chef_run.converge(described_recipe)
    end

    it "configures pkinit and wallet" do
      expect(chef_run).to create_template('/etc/krb5.conf').with(
        :variables => {
          :realm => "EXAMPLE.COM",
          :admin_server => "master.example.com",
          :servers => [ 'master.example.com', 'slave.example.com'],
          :domain => "example.com",
          :wallet_server => "wallet.example.com",
          :use_pkinit => true
        }
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\tuse_pkinit = true"
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\t\twallet_server = wallet.example.com"
      )
    end
  end
end
<commit_msg>heimdal-docs not installes any more<commit_after>describe 'sys::krb5' do
  let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }

  context 'node.sys.krb5 is empty' do
    it 'does nothing' do
      expect(chef_run.run_context.resource_collection).to be_empty
    end
  end

  context 'with basic attributes' do
    before do
      master = 'master.example.com'
      slave = 'slave.example.com'
      fqdn = 'node.example.com'
      ktutil_command = "ktutil -k /etc/krb5.conf list --keys | grep "
      ktutil_command += "-q host/node.example.com@EXAMPLE.COM"
      stub_command(ktutil_command).and_return(0)
      chef_run.node.default['sys']['krb5']['realm'] = 'example.com'
      chef_run.node.default['sys']['krb5']['master'] = master
      chef_run.node.default['sys']['krb5']['admin_server'] = master
      chef_run.node.default['sys']['krb5']['slave'] = slave
      chef_run.node.default['sys']['krb5']['distribution'] = 'wallet'
      chef_run.node.default['sys']['krb5']['keytab_config'] = [
        { :keytab => "host",
          :place => "/etc/krb5.conf" }
      ]
      chef_run.node.automatic['fqdn'] = fqdn
      chef_run.node.automatic['domain'] = "example.com"
      chef_run.converge(described_recipe)
    end

    it 'manages /etc/krb5.conf' do
      expect(chef_run).to create_template('/etc/krb5.conf').with_mode('0644')
    end

    it 'installs packages' do
      expect(chef_run).to install_package('heimdal-clients')
      expect(chef_run).to install_package('libpam-heimdal')
      expect(chef_run).to install_package('heimdal-kcm')
      expect(chef_run).to install_package('libsasl2-modules-gssapi-heimdal')
    end

    it 'defines attributes in /etc/krb5.conf' do
      expect(chef_run).to create_template('/etc/krb5.conf').with(
        :variables => {
          :realm => "EXAMPLE.COM",
          :admin_server => "master.example.com",
          :servers => [ 'master.example.com', 'slave.example.com'],
          :domain => "example.com",
          :wallet_server => nil,
          :use_pkinit => nil
        }
      )

      test = chef_run.find_resource(:template, '/etc/krb5.conf')
      expect(ChefSpec::Renderer.new(chef_run, test).content).to_not include("try_pkinit =")
      expect(ChefSpec::Renderer.new(chef_run, test).content).to_not include("wallet_server =")
      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\texample.com = EXAMPLE.COM\n" +
          "\t.example.com = EXAMPLE.COM"
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\t\tkdc = master.example.com\n" +
          "\t\tkdc = slave.example.com"
      )
    end
  end

  context 'with wallet and pkinit attributes' do
    before do
      master = 'master.example.com'
      slave = 'slave.example.com'
      fqdn = 'node.example.com'
      ktutil_command = "ktutil -k /etc/krb5.conf list --keys | grep "
      ktutil_command += "-q host/node.example.com@EXAMPLE.COM"
      stub_command(ktutil_command).and_return(0)
      chef_run.node.default['sys']['krb5']['keytab_config'] = [
        { :keytab => "host",
          :place => "/etc/krb5.conf" }
      ]
      chef_run.node.default['sys']['krb5']['realm'] = 'example.com'
      chef_run.node.default['sys']['krb5']['master'] = master
      chef_run.node.default['sys']['krb5']['admin_server'] = master
      chef_run.node.default['sys']['krb5']['slave'] = slave
      chef_run.node.default['sys']['krb5']['wallet_server'] = 'wallet.example.com'
      chef_run.node.default['sys']['krb5']['distribution'] = 'wallet'
      chef_run.node.default['sys']['krb5']['use_pkinit'] = true
      chef_run.node.automatic['fqdn'] = fqdn
      chef_run.node.automatic['domain'] = "example.com"
      chef_run.converge(described_recipe)
    end

    it "configures pkinit and wallet" do
      expect(chef_run).to create_template('/etc/krb5.conf').with(
        :variables => {
          :realm => "EXAMPLE.COM",
          :admin_server => "master.example.com",
          :servers => [ 'master.example.com', 'slave.example.com'],
          :domain => "example.com",
          :wallet_server => "wallet.example.com",
          :use_pkinit => true
        }
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\tuse_pkinit = true"
      )

      expect(chef_run).to render_file('/etc/krb5.conf').with_content(
        "\t\twallet_server = wallet.example.com"
      )
    end
  end
end

{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.00829410446088321, 'mean_word_length': 2.8863240418118465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053968', 'n_tokens_mistral': 3128, 'n_tokens_neox': 3127, 'n_words': 430}