Skip to content

Commit

Permalink
test: fix failing datastore integration tests (#3317)
Browse files Browse the repository at this point in the history
  • Loading branch information
atierian authored Oct 20, 2023
1 parent bdc9b4a commit 99f66d3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_auth_cognito.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginAuthCognitoTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-auth-cognito-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-auth-cognito-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_auth_iam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginAuthIAMTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-auth-iam-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-auth-iam-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginIntegrationTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-test-base-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-test-base-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_cpk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginCPKTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-cpk-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-cpk-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_lazy_load.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginLazyLoadTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-lazy-load-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-lazy-load-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_multi_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginMultiAuthTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-multi-auth-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-multi-auth-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3 changes: 3 additions & 0 deletions .github/workflows/integ_test_datastore_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
scheme: AWSDataStorePluginV2Tests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-v2-test-tvOS:
timeout-minutes: 60
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'

datastore-integration-v2-test-watchOS:
timeout-minutes: 60
Expand Down Expand Up @@ -93,3 +95,4 @@ jobs:
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
other_flags: '-test-iterations 3 -retry-tests-on-failure'
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AWSDataStoreCategoryPluginAuthIntegrationTests: AWSDataStoreAuthBaseTest {

try await signIn(user: user1)

await fulfillment(of: [syncReceivedInvoked], timeout: TestCommonConstants.networkTimeout)
await fulfillment(of: [syncReceivedInvoked], timeout: 60)
Amplify.Hub.removeListener(syncReceivedListener)
guard let remoteTodo = remoteTodoOptional else {
XCTFail("Should have received a SyncReceived event with the remote note reconciled to local store")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,16 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
}
}.store(in: &cancellables)
let receivedPost = expectation(description: "received Post")
try await savePostAndWaitForSync(Post(title: "title", content: "content", createdAt: .now()),
postSyncedExpctation: receivedPost)
await fulfillment(of: [snapshotWithIsSynced, receivedPost], timeout: 100)
receivedPost.assertForOverFulfill = false
try await savePostAndWaitForSync(
Post(
title: "title",
content: "content",
createdAt: .now()
),
postSyncedExpctation: receivedPost
)
await fulfillment(of: [snapshotWithIsSynced], timeout: 100)

XCTAssertTrue(snapshots.count >= 2)
XCTAssertFalse(snapshots[0].isSynced)
Expand Down Expand Up @@ -296,7 +303,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
let receivedPost = expectation(description: "received Post")
try await savePostAndWaitForSync(Post(title: "title", content: "content", createdAt: .now()),
postSyncedExpctation: receivedPost)
await fulfillment(of: [snapshotWithIsSynced, receivedPost], timeout: 30)
await fulfillment(of: [snapshotWithIsSynced], timeout: 30)
XCTAssertTrue(snapshots.count >= 2)
XCTAssertFalse(snapshots[0].isSynced)
XCTAssertTrue(snapshots.last!.isSynced)
Expand Down

0 comments on commit 99f66d3

Please sign in to comment.