mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-10 05:39:19 +01:00
Fix flaky regular player test
This commit is contained in:
parent
59a2909467
commit
54c66c7232
@ -250,8 +250,10 @@ public interface ActivityIndexQueriesTest extends DatabaseTestPreparer {
|
|||||||
@RepeatedTest(25)
|
@RepeatedTest(25)
|
||||||
default void countRegularPlayers() {
|
default void countRegularPlayers() {
|
||||||
storeSessions(session -> true);
|
storeSessions(session -> true);
|
||||||
long playtimeThreshold = TimeUnit.SECONDS.toMillis(1L);
|
long playtimeThreshold = TimeUnit.MILLISECONDS.toMillis(1L);
|
||||||
Integer expected = 1; // All players are very active
|
Integer expected = 1; // All players are very active
|
||||||
|
FinishedSession randomSession = RandomData.randomSession(serverUUID(), worlds, System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1L), playerUUID, player2UUID);
|
||||||
|
db().executeTransaction(new StoreSessionTransaction(randomSession));
|
||||||
Integer result = db().query(ActivityIndexQueries.fetchRegularPlayerCount(System.currentTimeMillis(), serverUUID(), playtimeThreshold));
|
Integer result = db().query(ActivityIndexQueries.fetchRegularPlayerCount(System.currentTimeMillis(), serverUUID(), playtimeThreshold));
|
||||||
assertEquals(expected, result);
|
assertEquals(expected, result);
|
||||||
}
|
}
|
||||||
|
@ -112,9 +112,13 @@ public class RandomData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static FinishedSession randomSession(ServerUUID serverUUID, String[] worlds, UUID... uuids) {
|
public static FinishedSession randomSession(ServerUUID serverUUID, String[] worlds, UUID... uuids) {
|
||||||
|
long start = RandomData.randomTime();
|
||||||
|
return randomSession(serverUUID, worlds, start, uuids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FinishedSession randomSession(ServerUUID serverUUID, String[] worlds, long start, UUID... uuids) {
|
||||||
DataMap extraData = new DataMap();
|
DataMap extraData = new DataMap();
|
||||||
extraData.put(WorldTimes.class, RandomData.randomWorldTimes(worlds));
|
extraData.put(WorldTimes.class, RandomData.randomWorldTimes(worlds));
|
||||||
long start = RandomData.randomTime();
|
|
||||||
long end = RandomData.randomTimeAfter(start);
|
long end = RandomData.randomTimeAfter(start);
|
||||||
|
|
||||||
if (uuids.length >= 2) {
|
if (uuids.length >= 2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user