Skip to content

Commit

Permalink
Prevent cascading test failures in SearchServiceTests
Browse files Browse the repository at this point in the history
I'm not really fixing the failing tests, but ensuring that the two
tests that fail don't cause a bunch of other tests to fail by
leaving transient settings around. (Clean up the transient settings
even if those tests fail.)

Signed-off-by: Michael Froh <[email protected]>
  • Loading branch information
msfroh committed Dec 19, 2024
1 parent b780ac5 commit fd14e80
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions server/src/test/java/org/opensearch/search/SearchServiceTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1585,15 +1585,15 @@ public void testConcurrentSegmentSearchWithRandomizedModeSettings() throws IOExc
} else {
assertNull(searchContext.searcher().getTaskExecutor());
}
}

// Cleanup
client().admin()
.cluster()
.prepareUpdateSettings()
.setTransientSettings(Settings.builder().putNull(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_MODE.getKey()))
.get();
} finally {
// Cleanup
client().admin()
.cluster()
.prepareUpdateSettings()
.setTransientSettings(Settings.builder().putNull(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_MODE.getKey()))
.get();

}
}

/**
Expand Down Expand Up @@ -1749,15 +1749,15 @@ public void testConcurrentSegmentSearchIsSetOnceDuringContextCreation() throws I

// verify that concurrent segment search is still set to same expected value for the context
assertEquals(concurrentSearchSetting, searchContext.shouldUseConcurrentSearch());
} finally {
// Cleanup
client().admin()
.cluster()
.prepareUpdateSettings()
.setTransientSettings(Settings.builder().putNull(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey()))
.get();
}
}

// Cleanup
client().admin()
.cluster()
.prepareUpdateSettings()
.setTransientSettings(Settings.builder().putNull(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey()))
.get();
}

/**
Expand Down

0 comments on commit fd14e80

Please sign in to comment.