Sha256: 4acec854babbb3bac04a633028fdfa12c01ba74416d442b11a11564b59b86c5f
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
require 'test_helper' require 'outpost/scouts' describe "using more complex DSL integration test" do class ExamplePingAndHttp < Outpost::DSL using Outpost::Scouts::Http => 'master http server' do options :host => 'localhost', :port => 9595, :path => '/' report :up, :response_body => {:match => /Up/} end using Outpost::Scouts::Ping => 'load balancer' do options :host => 'localhost' report :up, :response_time => {:less_than => 500} end end class ExampleOneFailingOnePassing < Outpost::DSL using Outpost::Scouts::Http => 'master http server' do options :host => 'localhost', :port => 9595, :path => '/' report :up, :response_body => {:match => /Up/} end using Outpost::Scouts::Ping => 'load balancer' do options :host => 'localhost' report :up, :response_time => {:less_than => 0} end end class ExampleAllFailing < Outpost::DSL using Outpost::Scouts::Http => 'master http server' do options :host => 'localhost', :port => 9595, :path => '/fail' report :up, :response_body => {:match => /Up/} end using Outpost::Scouts::Ping => 'load balancer' do options :host => 'localhost' report :up, :response_time => {:less_than => -1} end end it "should report up when everything's ok" do assert_equal :up, ExamplePingAndHttp.new.run end it "should report down when at least one scout reports down" do assert_equal :down, ExampleOneFailingOnePassing.new.run end it "should report down when all are down" do assert_equal :down, ExampleAllFailing.new.run end it "should build error message" do outpost = ExampleAllFailing.new outpost.run assert_equal "Outpost::Scouts::Http: 'master http server' is reporting down.", outpost.messages.first assert_equal "Outpost::Scouts::Ping: 'load balancer' is reporting down.", outpost.messages.last end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-0.1.0 | test/integration/more_complex_test.rb |