diff --git a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java b/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java index e7f2828cb..65f94acf2 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java +++ b/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java @@ -33,11 +33,13 @@ import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.Response; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.Map; +import java.util.function.Supplier; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.iceberg.BaseTable; @@ -94,6 +96,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; @@ -105,6 +108,9 @@ SnowmanCredentialsExtension.class }) public class PolarisApplicationIntegrationTest { + @TempDir private static Path tempDir; + private static final Supplier CURRENT_LOG = () -> tempDir.resolve("application.log").toString(); + private static final Logger LOGGER = LoggerFactory.getLogger(PolarisApplicationIntegrationTest.class); @@ -117,7 +123,9 @@ public class PolarisApplicationIntegrationTest { "server.applicationConnectors[0].port", "0"), // Bind to random port to support parallelism ConfigOverride.config( - "server.adminConnectors[0].port", "0")); // Bind to random port to support parallelism + "server.adminConnectors[0].port", "0"), // Bind to random port to support parallelism + ConfigOverride.config("logging.appenders[1].type", "file"), + ConfigOverride.config("logging.appenders[1].currentLogFilename", CURRENT_LOG)); private static String userToken; private static SnowmanCredentialsExtension.SnowmanCredentials snowmanCredentials; @@ -132,6 +140,11 @@ public static void setup( throws IOException { realm = polarisRealm; + assertThat(new File(CURRENT_LOG.get())) + .exists() + .content() + .contains("PolarisApplication: Server started successfully"); + testDir = Path.of("build/test_data/iceberg/" + realm); FileUtils.deleteQuietly(testDir.toFile()); Files.createDirectories(testDir); @@ -165,6 +178,8 @@ public static void setup( assertThat(assignPrResponse) .returns(Response.Status.CREATED.getStatusCode(), Response::getStatus); } + + assertZeroErrorsInApplicationLog(); } @AfterAll @@ -181,6 +196,14 @@ public static void deletePrincipalRole() { .close(); } + private static void assertZeroErrorsInApplicationLog() { + assertThat(new File(CURRENT_LOG.get())) + .exists() + .content() + .hasSizeGreaterThan(0) + .doesNotContain("ERROR", "FATAL"); + } + /** * Create a new catalog for each test case. Assign the snowman catalog-admin principal role the * admin role of the new catalog.