diff --git a/server/src/test/java/org/elasticsearch/reservedstate/service/FileSettingsServiceTests.java b/server/src/test/java/org/elasticsearch/reservedstate/service/FileSettingsServiceTests.java index b1cf40d7f22ec..7cb12c1b316e8 100644 --- a/server/src/test/java/org/elasticsearch/reservedstate/service/FileSettingsServiceTests.java +++ b/server/src/test/java/org/elasticsearch/reservedstate/service/FileSettingsServiceTests.java @@ -214,6 +214,9 @@ public void testInitialFileError() throws Exception { // wait until the watcher thread has started, and it has discovered the file assertTrue(latch.await(20, TimeUnit.SECONDS)); + // Note: the name "processFileOnServiceStart" is a bit misleading because it is not + // referring to fileSettingsService.start(). Rather, it is referring to the initialization + // of the watcher thread itself, which occurs asynchronously when clusterChanged is first called. verify(fileSettingsService, times(1)).processFileOnServiceStart(); verify(controller, times(1)).process(any(), any(XContentParser.class), eq(ReservedStateVersionCheck.HIGHER_OR_SAME_VERSION), any()); // assert we never notified any listeners of successful application of file based settings @@ -312,7 +315,7 @@ public void testInvalidJSON() throws Exception { } finally { awaitOrBust(fileChangeBarrier); } - }).when(fileSettingsService).processFileChanges(); + }).when(fileSettingsService).onProcessFileChangesException(any()); writeTestFile(fileSettingsService.watchedFile(), "test_invalid_JSON"); awaitOrBust(fileChangeBarrier); @@ -326,10 +329,6 @@ public void testInvalidJSON() throws Exception { argThat(e -> unwrapException(e) instanceof XContentParseException) ); - // Note: the name "processFileOnServiceStart" is a bit misleading because it is not - // referring to fileSettingsService.start(). Rather, it is referring to the initialization - // of the watcher thread itself, which occurs asynchronously when clusterChanged is first called. - assertEquals(YELLOW, healthIndicatorService.calculate(false, null).status()); verify(healthIndicatorService, Mockito.atLeast(1)).failureOccurred(contains(XContentParseException.class.getName())); }