Sha256: cd854e074d71acbc043690b27d0129ab26c7283e5b968b470936219e1032144d
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
# encoding: utf-8 require 'spec_helper' require "zabbix-ruby-client/plugins" ZabbixRubyClient::Plugins.scan_dirs ["zabbix-ruby-client/plugins"] require "zabbix-ruby-client/plugins/load" describe ZabbixRubyClient::Plugins::Load do before :all do @logfile = File.expand_path("../../files/logs/spec.log", __FILE__) ZabbixRubyClient::Log.set_logger(@logfile) end after :all do FileUtils.rm_rf @logfile if File.exists? @logfile end it "prepare data to be usable" do expected = ["0.89", "1.29", "1.05", "2", "2768"] stubfile = File.expand_path('../../../../spec/files/system/loadavg', __FILE__) ZabbixRubyClient::Plugins::Load.stub(:getline).and_return(File.read(stubfile).strip) data = ZabbixRubyClient::Plugins::Load.send(:get_info) expect(data).to eq expected end it "populate a hash with extracted data" do expected = [ "local load[one] 123456789 0.89", "local load[five] 123456789 1.29", "local load[fifteen] 123456789 1.05", "local load[procs] 123456789 2" ] stubfile = File.expand_path('../../../../spec/files/system/loadavg', __FILE__) ZabbixRubyClient::Plugins::Load.stub(:getline).and_return(File.read(stubfile)) Time.stub(:now).and_return("123456789") data = ZabbixRubyClient::Plugins::Load.send(:collect, 'local') expect(data).to eq expected end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zabbix-ruby-client-0.0.20 | spec/lib/plugins/load_spec.rb |
zabbix-ruby-client-0.0.19 | spec/lib/plugins/load_spec.rb |
zabbix-ruby-client-0.0.18 | spec/lib/plugins/load_spec.rb |