KEYCLOAK-10355 Avoid LastSessionRefreshUnitTest to trigger scheduled tasks

This commit is contained in:
mposolda 2019-07-03 19:41:14 +02:00 committed by Hynek Mlnařík
parent b5d8f70cc7
commit 5b40691deb

View file

@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.infinispan.Cache;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.keycloak.admin.client.resource.UserResource;
@ -40,6 +41,7 @@ import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.common.util.Retry;
import org.keycloak.testsuite.runonserver.RunOnServer;
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
import org.keycloak.timer.TimerProvider;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
@ -59,6 +61,18 @@ public class LastSessionRefreshUnitTest extends AbstractKeycloakTest {
}
@After
public void cleanupPeriodicTask() {
// Cleanup unneeded periodic task, which was added during this test
testingClient.server().run((session -> {
TimerProvider timer = session.getProvider(TimerProvider.class);
timer.cancelTask(CrossDCLastSessionRefreshStoreFactory.LSR_PERIODIC_TASK_NAME);
}));
}
@Test
public void testLastSessionRefreshCounters() {
testingClient.server().run(new LastSessionRefreshServerCounterTest());