Sha256: 1623e31b964cc226c7c343145ee48d141681a5aaba8119019540c8595cc32221
Contents?: true
Size: 1.16 KB
Versions: 25
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' require 'job_helper' describe Marty::Diagnostic::DelayedJobWorkers do def sample_data ip=nil, error=false { ip || Marty::Helper.my_ip => { 'Delayed Workers / Node' => { 'description' => error ? "3" : "4", 'status' => true, 'consistent' => nil }, } } end def sample_aggregate error=false [ sample_data(ip='0.0.0.0'), sample_data(ip='0.0.0.1'), sample_data(ip='0.0.0.2', error=error), sample_data(ip='0.0.0.3'), ].reduce(:merge) end it 'can determine the number of workers on a node' do start_delayed_job expect(described_class.generate).to eq(sample_data) stop_delayed_job end it 'can determine if there are nodes with missing workers' do consistent = sample_aggregate inconsistent = sample_aggregate(error=true) expect(described_class.consistent?(consistent)).to eq(true) expect(described_class.consistent?(inconsistent)).to eq(false) end it 'recognizes zero workers as an error' do data = described_class.generate.values[0] expect(data['Delayed Workers / Node']['status']).to eq(false) end end
Version data entries
25 entries across 25 versions & 1 rubygems