Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Apr 22, 2024
1 parent 1fb72de commit 1305513
Showing 1 changed file with 5 additions and 39 deletions.
44 changes: 5 additions & 39 deletions spec/replication_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,6 @@ describe LavinMQ::Replication::Server do
LavinMQ::Config.instance.min_followers = 0
end


it "should shut down gracefully" do
repli = LavinMQ::Replication::Client.new(data_dir)
3.times do
spawn do
repli.follow("127.0.0.1", LavinMQ::Config.instance.replication_port)
end
end

# repli.closing

end

it "should publish when min_followers is fulfilled" do
q = Server.vhosts["/"].queues["repli"].as(LavinMQ::Queue)
repli = LavinMQ::Replication::Client.new(data_dir)
Expand All @@ -109,39 +96,18 @@ describe LavinMQ::Replication::Server do
end

it "should not publish when min_followers is not fulfilled" do
server = LavinMQ::Replication::Server.new(data_dir)
obj = "test".to_slice
done = Channel(Nil).new
client : AMQP::Client::Connection? = nil
spawn do
with_channel do |ch, conn|
client = conn
q = ch.queue("repli")
q.publish_confirm "hello world"
done.send nil
end
server.append("/afs/", obj)
done.send nil
end
select
when done.receive
fail "Should not receive message"
when timeout(0.1.seconds)
client.try &.close(no_wait: true)
Server.close
server.close
end
end

# it "should publish when max_lag is not reached" do
# LavinMQ::Config.instance.max_lag = 10000
# q = Server.vhosts["/"].queues["repli"].as(LavinMQ::Queue)
# repli = LavinMQ::Replication::Client.new(data_dir)
# spawn do
# repli.follow("127.0.0.1", LavinMQ::Config.instance.replication_port)
# end
# with_channel do |ch|
# ch.basic_publish "hello world", "", "repli"
# end
# q.basic_get(true) { }.should be_true
# repli.close
# end

# it "should not publish when max_lag is reached" do
# end
end

0 comments on commit 1305513

Please sign in to comment.