diff --git a/apps/arena/lib/arena/game_socket_handler.ex b/apps/arena/lib/arena/game_socket_handler.ex index 19f32d98b..35afd3a2f 100644 --- a/apps/arena/lib/arena/game_socket_handler.ex +++ b/apps/arena/lib/arena/game_socket_handler.ex @@ -28,6 +28,7 @@ defmodule Arena.GameSocketHandler do _ -> :cowboy_req.binding(:client_id, req) end + |> maybe_override_jwt(System.get_env("OVERRIDE_JWT"), req) game_id = :cowboy_req.binding(:game_id, req) game_pid = game_id |> Base58.decode() |> :erlang.binary_to_term([:safe]) @@ -269,4 +270,8 @@ defmodule Arena.GameSocketHandler do defp handle_decoded_message(message, _) do Logger.info("Unexpected message: #{inspect(message)}") end + + # This is to override jwt validation for human clients in loadtests. + defp maybe_override_jwt(_client_id, "true", req), do: :cowboy_req.binding(:client_id, req) + defp maybe_override_jwt(client_id, _override_jwt?, _req), do: client_id end diff --git a/apps/arena/lib/arena/game_updater.ex b/apps/arena/lib/arena/game_updater.ex index 6ae4f38d6..64e021813 100644 --- a/apps/arena/lib/arena/game_updater.ex +++ b/apps/arena/lib/arena/game_updater.ex @@ -770,6 +770,7 @@ defmodule Arena.GameUpdater do |> Map.put(:items, %{}) |> Map.put(:player_timestamps, %{}) |> Map.put(:obstacles, %{}) + |> Map.put(:bushes, %{}) |> Map.put(:server_timestamp, 0) |> Map.put(:client_to_player_map, %{}) |> Map.put(:pools, %{}) diff --git a/apps/arena_load_test/README.md b/apps/arena_load_test/README.md index 4c662d892..6ac1af34c 100644 --- a/apps/arena_load_test/README.md +++ b/apps/arena_load_test/README.md @@ -5,15 +5,19 @@ Application to load test the Arena backend implementation. It simulates *N* clie ## How to do run our load tests? ```bash -# arena_server_ip is the IP of the server that's running the Arena application -# SERVER_HOST is localhost:4000 if not explicited -export SERVER_HOST=${arena_server_ip}:4000 +# We will disable user auth until we find a proper fix for it. +export OVERRIDE_JWT=true +# arena_target_host is the region of the server that's running the Arena application. +# Brazil for example. +# TARGET_SERVER is localhost:4000 if not explicited +export TARGET_SERVER=${arena_target_host} make run ``` Inside the Elixir shell: ```elixir # number_of_simulated_players must be a positive integer +number_of_simulated_players = 5000 ArenaLoadTest.SocketSupervisor.spawn_players(number_of_simulated_players) ``` diff --git a/apps/arena_load_test/lib/arena_load_test/socket_handler.ex b/apps/arena_load_test/lib/arena_load_test/socket_handler.ex index 3e1b2e3dd..440edd835 100644 --- a/apps/arena_load_test/lib/arena_load_test/socket_handler.ex +++ b/apps/arena_load_test/lib/arena_load_test/socket_handler.ex @@ -71,7 +71,7 @@ defmodule ArenaLoadTest.SocketHandler do # This is enough for now. Will request bots from the bots app in future iterations. # https://github.com/lambdaclass/mirra_backend/issues/410 defp get_random_active_character() do - ["muflus", "h4ck", "uma"] + ["muflus", "h4ck", "uma", "valtimer", "kenzu"] |> Enum.random() end