Sha256: 230a55c691f3ab89905c47d6d58f58df2ec18a61cf3ba4be0b226cc847b16449
Contents?: true
Size: 1.49 KB
Versions: 6
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe LitmusPaper do describe 'configure' do it 'populates services from the config file' do LitmusPaper.configure(TEST_CONFIG) LitmusPaper.services.has_key?('test').should == true end end describe "reload" do it "will reconfigure the services" do LitmusPaper.configure(TEST_CONFIG) LitmusPaper.services["bar"] = :service LitmusPaper.reload LitmusPaper.services.has_key?('bar').should == false LitmusPaper.services.has_key?('test').should == true end it "reloads on a USR1 signal" do LitmusPaper.configure(TEST_CONFIG) LitmusPaper.services["bar"] = :service current_pid = $$ Process.kill("USR1", current_pid) sleep 0.5 # wait for reload LitmusPaper.services.has_key?('bar').should == false LitmusPaper.services.has_key?('test').should == true end it "keeps the old config if there are errors in the new config" do old_config_file = SpecHelper.create_temp_file(<<-END) service :old_service do |s| s.measure_health Metric::CPULoad, :weight => 100 end END new_bad_config_file = SpecHelper.create_temp_file(<<-END) service :old_service do |s| syntax error here end END LitmusPaper.configure(old_config_file) LitmusPaper.services.keys.should == ["old_service"] LitmusPaper.configure(new_bad_config_file) LitmusPaper.services.keys.should == ["old_service"] end end end
Version data entries
6 entries across 6 versions & 1 rubygems