Skip to content

Implement fake datastore for unit tests #6874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

mrober
Copy link
Contributor

@mrober mrober commented Apr 15, 2025

Implement fake datastore for unit tests. This fake can act like a simple in memory datastore, but it can also throw provided exceptions on specific actions. It can throw on update, throw on collect, throw on init. This will help write unit tests for when datastore fails.

@google-oss-bot
Copy link
Contributor

1 Warning
⚠️ Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by 🚫 Danger

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 15, 2025

Coverage Report 1

Affected Products

  • firebase-sessions

    Overall coverage changed from ? (9eb1210) to 79.85% (a4d272b) by ?.

    45 individual files with coverage change

    FilenameBase (9eb1210)Merge (a4d272b)Diff
    ApplicationInfo.kt?100.00%?
    AutoSessionEventEncoder.java?100.00%?
    DaggerFirebaseSessionsComponent.java?94.12%?
    EventGDTLogger.kt?70.00%?
    EventGDTLogger_Factory.java?0.00%?
    FirebaseSessions.kt?62.50%?
    FirebaseSessionsComponent.kt?65.79%?
    FirebaseSessionsComponent_MainModule_Companion_ApplicationInfoFactory.java?0.00%?
    FirebaseSessionsComponent_MainModule_Companion_SessionConfigsDataStoreFactory.java?0.00%?
    FirebaseSessionsComponent_MainModule_Companion_SessionDataStoreFactory.java?0.00%?
    FirebaseSessionsComponent_MainModule_Companion_TimeProviderFactory.java?100.00%?
    FirebaseSessionsComponent_MainModule_Companion_UuidGeneratorFactory.java?100.00%?
    FirebaseSessionsDependencies.kt?85.71%?
    FirebaseSessionsRegistrar.kt?90.91%?
    FirebaseSessions_Factory.java?0.00%?
    InstallationId.kt?100.00%?
    LocalOverrideSettings.kt?100.00%?
    LocalOverrideSettings_Factory.java?0.00%?
    ProcessDetailsProvider.kt?76.67%?
    RemoteSettings.kt?88.41%?
    RemoteSettingsFetcher.kt?10.00%?
    RemoteSettingsFetcher_Factory.java?0.00%?
    RemoteSettings_Factory.java?0.00%?
    SessionConfigs.kt?95.45%?
    SessionData.kt?58.82%?
    SessionDataSerializer_Factory.java?0.00%?
    SessionDetails.kt?85.71%?
    SessionEvent.kt?100.00%?
    SessionEvents.kt?98.00%?
    SessionFirelogPublisher.kt?78.57%?
    SessionFirelogPublisherImpl_Factory.java?0.00%?
    SessionGenerator.kt?100.00%?
    SessionGenerator_Factory.java?0.00%?
    SessionsActivityLifecycleCallbacks.kt?22.22%?
    SessionsActivityLifecycleCallbacks_Factory.java?0.00%?
    SessionsSettings.kt?93.75%?
    SessionsSettings_Factory.java?0.00%?
    SessionSubscriber.kt?75.00%?
    SettingsCache.kt?80.56%?
    SettingsCacheImpl_Factory.java?0.00%?
    SettingsProvider.kt?50.00%?
    SharedSessionRepository.kt?34.04%?
    SharedSessionRepositoryImpl_Factory.java?0.00%?
    TimeProvider.kt?62.50%?
    UuidGenerator.kt?100.00%?

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/rindMTd4PW.html

Copy link
Contributor

github-actions bot commented Apr 15, 2025

Test Results

 34 files   34 suites   43s ⏱️
 74 tests  74 ✅ 0 💤 0 ❌
148 runs  148 ✅ 0 💤 0 ❌

Results for commit f743e04.

♻️ This comment has been updated with latest results.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 15, 2025

Size Report 1

Affected Products

  • base

    TypeBase (9eb1210)Merge (a4d272b)Diff
    apk (aggressive)?8.80 kB? (?)
    apk (release)?9.77 kB? (?)
  • firebase-sessions

    TypeBase (9eb1210)Merge (a4d272b)Diff
    aar?196 kB? (?)
    apk (aggressive)?529 kB? (?)
    apk (release)?5.77 MB? (?)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/7GigGTmXPX.html

@mrober mrober merged commit 0377041 into sessions-sharedrepo Apr 15, 2025
29 of 33 checks passed
@mrober mrober deleted the mrober/fakedatastore branch April 15, 2025 14:55
mrober added a commit that referenced this pull request Apr 15, 2025
Implement fake datastore for unit tests. This fake can act like a simple
in memory datastore, but it can also throw provided exceptions on
specific actions. It can throw on update, throw on collect, throw on
init. This will help write unit tests for when datastore fails.
mrober added a commit that referenced this pull request May 5, 2025
Implement fake datastore for unit tests. This fake can act like a simple
in memory datastore, but it can also throw provided exceptions on
specific actions. It can throw on update, throw on collect, throw on
init. This will help write unit tests for when datastore fails.
mrober added a commit that referenced this pull request May 5, 2025
Implement fake datastore for unit tests. This fake can act like a simple
in memory datastore, but it can also throw provided exceptions on
specific actions. It can throw on update, throw on collect, throw on
init. This will help write unit tests for when datastore fails.
mrober added a commit that referenced this pull request May 12, 2025
Implement fake datastore for unit tests. This fake can act like a simple
in memory datastore, but it can also throw provided exceptions on
specific actions. It can throw on update, throw on collect, throw on
init. This will help write unit tests for when datastore fails.
@firebase firebase locked and limited conversation to collaborators May 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants