-
Notifications
You must be signed in to change notification settings - Fork 249
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
chore(datastore): Enable cloud sync in integration tests #1351
chore(datastore): Enable cloud sync in integration tests #1351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of duplicated code in the tests - is there anyway to DRY this up a bit?
...rc/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterSerializedModel.kt
Show resolved
Hide resolved
packages/amplify_datastore/example/integration_test/utils/setup_utils.dart
Outdated
Show resolved
Hide resolved
...atastore/example/integration_test/separate_integration_tests/basic_model_operation_test.dart
Outdated
Show resolved
Hide resolved
...atastore/example/integration_test/separate_integration_tests/basic_model_operation_test.dart
Outdated
Show resolved
Hide resolved
...atastore/example/integration_test/separate_integration_tests/basic_model_operation_test.dart
Outdated
Show resolved
Hide resolved
...atastore/example/integration_test/separate_integration_tests/basic_model_operation_test.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job with this integ test change. It seems pretty stable for me running locally. There might be some challenges with this in CI, but not in scope for this PR IMO. A few high-level callouts:
- Do we want the subscription events to be separate PR? If not, please reflect both changes in commit message when merged to it's there for anyone who is debugging/bisecting commits.
- Like Dillon said, would be nice to DRY up the testing logic, left a suggestion for that, but feel free to chat offline more.
- Test script should return non-zero status if anything fails.
- Mostly nits after that.
...tastore/example/integration_test/separate_integration_tests/has_one_explicit_child_test.dart
Outdated
Show resolved
Hide resolved
...y_datastore/example/integration_test/separate_integration_tests/multi_relationship_test.dart
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/example/integration_test/utils/setup_utils.dart
Show resolved
Hide resolved
packages/amplify_datastore/example/integration_test/utils/setup_utils.dart
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/example/integration_test/utils/wait_for_expected_event_from_hub.dart
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/lib/amplify_datastore_stream_controller.dart
Outdated
Show resolved
Hide resolved
@@ -19,9 +19,9 @@ part 'HubEventElementWithMetadata.dart'; | |||
|
|||
/// The model associated with a DataStore `outboxMutationEnqueued` or | |||
/// `outboxMutationProcessed` Hub event. | |||
class HubEventElement { | |||
class HubEventElement<M extends Model> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Could to a merge instead of squash merge on this PR (I'll squash comment resolving commits before merge). |
b2cee98
to
a73398c
Compare
Codecov Report
@@ Coverage Diff @@
## main #1351 +/- ##
==========================================
- Coverage 46.19% 46.12% -0.07%
==========================================
Files 256 257 +1
Lines 10086 10089 +3
==========================================
- Hits 4659 4654 -5
- Misses 5427 5435 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
|
packages/amplify_datastore/example/integration_test/utils/setup_utils.dart
Outdated
Show resolved
Hide resolved
I think the datastore provision script needs a little fix to work with cloud sync, at https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify_datastore/example/tool/add_api_request.json#L11 add: "conflictResolution": {
"defaultResolutionStrategy": {
"type": "AUTOMERGE"
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small fixes needed and a nit, otherwise looks great! This improved so much, thanks for chipping away at a big, complicated problem and leaving us with this great script.
💯
ac84b48
to
a1fc92d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, contingent on changes mentioned
...id/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/ios/Classes/types/hub/FlutterHubElement.swift
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/ios/Classes/types/hub/FlutterHubElement.swift
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/ios/Classes/types/hub/FlutterSyncReceivedEvent.swift
Outdated
Show resolved
Hide resolved
packages/amplify_datastore/lib/amplify_datastore_stream_controller.dart
Outdated
Show resolved
Hide resolved
...ges/amplify_datastore_plugin_interface/lib/src/types/hub/SubscriptionDataProcessedEvent.dart
Show resolved
Hide resolved
6e4aa74
to
2c62691
Compare
46ed603
to
c5d7078
Compare
- Add reusable util for testing cloud sync opeartion - Make integration tests configurable with - `--device-id` or `-d` to specify running device ID - `--enable-cloud-sync` or `-ec` to enable cloud sync in tests
c5d7078
to
32c97cd
Compare
Issue #, if available:
Description of changes:
subscritpionDataProcessed
(Android) andsyncReceived
(iOS) events to Dart DataStore hub event stream, these two events are named assubscriptionDataProcessed
in dart implementationflutter test
separately to avoid long subscription and initial sync time which made tests run unstable in Android.NOTE: Android integration tests stability depends on PR #1339 ...
NOTE2: Cloud sync is enabled for model relationship tests and basic model operation within this PR. More tests with cloud sync will be add separately.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.