From dcd3bfee4c29fe10e3040660966431f6d978ebe0 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Mon, 28 Mar 2022 09:12:13 +1300 Subject: [PATCH] Fix test ConfigTest such that it doesn't set the RunOnceMarker When tests are run using for example -Dprops.file=testconfig/ebean-postgres.properties ... then we want ebean-test AutoConfigureForTesting to run and setup the default datasource appropriately. If ConfigTest runs before that then it sets the RunOnceMarker and the default datasource isn't adjusted --- .../io/ebean/test/config/platform/ConfigTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java index b9cbae900..2670b4097 100644 --- a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java +++ b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java @@ -1,7 +1,11 @@ package io.ebean.test.config.platform; +import io.ebean.annotation.Platform; import io.ebean.config.DatabaseConfig; import io.ebean.datasource.DataSourceConfig; +import io.ebeaninternal.api.DbOffline; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -12,6 +16,17 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConfigTest { + @BeforeAll + public static void before() { + // so that RunOnceMarker is not set when running these tests + DbOffline.setPlatform(Platform.H2); + } + + @AfterAll + public static void after() { + DbOffline.reset(); + } + @Test public void trimExtensions() {