Skip to content

Commit

Permalink
Consul command test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
L-e-x-o-n committed Apr 23, 2024
1 parent fef6436 commit f71f308
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/teiserver/coordinator/consul_commands_test.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule Teiserver.Coordinator.ConsulCommandsTest do
@moduledoc false
use Teiserver.ServerCase, async: false
use Teiserver.ServerCase, async: false
alias Teiserver.Account.ClientLib
alias Teiserver.Common.PubsubListener
alias Teiserver.Game.MatchRatingLib
alias Teiserver.{Account, Battle, CacheUser, Client, Coordinator, Lobby}
alias Teiserver.Coordinator.ConsulServer
alias Teiserver.Coordinator.ConsulServer

import Teiserver.TeiserverTestLib,
only: [tachyon_auth_setup: 0, _tachyon_send: 2, _tachyon_recv: 1, _tachyon_recv_until: 1]
Expand Down Expand Up @@ -456,13 +456,13 @@ defmodule Teiserver.Coordinator.ConsulCommandsTest do
# Minimum
assert Coordinator.call_consul(lobby_id, {:get, :minimum_rating_to_play}) == 0

data = %{cmd: "c.lobby.message", message: "$minplaylevel 3"}
data = %{cmd: "c.lobby.message", message: "$minratinglevel 3"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :minimum_rating_to_play}) == 3

data = %{cmd: "c.lobby.message", message: "$minplaylevel Xy"}
data = %{cmd: "c.lobby.message", message: "$minratinglevel Xy"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

Expand All @@ -471,52 +471,52 @@ defmodule Teiserver.Coordinator.ConsulCommandsTest do
# Maximum
assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 1000

data = %{cmd: "c.lobby.message", message: "$maxplaylevel 13"}
data = %{cmd: "c.lobby.message", message: "$maxratinglevel 13"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 13

data = %{cmd: "c.lobby.message", message: "$maxplaylevel Xy"}
data = %{cmd: "c.lobby.message", message: "$maxratinglevel Xy"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 13

# Now try to set each the other side of the other
data = %{cmd: "c.lobby.message", message: "$maxplaylevel 1"}
data = %{cmd: "c.lobby.message", message: "$maxratinglevel 1"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 4

data = %{cmd: "c.lobby.message", message: "$maxplaylevel 16"}
data = %{cmd: "c.lobby.message", message: "$maxratinglevel 16"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 16

data = %{cmd: "c.lobby.message", message: "$minplaylevel 20"}
data = %{cmd: "c.lobby.message", message: "$minratinglevel 20"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :minimum_rating_to_play}) == 15

data = %{cmd: "c.lobby.message", message: "$setplaylevels 7 9"}
data = %{cmd: "c.lobby.message", message: "$setratinglevels 7 9"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :minimum_rating_to_play}) == 7
assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 9

data = %{cmd: "c.lobby.message", message: "$setplaylevels 50 33"}
data = %{cmd: "c.lobby.message", message: "$setratinglevels 50 33"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

assert Coordinator.call_consul(lobby_id, {:get, :minimum_rating_to_play}) == 33
assert Coordinator.call_consul(lobby_id, {:get, :maximum_rating_to_play}) == 50

data = %{cmd: "c.lobby.message", message: "$resetplaylevels"}
data = %{cmd: "c.lobby.message", message: "$resetratinglevels"}
_tachyon_send(hsocket, data)
:timer.sleep(500)

Expand Down

0 comments on commit f71f308

Please sign in to comment.