KEYCLOAK-12240 MigrationModelTest fails in pipeline

This commit is contained in:
vramik 2020-01-24 09:41:37 +01:00 committed by Hynek Mlnařík
parent 01a42f417f
commit 337e8f8fad

View file

@ -13,6 +13,7 @@ import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import java.util.List; import java.util.List;
import org.jboss.logging.Logger;
import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer.REMOTE; import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer.REMOTE;
@ -40,7 +41,7 @@ public class MigrationModelTest extends AbstractKeycloakTest {
Assert.assertEquals(currentVersion, m.getStoredVersion()); Assert.assertEquals(currentVersion, m.getStoredVersion());
Assert.assertEquals(m.getResourcesTag(), l.get(0).getId()); Assert.assertEquals(m.getResourcesTag(), l.get(0).getId());
Time.setOffset(-5000); Time.setOffset(-60000);
session.realms().getMigrationModel().setStoredVersion("6.0.0"); session.realms().getMigrationModel().setStoredVersion("6.0.0");
em.flush(); em.flush();
@ -49,6 +50,9 @@ public class MigrationModelTest extends AbstractKeycloakTest {
l = em.createQuery("select m from MigrationModelEntity m ORDER BY m.updatedTime DESC", MigrationModelEntity.class).getResultList(); l = em.createQuery("select m from MigrationModelEntity m ORDER BY m.updatedTime DESC", MigrationModelEntity.class).getResultList();
Assert.assertEquals(2, l.size()); Assert.assertEquals(2, l.size());
Logger.getLogger(MigrationModelTest.class).info("MigrationModelEntity entries: ");
Logger.getLogger(MigrationModelTest.class).info("--id: " + l.get(0).getId() + "; " + l.get(0).getVersion() + "; " + l.get(0).getUpdateTime());
Logger.getLogger(MigrationModelTest.class).info("--id: " + l.get(1).getId() + "; " + l.get(1).getVersion() + "; " + l.get(1).getUpdateTime());
Assert.assertTrue(l.get(0).getId().matches("[\\da-z]{5}")); Assert.assertTrue(l.get(0).getId().matches("[\\da-z]{5}"));
Assert.assertEquals(currentVersion, l.get(0).getVersion()); Assert.assertEquals(currentVersion, l.get(0).getVersion());
Assert.assertTrue(l.get(1).getId().matches("[\\da-z]{5}")); Assert.assertTrue(l.get(1).getId().matches("[\\da-z]{5}"));