File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
android/src/test/java/dev/openfeature/sdk Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,9 @@ class DeveloperExperienceTests {
259
259
assertEquals(OpenFeatureStatus .NotReady , OpenFeatureAPI .getStatus())
260
260
}
261
261
testScheduler.advanceTimeBy(1 )
262
- assertEquals(OpenFeatureStatus .NotReady , OpenFeatureAPI .getStatus())
262
+ waitAssert {
263
+ assertEquals(OpenFeatureStatus .NotReady , OpenFeatureAPI .getStatus())
264
+ }
263
265
testScheduler.advanceTimeBy(healDelayMillis)
264
266
waitAssert {
265
267
assertEquals(OpenFeatureStatus .Ready , OpenFeatureAPI .getStatus())
Original file line number Diff line number Diff line change @@ -83,7 +83,6 @@ class StatusTests {
83
83
}
84
84
job.cancelAndJoin()
85
85
86
- assertEquals(7 , statuses.size)
87
86
assertEquals(
88
87
listOf (
89
88
OpenFeatureStatus .NotReady ,
@@ -100,13 +99,15 @@ class StatusTests {
100
99
}
101
100
102
101
@OptIn(ExperimentalCoroutinesApi ::class )
103
- suspend fun TestScope.waitAssert (function : () -> Unit ) {
104
- while (true ) {
102
+ suspend fun TestScope.waitAssert (timeoutMs : Long = 5000, function : () -> Unit ) {
103
+ var timeWaited = 0L
104
+ while (timeWaited < timeoutMs) {
105
105
try {
106
106
function()
107
107
return
108
108
} catch (e: Throwable ) {
109
- delay(100 )
109
+ delay(10 )
110
+ timeWaited + = 10
110
111
advanceUntilIdle()
111
112
}
112
113
}
You can’t perform that action at this time.
0 commit comments