Skip to content

Commit 41e1737

Browse files
authored
Suppress most logs in CoordinatorTests (#82793)
These tests cover a bunch of failure cases which means they generate a lot of logs by design, but the logs are kind of useless: the tests are deterministic so we can reproduce any failures locally, and typically the default logs aren't enough for debugging anyway. Moreover if enough of these tests fail then we can apparently get Gradle to OOM which is much harder to debug. With this commit we turn the log verbosity down on these tests down as far as possible.
1 parent ad036be commit 41e1737

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
import static org.hamcrest.Matchers.sameInstance;
9494
import static org.hamcrest.Matchers.startsWith;
9595

96+
@TestLogging(reason = "these tests do a lot of log-worthy things but we usually don't care", value = "org.elasticsearch:FATAL")
9697
public class CoordinatorTests extends AbstractCoordinatorTestCase {
9798

9899
/**
@@ -1478,6 +1479,10 @@ public void testNodeCannotJoinIfJoinValidationFailsOnMaster() {
14781479
}
14791480
}
14801481

1482+
@TestLogging(
1483+
reason = "test includes assertions about Coordinator and JoinHelper logging",
1484+
value = "org.elasticsearch.cluster.coordination.Coordinator:WARN,org.elasticsearch.cluster.coordination.JoinHelper:INFO"
1485+
)
14811486
public void testNodeCannotJoinIfJoinPingValidationFailsOnMaster() throws IllegalAccessException {
14821487
try (Cluster cluster = new Cluster(randomIntBetween(1, 3))) {
14831488
cluster.runRandomly();
@@ -1578,6 +1583,10 @@ public void testClusterCannotFormWithFailingJoinValidation() {
15781583
}
15791584
}
15801585

1586+
@TestLogging(
1587+
reason = "test includes assertions about JoinHelper logging",
1588+
value = "org.elasticsearch.cluster.coordination.JoinHelper:INFO"
1589+
)
15811590
public void testCannotJoinClusterWithDifferentUUID() throws IllegalAccessException {
15821591
try (Cluster cluster1 = new Cluster(randomIntBetween(1, 3))) {
15831592
cluster1.runRandomly();
@@ -1854,6 +1863,10 @@ public void testClusterRecoversAfterExceptionDuringSerialization() {
18541863
}
18551864
}
18561865

1866+
@TestLogging(
1867+
reason = "testing ClusterFormationFailureHelper logging",
1868+
value = "org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper:WARN"
1869+
)
18571870
public void testLogsWarningPeriodicallyIfClusterNotFormed() throws IllegalAccessException {
18581871
final long warningDelayMillis;
18591872
final Settings settings;
@@ -1948,7 +1961,11 @@ public void assertMatched() {
19481961
}
19491962
}
19501963

1951-
@TestLogging(reason = "testing debug logging of LagDetector", value = "org.elasticsearch.cluster.coordination.LagDetector:DEBUG")
1964+
@TestLogging(
1965+
reason = "testing LagDetector and CoordinatorPublication logging",
1966+
value = "org.elasticsearch.cluster.coordination.LagDetector:DEBUG,"
1967+
+ "org.elasticsearch.cluster.coordination.Coordinator.CoordinatorPublication:INFO"
1968+
)
19521969
public void testLogsMessagesIfPublicationDelayed() throws IllegalAccessException {
19531970
try (Cluster cluster = new Cluster(between(3, 5))) {
19541971
cluster.runRandomly();

0 commit comments

Comments
 (0)