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

Make it easier to find test failures in CI output #2511

Merged
merged 4 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ subprojects {
jvmArgs += ["-Xmx1024m", "-XX:+StartAttachListener", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=/var/log/uaa-tests.hprof"]

retry {
def retryFailOnPassedAfterRetry = Boolean.parseBoolean(
def failOnPassedAfterRetrySystemProperty = Boolean.parseBoolean(
System.getProperty("failOnPassedAfterRetry", "false"));
swalchemist marked this conversation as resolved.
Show resolved Hide resolved
if (!retryFailOnPassedAfterRetry)
logger.warn("retry: Failed tests are to be retried and considered as passed if the retry passes.")
if (!failOnPassedAfterRetrySystemProperty)
logger.warn("retry: Flaky tests will not make the test run fail because failOnPassedAfterRetry is false.")

failOnPassedAfterRetry = retryFailOnPassedAfterRetry
// Configure the retry extension
failOnPassedAfterRetry = failOnPassedAfterRetrySystemProperty
maxFailures = Integer.parseInt(System.getProperty("maxFailures", "3"))
maxRetries = Integer.parseInt(System.getProperty("maxRetries", "1"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

class JsonUtilsTest {
private static final String jsonTestObjectString = "{\"pattern\":\"/pattern\",\"group\":\"group\",\"limit\":1000,\"category\":\"category\"}";
Expand Down Expand Up @@ -68,14 +68,11 @@ void testSerializeExcludingProperties() {
}

@Test
void testSerializeExcludingPropertiesInnerCallFailed() {
Map<String, String> groupProperties = JsonUtils.readValue(jsonTestObjectString, new TypeReference<Map<String, String>>() {});
try {
JsonUtils.serializeExcludingProperties(groupProperties, "limit.unkonwn");
fail("not expected");
} catch (Exception e) {
assertTrue(e instanceof JsonUtils.JsonUtilException);
}
void testSerializeExcludingPropertiesInnerCallFails() {
swalchemist marked this conversation as resolved.
Show resolved Hide resolved
Map<String, String> groupProperties = JsonUtils.readValue(jsonTestObjectString, new TypeReference<>() {});
assertThrows(JsonUtils.JsonUtilException.class, () -> {
swalchemist marked this conversation as resolved.
Show resolved Hide resolved
JsonUtils.serializeExcludingProperties(groupProperties, "limit.unknown");
});
}

@Test
Expand Down
Loading