Skip to content

Commit

Permalink
Add logging for tests in RemoteStoreStatsIT to catch assertion failur…
Browse files Browse the repository at this point in the history
…e cause (#11734)

* Add logging for tests in RemoteStoreStatsIT to catch assertion failure cause

Signed-off-by: Poojita Raj <[email protected]>

* Add test logging annotation for trace logs

Signed-off-by: Poojita Raj <[email protected]>

---------

Signed-off-by: Poojita Raj <[email protected]>
  • Loading branch information
Poojita-Raj authored Jan 4, 2024
1 parent 2860805 commit 714fa73
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.opensearch.test.InternalTestCluster;
import org.opensearch.test.OpenSearchIntegTestCase;
import org.opensearch.test.disruption.NetworkDisruption;
import org.opensearch.test.junit.annotations.TestLogging;
import org.opensearch.test.transport.MockTransportService;

import java.io.IOException;
Expand Down Expand Up @@ -249,6 +250,7 @@ public void testStatsResponseFromLocalNode() {
}
}

@TestLogging(reason = "Getting trace logs from remote store package", value = "org.opensearch.remotestore:TRACE")
public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exception {
setup();
// Scenario:
Expand Down Expand Up @@ -277,6 +279,13 @@ public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exce
.collect(Collectors.toList())
.get(0)
.getSegmentStats();
logger.info(
"Zero state primary stats: {}ms refresh time lag, {}b bytes lag, {}b upload bytes started and {}b upload bytes failed.",
zeroStatePrimaryStats.refreshTimeLagMs,
zeroStatePrimaryStats.bytesLag,
zeroStatePrimaryStats.uploadBytesStarted,
zeroStatePrimaryStats.uploadBytesFailed
);
assertTrue(
zeroStatePrimaryStats.totalUploadsStarted == zeroStatePrimaryStats.totalUploadsSucceeded
&& zeroStatePrimaryStats.totalUploadsSucceeded == 1
Expand Down Expand Up @@ -339,6 +348,7 @@ public void testDownloadStatsCorrectnessSinglePrimarySingleReplica() throws Exce
}
}

@TestLogging(reason = "Getting trace logs from remote store package", value = "org.opensearch.remotestore:TRACE")
public void testDownloadStatsCorrectnessSinglePrimaryMultipleReplicaShards() throws Exception {
setup();
// Scenario:
Expand Down Expand Up @@ -371,6 +381,13 @@ public void testDownloadStatsCorrectnessSinglePrimaryMultipleReplicaShards() thr
.collect(Collectors.toList())
.get(0)
.getSegmentStats();
logger.info(
"Zero state primary stats: {}ms refresh time lag, {}b bytes lag, {}b upload bytes started and {}b upload bytes failed.",
zeroStatePrimaryStats.refreshTimeLagMs,
zeroStatePrimaryStats.bytesLag,
zeroStatePrimaryStats.uploadBytesStarted,
zeroStatePrimaryStats.uploadBytesFailed
);
assertTrue(
zeroStatePrimaryStats.totalUploadsStarted == zeroStatePrimaryStats.totalUploadsSucceeded
&& zeroStatePrimaryStats.totalUploadsSucceeded == 1
Expand Down

0 comments on commit 714fa73

Please sign in to comment.