Sha256: 6ca210573a902578b5e25f0e3e39cdb8709963b7480841d410e49b55c8d198bd

Contents?: true

Size: 1.59 KB

Versions: 35

Compression:

Stored size: 1.59 KB

Contents

#encoding: utf-8

require 'riemann/babbler/plugin'
require 'start'
require 'configatron'

opts = Hash.new
opts[:config] = File.expand_path('../config.yml', __FILE__)

babbler = Riemann::Babbler::Starter.new(opts, configatron)

describe Riemann::Babbler do

  it 'Merge config' do
    babbler.merge_config
    configatron.riemann.host.should eq 'hostname_does_not_exists'
  end

  it 'Set logger lvl' do
    babbler.set_logger_lvl
    babbler.logger.level.should eq 4
  end

  it 'Load plugins' do
    babbler.load_plugins
    Riemann::Babbler.registered_plugins.should include( Riemann::Babbler::Dummy )
  end

  it 'Started plugins' do
    babbler.started_plugins.should include( Riemann::Babbler::Dummy )
  end

  it 'Parent plugins' do
    babbler.started_plugins.should include( Riemann::Babbler::Dummy2 )
  end

  it 'Custom parent plugin start' do
    dummyplugin = Riemann::Babbler::Dummy2.new(configatron, nil, nil)
    configatron.plugins.dummy2.to_hash.should include(:run => false)
    dummyplugin.plugin.run.should eq false
    dummyplugin.plugin.interval.should eq 2000 
    dummyplugin.run.should eq 0
  end

  it 'Shell helper' do
    dummyplugin = Riemann::Babbler::Dummy2.new(configatron, nil, nil)
    dummyplugin.shell("echo 'a' | wc -l").to_i.should eq 1
  end

  it 'RestGet helper' do
    dummyplugin = Riemann::Babbler::Dummy2.new(configatron, nil, nil)
    dummyplugin.rest_get('http://ya.ru').should include 'yandex.ru'
  end

  it 'TcpPortAviable helper' do
    dummyplugin = Riemann::Babbler::Dummy2.new(configatron, nil, nil)
    dummyplugin.tcp_port_aviable?('www.ya.ru', 80).should eq true
  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.9 spec/default.rb
riemann-babbler-1.0.7.8 spec/default.rb
riemann-babbler-1.0.7.7 spec/default.rb
riemann-babbler-1.0.7.5 spec/default.rb
riemann-babbler-1.0.7.4 spec/default.rb
riemann-babbler-1.0.7.3 spec/default.rb
riemann-babbler-1.0.7.2 spec/default.rb
riemann-babbler-1.0.7.1 spec/default.rb
riemann-babbler-1.0.7 spec/default.rb
riemann-babbler-1.0.6 spec/default.rb
riemann-babbler-1.0.5.7 spec/default.rb
riemann-babbler-1.0.5.6 spec/default.rb
riemann-babbler-1.0.5.5 spec/default.rb
riemann-babbler-1.0.5.4 spec/default.rb
riemann-babbler-1.0.5.3 spec/default.rb
riemann-babbler-1.0.5.2 spec/default.rb
riemann-babbler-1.0.5.1 spec/default.rb
riemann-babbler-1.0.5 spec/default.rb
riemann-babbler-1.0.4 spec/default.rb
riemann-babbler-1.0.3 spec/default.rb