Skip to content

Commit d5502b5

Browse files
committed
feature_flags/android: drop ProviderReady emit, note kotlin-sdk#226
Address review from @typotter: - Remove events.emit(ProviderReady) from FakeProvider.initialize; the SDK emits ProviderReady after initialize returns. - Soften the InMemoryProvider wording and link to open-feature/kotlin-sdk#226, where upstream in-memory provider support is tracked.
1 parent be12caa commit d5502b5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

content/en/feature_flags/client/android.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ This table highlights key differences between the OpenFeature and `FlagsClient`
433433

434434
## Testing
435435

436-
You can test against a dedicated Datadog test environment with the real Datadog provider, or swap it for an in-memory `FeatureProvider` to control flag values directly in test code. This section shows the in-memory approach, which keeps tests hermetic and offline. The upstream OpenFeature Kotlin SDK does not ship an `InMemoryProvider`, so tests use a small custom `FeatureProvider`. The example below replaces `OpenFeatureAPI`'s provider — if your production code uses the Datadog `FlagsClient` wrapper directly, your test should assert through the same `OpenFeatureAPI` client the wrapper uses, not `FlagsClient`.
436+
You can test against a dedicated Datadog test environment with the real Datadog provider, or swap it for an in-memory `FeatureProvider` to control flag values directly in test code. This section shows the in-memory approach, which keeps tests hermetic and offline. The upstream OpenFeature Kotlin SDK does not yet ship an `InMemoryProvider` (tracked in [kotlin-sdk#226][2]), so tests use a small custom `FeatureProvider` until that upstream support lands. The example below replaces `OpenFeatureAPI`'s provider — if your production code uses the Datadog `FlagsClient` wrapper directly, your test should assert through the same `OpenFeatureAPI` client the wrapper uses, not `FlagsClient`.
437437

438438
Add `kotlinx-coroutines-test` to your test configuration (the SDK's `initialize` is a `suspend` function):
439439

@@ -459,7 +459,7 @@ class FakeProvider(private val flags: Map<String, Any>) : FeatureProvider {
459459
private val events = MutableSharedFlow<OpenFeatureProviderEvents>(replay = 1)
460460

461461
override suspend fun initialize(initialContext: EvaluationContext?) {
462-
events.emit(OpenFeatureProviderEvents.ProviderReady())
462+
// No-op. The SDK emits ProviderReady after initialize returns.
463463
}
464464
override fun shutdown() {}
465465
override suspend fun onContextSet(old: EvaluationContext?, new: EvaluationContext) {}
@@ -503,3 +503,4 @@ class CheckoutFlagsTest {
503503
{{< partial name="whats-next/whats-next.html" >}}
504504

505505
[1]: https://openfeature.dev/
506+
[2]: https://github.com/open-feature/kotlin-sdk/pull/226

0 commit comments

Comments
 (0)