Skip to content

Commit 99f66d3

Browse files
authored
test: fix failing datastore integration tests (#3317)
1 parent bdc9b4a commit 99f66d3

File tree

9 files changed

+33
-5
lines changed

9 files changed

+33
-5
lines changed

.github/workflows/integ_test_datastore_auth_cognito.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginAuthCognitoTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-auth-cognito-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_auth_iam.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginAuthIAMTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-auth-iam-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_base.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginIntegrationTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-test-base-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_cpk.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginCPKTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-cpk-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_lazy_load.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginLazyLoadTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-lazy-load-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_multi_auth.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginMultiAuthTests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-multi-auth-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

.github/workflows/integ_test_datastore_v2.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
scheme: AWSDataStorePluginV2Tests
3636
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
3737
xcode_path: '/Applications/Xcode_14.3.app'
38+
other_flags: '-test-iterations 3 -retry-tests-on-failure'
3839

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

6870
datastore-integration-v2-test-watchOS:
6971
timeout-minutes: 60
@@ -93,3 +95,4 @@ jobs:
9395
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
9496
sdk: watchsimulator
9597
xcode_path: '/Applications/Xcode_14.3.app'
98+
other_flags: '-test-iterations 3 -retry-tests-on-failure'

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreCategoryPluginAuthIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AWSDataStoreCategoryPluginAuthIntegrationTests: AWSDataStoreAuthBaseTest {
6060

6161
try await signIn(user: user1)
6262

63-
await fulfillment(of: [syncReceivedInvoked], timeout: TestCommonConstants.networkTimeout)
63+
await fulfillment(of: [syncReceivedInvoked], timeout: 60)
6464
Amplify.Hub.removeListener(syncReceivedListener)
6565
guard let remoteTodo = remoteTodoOptional else {
6666
XCTFail("Should have received a SyncReceived event with the remote note reconciled to local store")

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginIntegrationTests/DataStoreObserveQueryTests.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
9797
}
9898
}.store(in: &cancellables)
9999
let receivedPost = expectation(description: "received Post")
100-
try await savePostAndWaitForSync(Post(title: "title", content: "content", createdAt: .now()),
101-
postSyncedExpctation: receivedPost)
102-
await fulfillment(of: [snapshotWithIsSynced, receivedPost], timeout: 100)
100+
receivedPost.assertForOverFulfill = false
101+
try await savePostAndWaitForSync(
102+
Post(
103+
title: "title",
104+
content: "content",
105+
createdAt: .now()
106+
),
107+
postSyncedExpctation: receivedPost
108+
)
109+
await fulfillment(of: [snapshotWithIsSynced], timeout: 100)
103110

104111
XCTAssertTrue(snapshots.count >= 2)
105112
XCTAssertFalse(snapshots[0].isSynced)
@@ -296,7 +303,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
296303
let receivedPost = expectation(description: "received Post")
297304
try await savePostAndWaitForSync(Post(title: "title", content: "content", createdAt: .now()),
298305
postSyncedExpctation: receivedPost)
299-
await fulfillment(of: [snapshotWithIsSynced, receivedPost], timeout: 30)
306+
await fulfillment(of: [snapshotWithIsSynced], timeout: 30)
300307
XCTAssertTrue(snapshots.count >= 2)
301308
XCTAssertFalse(snapshots[0].isSynced)
302309
XCTAssertTrue(snapshots.last!.isSynced)

0 commit comments

Comments
 (0)