<commit_before>require 'serverspec'

# Required by serverspec
set :backend, :exec

describe 'Nagios Configuration' do
  %w(check_all_hostgroup_service
     check_host_alive
     check_load
     check_nagios
     check_nrpe
     check_nrpe_alive
     check_service_a
     check_service_b
     check_service_c
     host_notify_by_email
     host_notify_by_sms_email
     service_notify_by_email).each do |line|
    describe file('/etc/nagios/conf.d/commands.cfg') do
      its(:content) { should match line }
    end
  end

  file_nagios_config = []
  file_nagios_config << 'host_perfdata_command=command_a'
  file_nagios_config << 'host_perfdata_command=command_b'
  file_nagios_config << 'use_syslog=0'

  file_nagios_config.each do |line|
    describe file('/etc/nagios/nagios.cfg') do
      its(:content) { should match line }
    end
  end
  
  file_nagios_config = []
  file_nagios_config << 'query_socket='
  
  file_nagios_config.each do |line|
    describe file('/etc/nagios/nagios.cfg') do
      its(:content) { should_not match line }
    end
  end

  file_services = []
  file_services << 'service_description.*all_hostgroup_service'
  file_services << 'service_description.*load'
  file_services << 'service_description.*service_a'
  file_services << 'service_description.*service_b'
  file_services << 'service_description.*service_c'

  file_services.each do |line|
    describe file('/etc/nagios/conf.d/services.cfg') do
      its(:content) { should match line }
    end
  end

  file_hosts = []
  file_hosts << 'host_name[ \t]+host_a_alt'
  file_hosts << 'host_name[ \t]+host_b'
  file_hosts << 'host_name[ \t]+' + `hostname`.split('.').first<commit_msg>fixing some whitespace rubocop errors<commit_after>require 'serverspec'

# Required by serverspec
set :backend, :exec

describe 'Nagios Configuration' do
  %w(check_all_hostgroup_service
     check_host_alive
     check_load
     check_nagios
     check_nrpe
     check_nrpe_alive
     check_service_a
     check_service_b
     check_service_c
     host_notify_by_email
     host_notify_by_sms_email
     service_notify_by_email).each do |line|
    describe file('/etc/nagios/conf.d/commands.cfg') do
      its(:content) { should match line }
    end
  end

  file_nagios_config = []
  file_nagios_config << 'host_perfdata_command=command_a'
  file_nagios_config << 'host_perfdata_command=command_b'
  file_nagios_config << 'use_syslog=0'

  file_nagios_config.each do |line|
    describe file('/etc/nagios/nagios.cfg') do
      its(:content) { should match line }
    end
  end

  file_nagios_config = []
  file_nagios_config << 'query_socket='

  file_nagios_config.each do |line|
    describe file('/etc/nagios/nagios.cfg') do
      its(:content) { should_not match line }
    end
  end

  file_services = []
  file_services << 'service_description.*all_hostgroup_service'
  file_services << 'service_description.*load'
  file_services << 'service_description.*service_a'
  file_services << 'service_description.*service_b'
  file_services << 'service_description.*service_c'

  file_services.each do |line|
    describe file('/etc/nagios/conf.d/services.cfg') do
      its(:content) { should match line }
    end
  end

  file_hosts = []
  file_hosts << 'host_name[ \t]+host_a_alt'
  file_hosts << 'host_name[ \t]+host_b'
  file_hosts << 'host_name[ \t]+' + `hostname`.split('.').first
{'fraction_non_alphanumeric': 0.10601548540798095, 'fraction_numerical': 0.0005955926146515784, 'mean_word_length': 3.9469808541973492, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 3, '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': '6611177', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1176, 'n_words': 209}