Skip to content

Commit 6d94e0d

Browse files
authored
Fix flaky channel api spec (#1532)
1 parent 08514ff commit 6d94e0d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

spec/api/channels_spec.cr

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@ describe LavinMQ::HTTP::ChannelsController do
4848
with_http_server do |http, s|
4949
s.vhosts.create("my-connection")
5050
s.users.add_permission("guest", "my-connection", /.*/, /.*/, /.*/)
51-
wg = WaitGroup.new(1)
52-
2.times { spawn { with_channel(s, vhost: "my-connection") { wg.wait } } }
53-
54-
wait_for { s.connections.size == 2 }
55-
response = http.get("/api/vhosts/my-connection/channels")
56-
response.status_code.should eq 200
57-
body = JSON.parse(response.body)
58-
body.as_a.size.should eq 2
59-
wg.done
51+
with_channel(s, vhost: "my-connection") do
52+
with_channel(s, vhost: "my-connection") do
53+
response = http.get("/api/vhosts/my-connection/channels")
54+
response.status_code.should eq 200
55+
body = JSON.parse(response.body)
56+
body.as_a.size.should eq 2
57+
end
58+
end
6059
end
6160
end
6261
end

0 commit comments

Comments
 (0)