Skip to content

Commit

Permalink
Close some dangling sockets in specs (#15163)
Browse files Browse the repository at this point in the history
These appear to be causing intermittent CI failures, especially on Windows (e.g. https://github.com/crystal-lang/crystal/actions/runs/11031590842/job/30639450164).

Co-authored-by: Johannes Müller <straightshoota@gmail.com>
  • Loading branch information
HertzDevil and straight-shoota authored Nov 7, 2024
1 parent de2d02e commit eabc15d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/std/socket/socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ describe Socket, tags: "network" do

expect_raises(IO::TimeoutError) { server.accept }
expect_raises(IO::TimeoutError) { server.accept? }
ensure
server.try &.close
end

it "sends messages" do
Expand Down
2 changes: 2 additions & 0 deletions spec/std/socket/udp_socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ describe UDPSocket, tags: "network" do
socket = UDPSocket.new(family)
socket.bind(address, 0)
socket.local_address.address.should eq address
ensure
socket.try &.close
end

it "sends and receives messages" do
Expand Down

0 comments on commit eabc15d

Please sign in to comment.