Skip to content

Commit 6b188d0

Browse files
committed
unit test typo fix
1 parent 5d52808 commit 6b188d0

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

src/test/java/com/uid2/operator/OperatorShutdownHandlerTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,17 @@ void saltsLogErrorAtInterval(VertxTestContext testContext) {
167167
testContext.completeNow();
168168
}
169169

170-
// ===== Keyset Key Tests =====
171-
172170
@Test
173171
void shutdownOnKeysetKeyFailedTooLong(VertxTestContext testContext) {
174172
ListAppender<ILoggingEvent> logWatcher = new ListAppender<>();
175173
logWatcher.start();
176174
((Logger) LoggerFactory.getLogger(OperatorShutdownHandler.class)).addAppender(logWatcher);
177175

178-
// First failure - starts the timer
179176
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
180177
Assertions.assertTrue(logWatcher.list.get(0).getFormattedMessage().contains("keyset keys sync failing"));
181178

182-
// Advance time beyond 2 hour threshold
183179
when(clock.instant()).thenAnswer(i -> Instant.now().plus(2, ChronoUnit.HOURS).plusSeconds(60));
184180

185-
// Second failure after timeout should trigger shutdown
186181
Assertions.assertThrows(RuntimeException.class, () -> {
187182
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
188183
});
@@ -202,15 +197,12 @@ void keysetKeyRecoverOnSuccess(VertxTestContext testContext) {
202197
logWatcher.start();
203198
((Logger) LoggerFactory.getLogger(OperatorShutdownHandler.class)).addAppender(logWatcher);
204199

205-
// Start with failure
206200
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
207201
Assertions.assertTrue(logWatcher.list.get(0).getFormattedMessage().contains("keyset keys sync failing"));
208202

209-
// Advance time but then recover
210203
when(clock.instant()).thenAnswer(i -> Instant.now().plus(1, ChronoUnit.HOURS));
211204
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(true);
212205

213-
// Advance time beyond original threshold - should not shutdown because we recovered
214206
when(clock.instant()).thenAnswer(i -> Instant.now().plus(3, ChronoUnit.HOURS));
215207
assertDoesNotThrow(() -> {
216208
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
@@ -226,16 +218,13 @@ void keysetKeyLogErrorAtInterval(VertxTestContext testContext) {
226218
logWatcher.start();
227219
((Logger) LoggerFactory.getLogger(OperatorShutdownHandler.class)).addAppender(logWatcher);
228220

229-
// First failure logs immediately
230221
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
231222
Assertions.assertTrue(logWatcher.list.get(0).getFormattedMessage().contains("keyset keys sync failing"));
232223

233-
// After 9 minutes, should not log again (interval is 10 minutes)
234224
when(clock.instant()).thenAnswer(i -> Instant.now().plus(9, ChronoUnit.MINUTES));
235225
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
236226
Assertions.assertEquals(1, logWatcher.list.size());
237227

238-
// After 11 minutes, should log again
239228
when(clock.instant()).thenAnswer(i -> Instant.now().plus(11, ChronoUnit.MINUTES));
240229
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(false);
241230
Assertions.assertTrue(logWatcher.list.get(1).getFormattedMessage().contains("keyset keys sync failing"));
@@ -250,14 +239,12 @@ void keysetKeyNoShutdownWhenAlwaysSuccessful(VertxTestContext testContext) {
250239
logWatcher.start();
251240
((Logger) LoggerFactory.getLogger(OperatorShutdownHandler.class)).addAppender(logWatcher);
252241

253-
// Only successful refreshes
254242
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(true);
255243
when(clock.instant()).thenAnswer(i -> Instant.now().plus(1, ChronoUnit.HOURS));
256244
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(true);
257245
when(clock.instant()).thenAnswer(i -> Instant.now().plus(3, ChronoUnit.HOURS));
258246
this.operatorShutdownHandler.handleKeysetKeyRefreshResponse(true);
259247

260-
// No logs, no shutdown
261248
Assertions.assertEquals(0, logWatcher.list.size());
262249
verify(shutdownService, never()).Shutdown(anyInt());
263250
testContext.completeNow();

0 commit comments

Comments
 (0)