Sha256: 419502e40c77b7259e0e1b3cc46402238ab70a3705dd7754cae85908845c6422
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
require File.expand_path('spec/spec_helper') describe ZombiePassengerKiller do let(:killer){ k = ZombiePassengerKiller.new(@options || {}) k.stub!(:passenger_pids).and_return([111]) k } it "has a VERSION" do ZombiePassengerKiller::VERSION.should =~ /^\d+\.\d+\.\d+$/ end it "does not kill anything by default" do killer.should_not_receive(:kill_zombie) killer.hunt_zombies end it "kill zombies" do killer.stub!(:passenger_pids).and_return([123]) killer.stub!(:process_status).and_return([{:pid => 124, :cpu => 0}]) killer.should_receive(:kill_zombie).with(124) killer.hunt_zombies end it "kills zombies with high cpu over max" do @options = {:max => 1} killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 100}]) killer.should_receive(:kill_zombie).with(111) killer.hunt_zombies end it "does not kills zombies with high cpu under max" do @options = {:max => 2} killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 100}]) killer.should_not_receive(:kill_zombie).with(111) killer.hunt_zombies end it "ignores high cpu levels in old history" do @options = {:max => 2, :history => 2} killer.should_not_receive(:kill_zombie).with(111) killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 100}]) killer.hunt_zombies killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 0}]) killer.hunt_zombies killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 100}]) killer.hunt_zombies end it "kills on high cpu levels in recent history" do @options = {:max => 2, :history => 2} killer.stub!(:process_status).and_return([{:pid => 111, :cpu => 100}]) killer.hunt_zombies killer.should_receive(:kill_zombie).with(111) killer.hunt_zombies end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zombie_passenger_killer-0.1.1 | spec/zombie_passenger_killer_spec.rb |
zombie_passenger_killer-0.1.0 | spec/zombie_passenger_killer_spec.rb |