File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,14 @@ void interruptingWaitingThread_isIgnored() throws InterruptedException {
7979 @ Test
8080 void callingInitialize_wakesUpWaitingThread () throws InterruptedException {
8181 final AtomicBoolean isWaiting = new AtomicBoolean ();
82- final AtomicBoolean successfulTest = new AtomicBoolean ( );
82+ final AtomicLong waitTime = new AtomicLong ( Long . MAX_VALUE );
8383 Thread waitingThread = new Thread (() -> {
8484 long start = System .currentTimeMillis ();
8585 isWaiting .set (true );
8686 flagdProviderSyncResources .waitForInitialization (10000 );
8787 long end = System .currentTimeMillis ();
8888 long duration = end - start ;
89- successfulTest .set (duration < MAX_TIME_TOLERANCE * 2 );
89+ waitTime .set (duration );
9090 });
9191 waitingThread .start ();
9292
@@ -100,7 +100,11 @@ void callingInitialize_wakesUpWaitingThread() throws InterruptedException {
100100
101101 waitingThread .join ();
102102
103- Assertions .assertTrue (successfulTest .get ());
103+ Assertions .assertTrue (
104+ waitTime .get () < MAX_TIME_TOLERANCE * 2 ,
105+ () -> "Wakeup should be almost instant, but took " + waitTime .get ()
106+ + " ms, which is more than the max of"
107+ + (MAX_TIME_TOLERANCE * 2 ) + " ms" );
104108 }
105109
106110 @ Timeout (2 )
Original file line number Diff line number Diff line change 99import dev .openfeature .sdk .FeatureProvider ;
1010import dev .openfeature .sdk .FlagEvaluationDetails ;
1111import dev .openfeature .sdk .MutableContext ;
12- import java .util .LinkedList ;
13- import java .util .List ;
1412import java .util .Optional ;
13+ import java .util .concurrent .ConcurrentLinkedQueue ;
1514
1615public class State {
1716 public ProviderType providerType ;
1817 public Client client ;
1918 public FeatureProvider provider ;
20- public List <Event > events = new LinkedList <>();
19+ public ConcurrentLinkedQueue <Event > events = new ConcurrentLinkedQueue <>();
2120 public Optional <Event > lastEvent ;
2221 public FlagSteps .Flag flag ;
2322 public MutableContext context = new MutableContext ();
Original file line number Diff line number Diff line change 88import io .cucumber .java .en .Given ;
99import io .cucumber .java .en .Then ;
1010import io .cucumber .java .en .When ;
11- import java .util .LinkedList ;
1211import lombok .extern .slf4j .Slf4j ;
1312import org .jetbrains .annotations .NotNull ;
1413
@@ -19,7 +18,6 @@ public class EventSteps extends AbstractSteps {
1918
2019 public EventSteps (State state ) {
2120 super (state );
22- state .events = new LinkedList <>();
2321 }
2422
2523 @ Given ("a {} event handler" )
You can’t perform that action at this time.
0 commit comments