From 78ff3c3714473e156b223d3a1f825d6a2436405c Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 27 Jan 2018 14:52:34 +0400 Subject: [PATCH] Tests: added game start mode to load testing --- .../java/org/mage/test/load/LoadTest.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java index 68e8cf9750..555c7611d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java @@ -250,31 +250,39 @@ public class LoadTest { @Ignore public void test_MultipleGames() { // multiple games until finish + final int MAX_GAMES = 50; // games to run + final boolean START_GAMES_AT_ONCE = true; // set true to run ALL games parallel (e.g. test max parallel limit) Instant startTime = Instant.now(); - int MAX_GAMES = 30; - // creating - logger.info("creating games..."); + logger.info("creating " + MAX_GAMES + " games..."); ArrayList gamesList = new ArrayList<>(); for(int i = 1; i <= MAX_GAMES; i++) { - gamesList.add(new LoadGame( + LoadGame game = new LoadGame( "game" + i, "game" + i, createSimpleDeck("GR", true), createSimpleDeck("GR", true) - )); + ); + gamesList.add(game); + + if (!START_GAMES_AT_ONCE) { + game.gameStart(); + } } logger.info("created " + gamesList.size() + " games"); - // running - for(LoadGame game: gamesList) { - game.gameStart(); + if (START_GAMES_AT_ONCE) { + // running + logger.info("start all " + gamesList.size() + "games at once..."); + for (LoadGame game : gamesList) { + game.gameStart(); + } + logger.info("started " + gamesList.size() + " games"); } - logger.info("run " + gamesList.size() + " games"); - // waiting + // waiting all games while (true) { boolean isComplete = true; for(LoadGame game: gamesList) {