Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions server/ladder_service/ladder_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,7 @@ def make_game_options(player: Player) -> GameLaunchOptions:
game_options=game_options,
team=game.get_player_option(player.id, "Team"),
faction=game.get_player_option(player.id, "Faction"),
map_position=game.get_player_option(player.id, "StartSpot"),
map_pool_map_version_id=game_map.map_pool_map_version_id
map_position=game.get_player_option(player.id, "StartSpot")
)

await self.launch_match(game, host, all_guests, make_game_options)
Expand Down
1 change: 0 additions & 1 deletion server/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class GameLaunchOptions(NamedTuple):
expected_players: Optional[int] = None
map_position: Optional[int] = None
game_options: Optional[dict[str, Any]] = None
map_pool_map_version_id: Optional[int] = None


class MatchmakerQueueMapPoolVetoData(NamedTuple):
Expand Down
5 changes: 1 addition & 4 deletions tests/integration_tests/test_matchmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ async def test_game_launch_message(lobby_server):

assert "scmp_015" in msg1["mapname"]
del msg1["mapname"]
mpmv_id = msg1["map_pool_map_version_id"]
assert mpmv_id in [1, 2, 3]
assert msg1 == {
"command": "game_launch",
"args": ["/numgames", 0],
Expand All @@ -59,8 +57,7 @@ async def test_game_launch_message(lobby_server):
"team": 2,
"faction": 1,
"expected_players": 2,
"map_position": 1,
"map_pool_map_version_id": mpmv_id
"map_position": 1
}


Expand Down
27 changes: 17 additions & 10 deletions tests/integration_tests/test_matchmaker_vetoes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
)


async def test_used_pools_have_some_maps_and_all_map_names_are_unique(database, ladder_service):
async with database.acquire() as conn:
map_pools = await ladder_service.fetch_map_pools(conn)
for pool_id in [1, 2, 3, 4]:
_, maps = map_pools[pool_id]
folder_names = [m.folder_name for m in maps if hasattr(m, "folder_name")]
assert len(folder_names) > 0

Check failure on line 19 in tests/integration_tests/test_matchmaker_vetoes.py

View workflow job for this annotation

GitHub Actions / unit-test

test_used_pools_have_some_maps_and_all_map_names_are_unique assert 0 > 0 + where 0 = len([])
assert len(folder_names) == len(set(folder_names)), f"Pool {pool_id} has duplicate map names: {folder_names}"


async def test_vetoes_are_assigned_to_player_with_adjusting(lobby_server, player_service):
async def test_vetoes(proto, vetoes, expected_vetoes):
await proto.send_message({
Expand Down Expand Up @@ -51,8 +61,7 @@

msg1 = await client_response(proto1)

chosen_map_pool_version_id = msg1["map_pool_map_version_id"]
assert chosen_map_pool_version_id == 3
assert msg1["mapname"] == "scmp_015.v0003"

await end_game_as_draw([proto1, proto2], msg1["uid"])

Expand All @@ -75,8 +84,7 @@

msg1 = await client_response(proto1)

chosen_map_pool_version_id = msg1["map_pool_map_version_id"]
assert chosen_map_pool_version_id == 8
assert msg1["mapname"] == "scmp_015.v0003"
await end_game_as_draw([proto1, proto2], msg1["uid"])


Expand All @@ -99,12 +107,12 @@

msg1 = await client_response(proto1)

chosen_map_pool_version_id = msg1["map_pool_map_version_id"]
chosen_maps.add(chosen_map_pool_version_id)
assert chosen_map_pool_version_id in [10, 11], f"Expected map 10 or 11, got {chosen_map_pool_version_id}"
chosen_mapname = msg1["mapname"]
chosen_maps.add(chosen_mapname)
assert chosen_mapname in ["scmp_002", "scmp_003"], f"Expected scmp_002 or scmp_003, got {chosen_mapname}"
await end_game_as_draw([proto1, proto2], msg1["uid"])

assert chosen_maps == {10, 11}, f"Expected games on both maps 10 and 11, got {chosen_maps}"
assert chosen_maps == {"scmp_002", "scmp_003"}, f"Expected games on both scmp_002 and scmp_003, got {chosen_maps}"


@fast_forward(120)
Expand All @@ -130,8 +138,7 @@
await read_until_command(proto, "match_found", timeout=30)

msg1 = await client_response(players[0])
chosen_map_pool_version_id = msg1["map_pool_map_version_id"]
assert chosen_map_pool_version_id == 10
assert msg1["mapname"] == "scmp_002"
await end_game_as_draw(players, msg1["uid"])


Expand Down
Loading