Skip to content

Commit

Permalink
add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Nov 23, 2023
1 parent a10a2af commit 0e9dae1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/policies_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe LavinMQ::VHost do
definitions = {
"max-length" => JSON::Any.new(10_i64),
"alternate-exchange" => JSON::Any.new("dead-letters"),
"unsupportued" => JSON::Any.new("unsupported"),
}
vhost = Server.vhosts.create("add_policy")

Expand Down Expand Up @@ -212,6 +213,22 @@ describe LavinMQ::VHost do
ch.queue_declare(q.name, passive: true)[:message_count].should eq 2
end
end

it "effective_policy_definition should not include unsupported policies" do
supported_policies = {"max-length", "max-length-bytes",
"message-ttl", "expires", "overflow",
"dead-letter-exchange", "dead-letter-routing-key",
"federation-upstream", "federation-upstream-set",
"delivery-limit", "max-age", "alternate-exchange",
"delayed-message"}
vhost.queues["test"] = LavinMQ::Queue.new(vhost, "test")
vhost.add_policy("test", "^.*$", "all", definitions, -10_i8)
sleep 0.01
vhost.queues["test"].details_tuple[:effective_policy_definition].as(Hash(String, JSON::Any)).each do |k, v|
supported_policies.includes?(k).should be_true
end
vhost.delete_policy("test")
end
end

describe "together with arguments" do
Expand Down

0 comments on commit 0e9dae1

Please sign in to comment.