-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
[CI] Tests sometimes fail, probably because sync framework is called for short-lived test accounts #1273
Comments
Logs around a crash (this time in
|
Another run crashes in
|
And again:
|
I think this is a bit an unwanted issue 😄 But we need reliable tests. When I run the current instrumentation tests locally on an (Android 15) emulator, every second time (or so) they fail. So it's quite reproducible. Does that happen for you too? @ArnyminerZ @sunkup |
It does actually - but only on the Android 15 preview emulator. I can't get it to fail on the non-preview Android 15 emulator. |
Replaced our real SyncAdapter with a fake SyncAdapter that only prints why it was called: override fun onBind(intent: Intent?): IBinder {
//return syncAdapter.get().syncAdapterBinder
val fakeAdapter = object: AbstractThreadedSyncAdapter(this, false) {
override fun onPerformSync(
account: Account,
extras: Bundle,
authority: String,
provider: ContentProviderClient,
syncResult: SyncResult
) {
logger.warning("fakeSyncAdapter onPerformSync(account=$account, extras=$extras, authority=$authority, syncResult=$syncResult)")
for (key in extras.keySet())
logger.warning("\textras[$key] = ${extras[key]}")
throw NotImplementedError()
}
}
return fakeAdapter.syncAdapterBinder
} Got again contacts and calendar sync adapters and they always have
|
Sometimes instrumented tests fail with an error that shows that Hilt is not initialized for a test (always a different one), although it is:
Copy/paste from the chat:
It's always the same problem that haunts us since we have tests that create accounts. Also related to the "test account" type I had earlier. I think the probem is that if an account is created for testing purposes, after some (short) time a sync is initiated by the sync framework. This then fails because the syncer uses Hilt, which may not be initialized correctly (because it's initialized for the tests, not for the sync job).
I thought it shouldn't appear if we delete the test account quick enough after creating it, normally that's enough. But I guess sometimes tests take longer OR maybe the account has been deleted and re-created by the next test so quickly that the sync framework things the account was permanently available.
So I see two possibilities:
Maybe we should give the second version another try, because we know have much better sync framework integration and can make sure the setSyncEnable calls are actually done. Possibily when I tried that the last time (years ago) I forgot some call and then there was a problem on those devices
Yes it's … cumbersome ^^
But regarding your PR, I just ran the test again and now they worked
But we should solve that problem for all time … ideally in 4.5 ^^ Annoys me too and tests should be reproducible
See also: #1286
The text was updated successfully, but these errors were encountered: