mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Tests: added game start mode to load testing
This commit is contained in:
parent
020beb1bf6
commit
78ff3c3714
1 changed files with 18 additions and 10 deletions
|
@ -250,31 +250,39 @@ public class LoadTest {
|
||||||
@Ignore
|
@Ignore
|
||||||
public void test_MultipleGames() {
|
public void test_MultipleGames() {
|
||||||
// multiple games until finish
|
// 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();
|
Instant startTime = Instant.now();
|
||||||
|
|
||||||
int MAX_GAMES = 30;
|
|
||||||
|
|
||||||
// creating
|
// creating
|
||||||
logger.info("creating games...");
|
logger.info("creating " + MAX_GAMES + " games...");
|
||||||
ArrayList<LoadGame> gamesList = new ArrayList<>();
|
ArrayList<LoadGame> gamesList = new ArrayList<>();
|
||||||
for(int i = 1; i <= MAX_GAMES; i++) {
|
for(int i = 1; i <= MAX_GAMES; i++) {
|
||||||
gamesList.add(new LoadGame(
|
LoadGame game = new LoadGame(
|
||||||
"game" + i,
|
"game" + i,
|
||||||
"game" + i,
|
"game" + i,
|
||||||
createSimpleDeck("GR", true),
|
createSimpleDeck("GR", true),
|
||||||
createSimpleDeck("GR", true)
|
createSimpleDeck("GR", true)
|
||||||
));
|
);
|
||||||
|
gamesList.add(game);
|
||||||
|
|
||||||
|
if (!START_GAMES_AT_ONCE) {
|
||||||
|
game.gameStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.info("created " + gamesList.size() + " games");
|
logger.info("created " + gamesList.size() + " games");
|
||||||
|
|
||||||
|
if (START_GAMES_AT_ONCE) {
|
||||||
// running
|
// running
|
||||||
|
logger.info("start all " + gamesList.size() + "games at once...");
|
||||||
for (LoadGame game : gamesList) {
|
for (LoadGame game : gamesList) {
|
||||||
game.gameStart();
|
game.gameStart();
|
||||||
}
|
}
|
||||||
logger.info("run " + gamesList.size() + " games");
|
logger.info("started " + gamesList.size() + " games");
|
||||||
|
}
|
||||||
|
|
||||||
// waiting
|
// waiting all games
|
||||||
while (true) {
|
while (true) {
|
||||||
boolean isComplete = true;
|
boolean isComplete = true;
|
||||||
for(LoadGame game: gamesList) {
|
for(LoadGame game: gamesList) {
|
||||||
|
|
Loading…
Reference in a new issue