From 61b1bab5cb9a918043b49221782be37d4f63a4fa Mon Sep 17 00:00:00 2001 From: Anders Palfi Date: Thu, 18 Apr 2024 10:13:48 +0200 Subject: [PATCH] =?UTF-8?q?fjerner=20flyway=20clean=20on=20validation=20er?= =?UTF-8?q?ror=20for=20tester=20ettersom=20det=20ikke=E2=80=A6=20(#2804)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fjerner flyway clean on validation error for tester ettersom det ikke er støttet mot oracle --- .../dbstoette/Databaseskjemainitialisering.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/migreringer/src/test/java/no/nav/foreldrepenger/tilbakekreving/dbstoette/Databaseskjemainitialisering.java b/migreringer/src/test/java/no/nav/foreldrepenger/tilbakekreving/dbstoette/Databaseskjemainitialisering.java index 37a638890..a78867ce2 100644 --- a/migreringer/src/test/java/no/nav/foreldrepenger/tilbakekreving/dbstoette/Databaseskjemainitialisering.java +++ b/migreringer/src/test/java/no/nav/foreldrepenger/tilbakekreving/dbstoette/Databaseskjemainitialisering.java @@ -2,6 +2,7 @@ import static java.lang.Runtime.getRuntime; +import java.sql.SQLException; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; @@ -54,14 +55,12 @@ public static void migrerUnittestSkjemaer() { throw new IllegalStateException("Forventer at denne migreringen bare kjøres lokalt"); } flyway.migrate(); - } catch (FlywayException fwe) { - try { - // prøver igjen - flyway.clean(); - flyway.migrate(); - } catch (FlywayException fwe2) { - throw new IllegalStateException("Migrering feiler", fwe2); + var connection = flyway.getConfiguration().getDataSource().getConnection(); + if (!connection.isClosed()) { + connection.close(); } + } catch (SQLException sqlex) { + // nothing to do here } } }