Sha256: 876666beacd68f6989373ee1cf660edd0a4319797a0462a98215bdcfd04c7a4a

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Rubix::ClusterMonitor do

  before do
    @wrapper = Class.new(Rubix::Monitor)
    @wrapper.class_eval do
      include Rubix::ClusterMonitor
      def hosts
        [
         Rubix::Host.new(:name => 'cluster1-facet1-host1'),
         Rubix::Host.new(:name => 'cluster1-facet1-host2'),
         Rubix::Host.new(:name => 'cluster1-facet2-host3'),
         
         Rubix::Host.new(:name => 'cluster2-facet1-host1'),
         Rubix::Host.new(:name => 'cluster2-facet1-host2'),
         Rubix::Host.new(:name => 'cluster2-facet2-host3'),

         Rubix::Host.new(:name => 'malformed')
        ]
      end
    end
  end

  it "should be able to filter hosts into clusters" do
    monitor = @wrapper.new(@wrapper.default_settings)
    monitor.clusters.should include('cluster1', 'cluster2', Rubix::ClusterMonitor::DEFAULT_CLUSTER)
    monitor.hosts_by_cluster['cluster1'].map(&:name).should include('cluster1-facet1-host1', 'cluster1-facet1-host2', 'cluster1-facet2-host3')
    monitor.hosts_by_cluster['cluster2'].map(&:name).should include('cluster2-facet1-host1', 'cluster2-facet1-host2', 'cluster2-facet2-host3')
    monitor.hosts_by_cluster[Rubix::ClusterMonitor::DEFAULT_CLUSTER].map(&:name).should include('malformed')
  end

  
  
end
  

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rubix-0.5.14 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.13 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.9 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.8 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.7 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.6 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.5 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.4 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.3 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.2 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.1 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.5.0 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.4.3 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.4.2 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.4.1 spec/rubix/monitors/cluster_monitor_spec.rb
rubix-0.4.0 spec/rubix/monitors/cluster_monitor_spec.rb