Sha256: fb87477bb5db7b0a4a297022f3bd381c5ac744ae6afe1c5cfb5f123ee2aba56c

Contents?: true

Size: 980 Bytes

Versions: 3

Compression:

Stored size: 980 Bytes

Contents

require 'minitest/autorun'

# I assume cat'ing to the LOAD path goes away when we're a real gem.
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
require 'nagios-herald'
require 'nagios-herald/executor'

# Test the Executor class.
class TestIcingaVariables < MiniTest::Unit::TestCase
  include NagiosHerald::Util

  # initial setup before we execute tests
  def setup
    @executor = NagiosHerald::Executor.new
    @options = {}
    @options[:env] = File.join(File.dirname(__FILE__), '..', 'env_files', 'check_disk.CRITICAL_ICINGA')
  end

  def teardown
  end

  # Read Icinga environment variables.
  def test_icinga_variables
    NagiosHerald::Config.config['icinga'] = true
    @executor.load_env_from_file(@options[:env])
    assert_equal "ops@example.com", get_nagios_var('NAGIOS_CONTACTEMAIL')
    assert_equal "ops@example.com", get_nagios_var('ICINGA_CONTACTEMAIL')
    assert_equal "PROBLEM",  get_nagios_var('NAGIOS_NOTIFICATIONTYPE')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios-herald-0.0.4 test/unit/test_icinga_variables.rb
nagios-herald-0.0.3 test/unit/test_icinga_variables.rb
nagios-herald-0.0.2 test/unit/test_icinga_variables.rb