Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -40,6 +41,7 @@
@ExtendWith(MockitoExtension.class)
class ByokServiceTests {

private static final long WAIT_TIMEOUT_MS = 5000;
private static final String OLLAMA_ENDPOINT = "http://localhost:11434";
private static final String OLLAMA_PROVIDER = ByokModelProvider.OLLAMA.getDisplayName();

Expand Down Expand Up @@ -71,7 +73,7 @@ void testConfigureOllama_discoveryFailureKeepsSavedEndpointVisible() {

assertThrows(CompletionException.class, () -> byokService.configureOllama(OLLAMA_ENDPOINT).join());

verify(preferencePage).updateProviderUrlsDisplay(argThat(
verify(preferencePage, timeout(WAIT_TIMEOUT_MS)).updateProviderUrlsDisplay(argThat(
providerUrls -> OLLAMA_ENDPOINT.equals(providerUrls.get(OLLAMA_PROVIDER))));
}

Expand All @@ -86,7 +88,8 @@ void testLoadProviderUrls_ignoresBlankUrlsAndKeepsFirstDuplicate() {

byokService.loadProviderUrls().join();

verify(preferencePage).updateProviderUrlsDisplay(Map.of(OLLAMA_PROVIDER, OLLAMA_ENDPOINT));
verify(preferencePage, timeout(WAIT_TIMEOUT_MS))
.updateProviderUrlsDisplay(Map.of(OLLAMA_PROVIDER, OLLAMA_ENDPOINT));
}

@Test
Expand Down Expand Up @@ -126,7 +129,7 @@ void testDeleteOllamaConfig_removesEndpointBeforeRefresh() {

byokService.deleteOllamaConfig().join();

verify(preferencePage).updateProviderUrlsDisplay(argThat(Map::isEmpty));
verify(preferencePage, timeout(WAIT_TIMEOUT_MS)).updateProviderUrlsDisplay(argThat(Map::isEmpty));
}

private void configureRefreshResponses(List<ByokModel> discoveredModels) {
Expand All @@ -147,4 +150,5 @@ private CompletableFuture<ByokStatusResponse> completedStatus() {
response.setSuccess(true);
return CompletableFuture.completedFuture(response);
}

}
Loading