Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify dropwizard application log #367

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -105,6 +108,9 @@
SnowmanCredentialsExtension.class
})
public class PolarisApplicationIntegrationTest {
@TempDir private static Path tempDir;
private static final Supplier<String> CURRENT_LOG = () -> tempDir.resolve("application.log").toString();

private static final Logger LOGGER =
LoggerFactory.getLogger(PolarisApplicationIntegrationTest.class);

Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -165,6 +178,8 @@ public static void setup(
assertThat(assignPrResponse)
.returns(Response.Status.CREATED.getStatusCode(), Response::getStatus);
}

assertZeroErrorsInApplicationLog();
}

@AfterAll
Expand All @@ -181,6 +196,14 @@ public static void deletePrincipalRole() {
.close();
}

private static void assertZeroErrorsInApplicationLog() {
sullis marked this conversation as resolved.
Show resolved Hide resolved
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.
Expand Down
Loading