Sha256: c57fa1bde8496aee1e533a6e8b0221072ec3d4de0aee96e335520055b8ed4010
Contents?: true
Size: 1.62 KB
Versions: 24
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' describe LitmusPaper::Dependency::HaproxyBackends do describe "available?" do before(:each) do FileUtils.rm_rf("/tmp/stub-haproxy-stats") system "spec/support/haproxy_test_socket /tmp/stub-haproxy-stats &" sleep 1 end it "is available if at least one backend is up" do haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "yellow_cluster") haproxy.should be_available end it "returns false if no nodes are available" do haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "orange_cluster") haproxy.should_not be_available end it "logs exceptions and returns false" do haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/dev/null", "yellow_cluster") LitmusPaper.logger.should_receive(:info) haproxy.should_not be_available end end describe "timeouts" do before(:each) do FileUtils.rm_rf("/tmp/stub-haproxy-stats") system "spec/support/haproxy_test_socket /tmp/stub-haproxy-stats 3 &" sleep 1 end it "returns false after a configurable number of seconds" do haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "yellow_cluster", :timeout_seconds => 1) haproxy.should_not be_available end end describe "to_s" do it "includes the socket file and the cluster" do haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "orange_cluster") haproxy.to_s.should == 'Dependency::HaproxyBackends(/tmp/stub-haproxy-stats, orange_cluster)' end end end
Version data entries
24 entries across 24 versions & 1 rubygems