Skip to content

Commit

Permalink
Dial back the level of detail validated for the segments that are del…
Browse files Browse the repository at this point in the history
…eted

Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Feb 15, 2024
1 parent 0dd44f7 commit fc600ac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.mockito.Mockito;
Expand Down Expand Up @@ -995,20 +994,6 @@ public void testDeleteStaleCommitsActualDelete() throws Exception {
.map(metadata -> metadata.split(RemoteSegmentStoreDirectory.UploadedSegmentMetadata.SEPARATOR)[1])
.collect(Collectors.toList());

final String allFilesPattern = filesToBeDeleted.stream()
.map(Pattern::quote) // Make sure filenames are matched literally
.map(file -> "(?=.*?" + file + ")") // Allow for matches in any order
.collect(Collectors.joining("", "deletedSegmentFiles=\\[", ".*\\]"));

appender.addExpectation(
new MockLogAppender.PatternSeenWithLoggerPrefixExpectation(
"Deleted file segments message",
"org.opensearch.index.store.RemoteSegmentStoreDirectory",
Level.DEBUG,
allFilesPattern
)
);

remoteSegmentStoreDirectory.init();

// popluateMetadata() adds stub to return 3 metadata files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ public void match(final LogEvent event) {
public void assertMatched() {
if (!eventSeen.get()) {
final StringBuilder failureMessage = new StringBuilder();
failureMessage.append(
String.format("%s was not seen, found %d messages matching the logger.", expectationName, loggerMatches.size())
);
failureMessage.append(expectationName + " was not seen, found " + loggerMatches.size() + " messages matching the logger.");
failureMessage.append("\r\nMessage matching regex: " + messageMatchingRegex);
if (!loggerMatches.isEmpty()) {
failureMessage.append("\r\nMessage details:\r\n" + String.join("\r\n", loggerMatches));
Expand Down

0 comments on commit fc600ac

Please sign in to comment.