chore: Improve canary test stability #3153
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Improves the canary tests across categories with similar improvements that were added to the auth category in #3143
Generally this involved fixing two classes of issues:
fail) in callbacks from Amplify since these operate on background threads. Instead of failing the test such assertions will cause the test process to crash, losing any information about what went wrong.await. Such tests could cause various incorrect errors to be surfaced.Both of these are generally addressed by using the
Synchronous*test utility classes, which wrap Amplify calls to block the thread for results, propagate errors back to the calling thread, and internally do the proper handling of timeouts.This may cause some tests to fail less often and, especially, should make any failures easier to diagnose. As an example, a device in Device Farm that is having connectivity issues would run in to issue (1) above, so the error in the test report would just be "test process crashed" - which may even be reported for a different test if (2) also came in to play. Now in this situation it will report the actual error that occurred (e.g. UnknownHostException) for the actual test that it happened in.
How did you test these changes?
Tests should pass.
Documentation update required?
General Checklist
fix(storage): message,feat(auth): message,chore(all): message)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.