This repository was archived by the owner on May 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/test/java/com/launchdarkly/sdk/server Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,36 @@ public void restartsStreamIfStoreNeedsRefresh() throws Exception {
554
554
}
555
555
}
556
556
557
+ @ Test
558
+ public void doesNotRestartStreamIfStoreHadOutageButDoesNotNeedRefresh () throws Exception {
559
+ TestComponents .DataStoreWithStatusUpdates storeWithStatus = new TestComponents .DataStoreWithStatusUpdates (dataStore );
560
+
561
+ SettableFuture <Void > restarted = SettableFuture .create ();
562
+ mockEventSource .start ();
563
+ expectLastCall ();
564
+ mockEventSource .restart ();
565
+ expectLastCall ().andAnswer (() -> {
566
+ restarted .set (null );
567
+ return null ;
568
+ });
569
+ mockEventSource .close ();
570
+ expectLastCall ();
571
+ mockRequestor .close ();
572
+ expectLastCall ();
573
+
574
+ replayAll ();
575
+
576
+ try (StreamProcessor sp = createStreamProcessorWithStore (storeWithStatus )) {
577
+ sp .start ();
578
+
579
+ storeWithStatus .broadcastStatusChange (new DataStoreStatusProvider .Status (false , false ));
580
+ storeWithStatus .broadcastStatusChange (new DataStoreStatusProvider .Status (true , false ));
581
+
582
+ Thread .sleep (500 );
583
+ assertFalse (restarted .isDone ());
584
+ }
585
+ }
586
+
557
587
@ Test
558
588
public void storeFailureOnPutCausesStreamRestart () throws Exception {
559
589
DataStore badStore = dataStoreThatThrowsException (new RuntimeException ("sorry" ));
You can’t perform that action at this time.
0 commit comments