<commit_before>require 'spec_helper_acceptance'

describe 'ksplice class' do

  context 'default parameters' do
    # Using puppet_apply as a helper
    it 'should work idempotently with no errors' do
      pp = <<-EOS
      class { 'ksplice': }
      EOS

      # Run it twice and test for idempotency
      apply_manifest(pp, :catch_failures => true)
      apply_manifest(pp, :catch_changes  => true)
    end


    describe "ksplice::repo" do
      describe yumrepo('ksplice-uptrack') do
        it { is_expected.to exist }
        it { is_expected.to be_enabled }
      end
    end

    describe "ksplice::install" do
      describe package('uptrack') do
        it { is_expected.to be_installed }
      end
    end

    describe "ksplice::config" do
      describe file('/etc/uptrack/uptrack.conf') do
        it { is_expected.to exist }
        it { is_expected.to be_mode(640) }
        it { is_expected.to be_owned_by('root') }
        it { is_expected.to be_grouped_into('root') }
        it { is_expected.to contain('accesskey = INSERT_ACCESS_KEY') }
        it { is_expected.to contain('install_on_reboot = yes') }
        it { is_expected.to contain('upgrade_on_reboot = yes') }
        it { is_expected.to contain('autoinstall = yes') }
      end
    end

    describe "ksplice::cron" do
      # describe cron('ksplice') do
      #   it { is_expected.to have_entry('PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: uptrack-upgrade --cron' ).with_user('root')}
      # end

      describe file('/etc/cron.d/uptrack') do
        it { is_expected.to_not exist }
      end
    end


  end
end
<commit_msg>allow a ksplice license to be put in for testing<commit_after>require 'spec_helper_acceptance'

describe 'ksplice class' do

  context 'default parameters' do
    # Using puppet_apply as a helper
    it 'should work idempotently with no errors' do
      pp = <<-EOS
      class { 'ksplice': }
      EOS

      # Run it twice and test for idempotency
      apply_manifest(pp, :catch_failures => true)
      apply_manifest(pp, :catch_changes  => true)
    end


    describe "ksplice::repo" do
      describe yumrepo('ksplice-uptrack') do
        it { is_expected.to exist }
        it { is_expected.to be_enabled }
      end
    end

    describe "ksplice::install" do
      describe package('uptrack') do
        it { is_expected.to be_installed }
      end
    end

    describe "ksplice::config" do
      describe file('/etc/uptrack/uptrack.conf') do
        it { is_expected.to exist }
        it { is_expected.to be_mode(640) }
        it { is_expected.to be_owned_by('root') }
        it { is_expected.to be_grouped_into('root') }
        it { is_expected.to contain('accesskey = INSERT_ACCESS_KEY') }
        it { is_expected.to contain('install_on_reboot = yes') }
        it { is_expected.to contain('upgrade_on_reboot = yes') }
        it { is_expected.to contain('autoinstall = yes') }
      end
    end

    describe "ksplice::cron" do
      # describe cron('ksplice') do
      #   it { is_expected.to have_entry('PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: uptrack-upgrade --cron' ).with_user('root')}
      # end

      describe file('/etc/cron.d/uptrack') do
        it { is_expected.to_not exist }
      end
    end

    if ! ENV['KSPLICE_LICENSE'].nil?
      context 'with a ksplice license' do
        # Using puppet_apply as a helper
        it 'should work idempotently with no errors' do
          pp = <<-EOS
          class { 'ksplice': config_accesskey=>#{ENV['KSPLICE_LICENSE']}}
          EOS

          # Run it twice and test for idempotency
          apply_manifest(pp, :catch_failures => true)
          apply_manifest(pp, :catch_changes  => true)
        end

        it 'should upgrade the kernel' do
          shell('/usr/sbin/uptrack-upgrade -y --all')
          shell(%q{test "$(uname -r)" != "$(uptrack-uname -r)"}, :acceptable_exit_codes => 0)
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11172622043281329, 'fraction_numerical': 0.0017614494212380473, 'mean_word_length': 2.4237726098191215, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2859887', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1292, 'n_words': 321}