Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/stress_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
scheme: AuthStressTests
destination: ${{ env.DESTINATION }}
xcode_path: '/Applications/Xcode_${{ env.XCODE_VERSION }}.app'
other_flags: -parallel-testing-enabled NO
other_flags: -test-iterations 3 -retry-tests-on-failure -parallel-testing-enabled NO -test-repetition-relaunch-enabled YES

geo-stress-test:
needs: prepare-for-test
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
scheme: GeoStressTests
destination: ${{ env.DESTINATION }}
xcode_path: '/Applications/Xcode_${{ env.XCODE_VERSION }}.app'
other_flags: -parallel-testing-enabled NO
other_flags: -test-iterations 3 -retry-tests-on-failure -parallel-testing-enabled NO -test-repetition-relaunch-enabled YES

storage-stress-test:
needs: prepare-for-test
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
scheme: StorageStressTests
destination: ${{ env.DESTINATION }}
xcode_path: '/Applications/Xcode_${{ env.XCODE_VERSION }}.app'
other_flags: -parallel-testing-enabled NO
other_flags: -test-iterations 3 -retry-tests-on-failure -parallel-testing-enabled NO -test-repetition-relaunch-enabled YES

datastore-stress-test:
needs: prepare-for-test
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
scheme: DatastoreStressTests
destination: ${{ env.DESTINATION }}
xcode_path: '/Applications/Xcode_${{ env.XCODE_VERSION }}.app'
other_flags: -parallel-testing-enabled NO
other_flags: -test-iterations 3 -retry-tests-on-failure -parallel-testing-enabled NO -test-repetition-relaunch-enabled YES

graphql-api-stress-test:
needs: prepare-for-test
Expand Down Expand Up @@ -196,4 +196,4 @@ jobs:
scheme: GraphQLAPIStressTests
destination: ${{ env.DESTINATION }}
xcode_path: '/Applications/Xcode_${{ env.XCODE_VERSION }}.app'
other_flags: -parallel-testing-enabled NO
other_flags: -test-iterations 3 -retry-tests-on-failure -parallel-testing-enabled NO -test-repetition-relaunch-enabled YES
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ final class APIStressTests: XCTestCase {
}

override func setUp() async throws {
await Amplify.reset()
Amplify.Logging.logLevel = .verbose
let plugin = AWSAPIPlugin(modelRegistration: TestModelRegistration())

do {
Amplify.Logging.logLevel = .verbose
let plugin = AWSAPIPlugin(modelRegistration: TestModelRegistration())
try Amplify.add(plugin: plugin)

let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration(
forResource: Self.amplifyConfiguration)
try Amplify.configure(amplifyConfig)
Expand All @@ -58,6 +55,7 @@ final class APIStressTests: XCTestCase {

override func tearDown() async throws {
await Amplify.reset()
try await Task.sleep(seconds: 1)
}

// MARK: - Stress tests
Expand All @@ -82,33 +80,30 @@ final class APIStressTests: XCTestCase {
DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in
Task {
let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate))
Task {
for try await subscriptionEvent in subscription {
switch subscriptionEvent {
case .connection(let state):
switch state {
case .connecting:
break
case .connected:
connectedInvoked.fulfill()
case .disconnected:
disconnectedInvoked.fulfill()
}
case .data(let result):
switch result {
case .success(let post):
if post.title == title {
progressInvoked.fulfill()
}
case .failure(let error):
XCTFail("\(error)")
await sequenceActor.append(sequence: subscription)
for try await subscriptionEvent in subscription {
switch subscriptionEvent {
case .connection(let state):
switch state {
case .connecting:
break
case .connected:
connectedInvoked.fulfill()
case .disconnected:
disconnectedInvoked.fulfill()
}
case .data(let result):
switch result {
case .success(let post):
if post.title == title {
progressInvoked.fulfill()
}
case .failure(let error):
XCTFail("\(error)")
}
}
completedInvoked.fulfill()
}

await sequenceActor.append(sequence: subscription)
completedInvoked.fulfill()
}
}

Expand Down
Loading