Skip to content

Commit 714fa73

Browse files
authored
Add logging for tests in RemoteStoreStatsIT to catch assertion failure cause (#11734)
* Add logging for tests in RemoteStoreStatsIT to catch assertion failure cause Signed-off-by: Poojita Raj <poojiraj@amazon.com> * Add test logging annotation for trace logs Signed-off-by: Poojita Raj <poojiraj@amazon.com> --------- Signed-off-by: Poojita Raj <poojiraj@amazon.com>
1 parent 2860805 commit 714fa73

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreStatsIT.java

+17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.opensearch.test.InternalTestCluster;
3030
import org.opensearch.test.OpenSearchIntegTestCase;
3131
import org.opensearch.test.disruption.NetworkDisruption;
32+
import org.opensearch.test.junit.annotations.TestLogging;
3233
import org.opensearch.test.transport.MockTransportService;
3334

3435
import java.io.IOException;
@@ -249,6 +250,7 @@ public void testStatsResponseFromLocalNode() {
249250
}
250251
}
251252

253+
@TestLogging(reason = "Getting trace logs from remote store package", value = "org.opensearch.remotestore:TRACE")
252254
public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exception {
253255
setup();
254256
// Scenario:
@@ -277,6 +279,13 @@ public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exce
277279
.collect(Collectors.toList())
278280
.get(0)
279281
.getSegmentStats();
282+
logger.info(
283+
"Zero state primary stats: {}ms refresh time lag, {}b bytes lag, {}b upload bytes started and {}b upload bytes failed.",
284+
zeroStatePrimaryStats.refreshTimeLagMs,
285+
zeroStatePrimaryStats.bytesLag,
286+
zeroStatePrimaryStats.uploadBytesStarted,
287+
zeroStatePrimaryStats.uploadBytesFailed
288+
);
280289
assertTrue(
281290
zeroStatePrimaryStats.totalUploadsStarted == zeroStatePrimaryStats.totalUploadsSucceeded
282291
&& zeroStatePrimaryStats.totalUploadsSucceeded == 1
@@ -339,6 +348,7 @@ public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exce
339348
}
340349
}
341350

351+
@TestLogging(reason = "Getting trace logs from remote store package", value = "org.opensearch.remotestore:TRACE")
342352
public void testDownloadStatsCorrectnessSinglePrimaryMultipleReplicaShards() throws Exception {
343353
setup();
344354
// Scenario:
@@ -371,6 +381,13 @@ public void testDownloadStatsCorrectnessSinglePrimaryMultipleReplicaShards() thr
371381
.collect(Collectors.toList())
372382
.get(0)
373383
.getSegmentStats();
384+
logger.info(
385+
"Zero state primary stats: {}ms refresh time lag, {}b bytes lag, {}b upload bytes started and {}b upload bytes failed.",
386+
zeroStatePrimaryStats.refreshTimeLagMs,
387+
zeroStatePrimaryStats.bytesLag,
388+
zeroStatePrimaryStats.uploadBytesStarted,
389+
zeroStatePrimaryStats.uploadBytesFailed
390+
);
374391
assertTrue(
375392
zeroStatePrimaryStats.totalUploadsStarted == zeroStatePrimaryStats.totalUploadsSucceeded
376393
&& zeroStatePrimaryStats.totalUploadsSucceeded == 1

0 commit comments

Comments
 (0)