@@ -122,6 +122,51 @@ async def test_game_matchmaking_start_while_matched(lobby_server):
122122 assert msg ["text" ].startswith ("Can't join a queue while ladder1 is in" )
123123
124124
125+ @fast_forward (100 )
126+ async def test_game_matchmaking_search_after_timeout (lobby_server , database ):
127+ proto1 = await queue_player_for_matchmaking (
128+ ('ladder1' , 'ladder1' ),
129+ lobby_server ,
130+ "ladder1v1"
131+ )
132+ proto2 = await queue_player_for_matchmaking (
133+ ('ladder2' , 'ladder2' ),
134+ lobby_server ,
135+ "ladder1v1"
136+ )
137+
138+ await read_until_command (proto1 , "match_info" )
139+ await read_until_command (proto2 , "match_info" )
140+
141+ # Only player 1 readies up
142+ await proto1 .send_message ({"command" : "match_ready" })
143+
144+ # So the match times out
145+ await read_until_command (proto1 , "match_cancelled" )
146+ await read_until_command (proto2 , "match_cancelled" )
147+
148+ # At this point the search for player 2 should be cancelled, but player 1
149+ # should still be in the queue
150+ msg = await read_until_command (proto2 , "search_info" )
151+ assert msg == {
152+ "command" : "search_info" ,
153+ "queue_name" : "ladder1v1" ,
154+ "state" : "stop"
155+ }
156+
157+ # Player 2 joins the queue again
158+ await proto2 .send_message ({
159+ "command" : "game_matchmaking" ,
160+ "state" : "start" ,
161+ "faction" : "seraphim" ,
162+ "mod" : "ladder1v1"
163+ })
164+
165+ # The players should match
166+ await read_until_command (proto1 , "match_info" )
167+ await read_until_command (proto2 , "match_info" )
168+
169+
125170@fast_forward (120 )
126171async def test_game_matchmaking_timeout (lobby_server , game_service ):
127172 proto1 , proto2 = await queue_players_for_matchmaking (lobby_server )
0 commit comments