require "./spec_helper" describe Crystal::Scatter do # TODO: Write tests it "slices data into multiple pods" do mr = Crystal::Scatter::MetaRing.new(3) mr.add Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,0],"OSD0") mr.add [Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,1],"OSD1"),Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,2],"OSD2")] (1..1000).each do |numb| slices = mr.get_slices_for(numb.to_s) set = Set(String).new slices.each do |sl| set< (hash_nb/1000*4/5)) end slice_array.each do |v| good_slice&=(v > (hash_nb/1000*4/5)) end good_mod.should be_true good_slice.should be_true end end