Skip to content

Commit

Permalink
Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
gthea committed Oct 28, 2024
1 parent 85659c6 commit 86ed450
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SplitTests/Integration/streaming/MySegmentUpdateTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,29 @@ class MySegmentUpdateTest: XCTestCase {
// Should not trigger any fetch to my segments because
// this payload doesn't have "key1" enabled

Thread.sleep(forTimeInterval: 0.5)
pushMessage(TestingData.escapedBoundedNotificationZlib(type: type, cn: mySegmentsCns[cnIndex()]))

// Pushed key list message. Key 1 should add a segment
sdkUpdExp = XCTestExpectation()

Thread.sleep(forTimeInterval: 0.5)
pushMessage(TestingData.escapedKeyListNotificationGzip(type: type, cn: mySegmentsCns[cnIndex()]))
wait(for: [sdkUpdExp], timeout: 5)

sdkUpdExp = XCTestExpectation()
Thread.sleep(forTimeInterval: 0.5)
pushMessage(TestingData.segmentRemovalNotification(type: type, cn: mySegmentsCns[cnIndex()]))
wait(for: [sdkUpdExp], timeout: 5)

Thread.sleep(forTimeInterval: 2.0)
var segmentEntity: [String]!
if type == .mySegmentsUpdate {
segmentEntity = db.mySegmentsDao.getBy(userKey: testFactory.userKey)?.segments.map { $0.name } ?? []
} else {
segmentEntity = db.myLargeSegmentsDao.getBy(userKey: testFactory.userKey)?.segments.map { $0.name } ?? []
}

Thread.sleep(forTimeInterval: 2.0)
// Hits are not asserted because tests will fail if expectations are not fulfilled
XCTAssertEqual(1, syncSpy.forceMySegmentsSyncCount[userKey] ?? 0)
XCTAssertEqual(1, segmentEntity.filter { $0 == "new_segment_added" }.count)
Expand Down

0 comments on commit 86ed450

Please sign in to comment.