Skip to content

Commit 341c2cc

Browse files
committed
Remove deprecation tags
1 parent d59b99e commit 341c2cc

12 files changed

+38
-129
lines changed

SentryTestUtils/TestOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public extension Options {
1010
enableCrashHandler = false
1111
swiftAsyncStacktraces = false
1212
enableAppHangTracking = false
13-
attachViewHierarchy = false
1413
enableNetworkTracking = false
1514
enableNetworkBreadcrumbs = false
1615
enableCaptureFailedRequests = false
1716
enableAutoBreadcrumbTracking = false
1817
#if (os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT
18+
attachViewHierarchy = false
1919
enableUIViewControllerTracing = false
2020
#endif
2121
}

Tests/SentryProfilerTests/SentryProfilingPublicAPITests.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import XCTest
77
// swiftlint:disable file_length
88
class SentryProfilingPublicAPITests: XCTestCase {
99
private class Fixture {
10-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
1110
let options: Options = {
12-
let options = Options()
11+
let options = Options.noIntegrations()
1312
options.dsn = TestConstants.dsnAsString(username: "SentrySDKTests")
1413
options.releaseName = "1.0.0"
1514
return options
@@ -36,9 +35,7 @@ class SentryProfilingPublicAPITests: XCTestCase {
3635

3736
let currentDate = TestCurrentDateProvider()
3837
lazy var timerFactory = TestSentryNSTimerFactory(currentDateProvider: currentDate)
39-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
4038
lazy var client = TestClient(options: options)!
41-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
4239
lazy var hub = SentryHub(client: client, andScope: scope)
4340
}
4441

@@ -55,7 +52,6 @@ class SentryProfilingPublicAPITests: XCTestCase {
5552
SentryDependencyContainer.sharedInstance().dateProvider = fixture.currentDate
5653
}
5754

58-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
5955
override func tearDown() {
6056
super.tearDown()
6157

@@ -72,7 +68,6 @@ class SentryProfilingPublicAPITests: XCTestCase {
7268
}
7369

7470
// MARK: continuous profiling v2
75-
@available(*, deprecated, message: "This is only deprecated because profilesSampleRate is deprecated. Once that is removed this attribute can be removed.")
7671
extension SentryProfilingPublicAPITests {
7772
func testSentryOptionsReportsContinuousProfilingV2Enabled() {
7873
// Arrange
@@ -481,14 +476,12 @@ extension SentryProfilingPublicAPITests {
481476
}
482477

483478
private extension SentryProfilingPublicAPITests {
484-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
485479
func givenSdkWithHub() {
486480
SentrySDKInternal.setCurrentHub(fixture.hub)
487481
SentrySDKInternal.setStart(with: fixture.options)
488482
sentry_sdkInitProfilerTasks(fixture.options, fixture.hub)
489483
}
490484

491-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
492485
func givenSdkWithHubButNoClient() {
493486
SentrySDKInternal.setCurrentHub(SentryHub(client: nil, andScope: nil))
494487
SentrySDKInternal.setStart(with: fixture.options)

Tests/SentryTests/Integrations/Performance/IO/DataSentryTracingIntegrationTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class DataSentryTracingIntegrationTests: XCTestCase {
3535
options.dsn = TestConstants.dsnAsString(username: testName)
3636
options.removeAllIntegrations()
3737

38-
options.removeAllIntegrations()
3938
// Configure options required by File I/O tracking integration
4039
options.enableAutoPerformanceTracing = true
4140
options.enableFileIOTracing = isEnabled

Tests/SentryTests/Integrations/Performance/Network/SentryNetworkTrackerIntegrationTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class SentryNetworkTrackerIntegrationTests: XCTestCase {
2222
options.tracesSampleRate = 1.0
2323
options.removeAllIntegrations()
2424
options.enableNetworkTracking = true
25+
options.enableNetworkBreadcrumbs = true
26+
options.enableCaptureFailedRequests = true
2527
}
2628
}
2729

Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import XCTest
55

66
#if os(iOS) || os(tvOS)
77

8-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
98
class SentrySessionReplayIntegrationTests: XCTestCase {
109

1110
private var uiApplication: TestSentryUIApplication!
@@ -54,7 +53,10 @@ class SentrySessionReplayIntegrationTests: XCTestCase {
5453
private func startSDK(sessionSampleRate: Float, errorSampleRate: Float, enableSwizzling: Bool = true, noIntegrations: Bool = false, configure: ((Options) -> Void)? = nil) {
5554
SentrySDK.start {
5655
$0.dsn = "https://[email protected]/test"
57-
$0.sessionReplay = SentryReplayOptions(sessionSampleRate: sessionSampleRate, onErrorSampleRate: errorSampleRate)
56+
$0.removeAllIntegrations()
57+
if !noIntegrations {
58+
$0.sessionReplay = SentryReplayOptions(sessionSampleRate: sessionSampleRate, onErrorSampleRate: errorSampleRate)
59+
}
5860
$0.enableSwizzling = enableSwizzling
5961
$0.cacheDirectoryPath = FileManager.default.temporaryDirectory.path
6062
configure?($0)
@@ -114,7 +116,6 @@ class SentrySessionReplayIntegrationTests: XCTestCase {
114116

115117
func testInstallErrorReplay() {
116118
startSDK(sessionSampleRate: 0, errorSampleRate: 0.1)
117-
118119
XCTAssertEqual(SentrySDKInternal.currentHub().trimmedInstalledIntegrationNames().count, 1)
119120
XCTAssertEqual(globalEventProcessor.processors.count, 1)
120121
}

Tests/SentryTests/Integrations/ViewHierarchy/SentryViewHierarchyIntegrationTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
3636
clearTestState()
3737
}
3838

39-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
4039
func test_attachViewHierarchy() {
4140
SentrySDK.start {
4241
$0.removeAllIntegrations()
@@ -46,7 +45,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
4645
XCTAssertFalse(sentrycrash_hasSaveViewHierarchyCallback())
4746
}
4847

49-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
5048
func test_attachViewHierarchy_enabled() {
5149
SentrySDK.start {
5250
$0.removeAllIntegrations()
@@ -56,7 +54,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
5654
XCTAssertTrue(sentrycrash_hasSaveViewHierarchyCallback())
5755
}
5856

59-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
6057
func test_uninstall() {
6158
SentrySDK.start {
6259
$0.removeAllIntegrations()
@@ -67,7 +64,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
6764
XCTAssertFalse(sentrycrash_hasSaveViewHierarchyCallback())
6865
}
6966

70-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
7167
func test_integrationAddFileName() {
7268
SentrySDK.start {
7369
$0.removeAllIntegrations()
@@ -173,7 +169,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
173169
wait(for: [ex], timeout: 1)
174170
}
175171

176-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
177172
func testReportAccessibilityIdentifierTrue() {
178173
SentrySDK.start {
179174
$0.removeAllIntegrations()
@@ -182,7 +177,6 @@ class SentryViewHierarchyIntegrationTests: XCTestCase {
182177
XCTAssertTrue(SentryDependencyContainer.sharedInstance().viewHierarchyProvider.reportAccessibilityIdentifier)
183178
}
184179

185-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
186180
func testReportAccessibilityIdentifierFalse() {
187181
SentrySDK.start {
188182
$0.removeAllIntegrations()

Tests/SentryTests/PrivateSentrySDKOnlyTests.swift

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,34 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
349349
#endif
350350

351351
#if canImport(UIKit)
352-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
353-
func testCaptureReplayShouldCallReplayIntegration() {
352+
func testCaptureReplayShouldCallReplayIntegration() throws {
354353
guard #available(iOS 16.0, tvOS 16.0, *) else { return }
355354

356-
let options = Options()
357-
options.setIntegrations([TestSentrySessionReplayIntegration.self])
355+
let options = Options.noIntegrations()
356+
options.sessionReplay = .init(sessionSampleRate: 1.0)
358357
SentrySDKInternal.start(options: options)
359358

359+
var didCallCaptureReplay = false
360+
let cls: AnyClass = SentrySessionReplayIntegration.self
361+
let originalSelector = #selector(SentrySessionReplayIntegration.captureReplay)
362+
guard
363+
let originalMethod = class_getInstanceMethod(cls, originalSelector)
364+
else {
365+
XCTFail("Expected SentrySessionReplayIntegration.captureReplay to exist")
366+
return
367+
}
368+
// Swizzle captureReplay
369+
let originalIMP = method_getImplementation(originalMethod)
370+
let block: @convention(block) (AnyObject) -> Void = { _ in
371+
didCallCaptureReplay = true
372+
}
373+
let newIMP = imp_implementationWithBlock(block)
374+
method_setImplementation(originalMethod, newIMP)
375+
360376
PrivateSentrySDKOnly.captureReplay()
361377

362-
XCTAssertTrue(TestSentrySessionReplayIntegration.captureReplayShouldBeCalledAtLeastOnce())
378+
XCTAssertTrue(didCallCaptureReplay, "Expected SentrySessionReplayIntegration.captureReplay to be called")
379+
method_setImplementation(originalMethod, originalIMP)
363380
}
364381

365382
func testGetReplayIdShouldBeNil() {
@@ -375,31 +392,28 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
375392
XCTAssertEqual(PrivateSentrySDKOnly.getReplayId(), VALID_REPLAY_ID)
376393
}
377394

378-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
379395
func testAddReplayIgnoreClassesShouldNotFailWhenReplayIsAvailable() {
380-
let options = Options()
381-
options.setIntegrations([TestSentrySessionReplayIntegration.self])
396+
let options = Options.noIntegrations()
397+
options.sessionReplay = .init()
382398
SentrySDKInternal.start(options: options)
383399

384400
PrivateSentrySDKOnly.addReplayIgnoreClasses([UILabel.self])
385401
}
386402

387-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
388403
func testAddReplayRedactShouldNotFailWhenReplayIsAvailable() {
389404
let options = Options()
390-
options.setIntegrations([TestSentrySessionReplayIntegration.self])
405+
options.sessionReplay = .init()
391406
SentrySDKInternal.start(options: options)
392407

393408
PrivateSentrySDKOnly.addReplayRedactClasses([UILabel.self])
394409
}
395410

396-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
397411
func testAddIgnoreContainer() throws {
398412
class IgnoreContainer: UIView {}
399413

400414
SentrySDKInternal.start {
415+
$0.removeAllIntegrations()
401416
$0.sessionReplay = SentryReplayOptions(sessionSampleRate: 1, onErrorSampleRate: 1)
402-
$0.setIntegrations([SentrySessionReplayIntegration.self])
403417
}
404418

405419
PrivateSentrySDKOnly.setIgnoreContainerClass(IgnoreContainer.self)
@@ -410,13 +424,12 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
410424
XCTAssertTrue(redactBuilder.isIgnoreContainerClassTestOnly(IgnoreContainer.self))
411425
}
412426

413-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
414427
func testAddRedactContainer() throws {
415428
class RedactContainer: UIView {}
416429

417430
SentrySDKInternal.start {
431+
$0.removeAllIntegrations()
418432
$0.sessionReplay = SentryReplayOptions(sessionSampleRate: 1, onErrorSampleRate: 1)
419-
$0.setIntegrations([SentrySessionReplayIntegration.self])
420433
}
421434

422435
PrivateSentrySDKOnly.setRedactContainerClass(RedactContainer.self)
@@ -451,23 +464,6 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
451464
}
452465

453466
private let VALID_REPLAY_ID = "0eac7ab503354dd5819b03e263627a29"
454-
455-
private class TestSentrySessionReplayIntegration: SentrySessionReplayIntegration {
456-
static var captureReplayCalledTimes = 0
457-
458-
override func install(with options: Options) -> Bool {
459-
return true
460-
}
461-
462-
override func captureReplay() -> Bool {
463-
TestSentrySessionReplayIntegration.captureReplayCalledTimes += 1
464-
return true
465-
}
466-
467-
static func captureReplayShouldBeCalledAtLeastOnce() -> Bool {
468-
return captureReplayCalledTimes > 0
469-
}
470-
}
471467
#endif
472468

473469
private func getUnhandledExceptionEnvelope() -> SentryEnvelope {

Tests/SentryTests/SentryClientTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import XCTest
55
// swiftlint:disable file_length
66
// We are aware that the client has a lot of logic and we should maybe
77
// move some of it to other classes.
8-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
98
class SentryClientTests: XCTestCase {
109

1110
private static let dsn = TestConstants.dsnAsString(username: "SentryClientTest")
@@ -1728,7 +1727,9 @@ class SentryClientTests: XCTestCase {
17281727
}
17291728

17301729
func testSetSDKFeatures() throws {
1731-
let sut = fixture.getSut()
1730+
let sut = fixture.getSut { options in
1731+
options.enableCaptureFailedRequests = true
1732+
}
17321733

17331734
sut.capture(message: "message")
17341735

@@ -2231,7 +2232,6 @@ class SentryClientTests: XCTestCase {
22312232
}
22322233
}
22332234

2234-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
22352235
private extension SentryClientTests {
22362236
private func givenEventWithDebugMeta() -> Event {
22372237
let event = Event(level: SentryLevel.fatal)

Tests/SentryTests/SentryCrash/SentryCrashInstallationReporterTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class SentryCrashInstallationReporterTests: XCTestCase {
1414
sut.uninstall()
1515
}
1616

17-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
1817
func testReportIsSentAndDeleted() throws {
1918
givenSutWithStartedSDK()
2019

@@ -31,7 +30,6 @@ class SentryCrashInstallationReporterTests: XCTestCase {
3130
/**
3231
* Validates that handling a crash report with the removed fields total_storage and free_storage works.
3332
*/
34-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
3533
func testShouldCaptureCrashReportWithLegacyStorageInfo() throws {
3634
givenSutWithStartedSDK()
3735

@@ -50,7 +48,6 @@ class SentryCrashInstallationReporterTests: XCTestCase {
5048
XCTAssertEqual(event?.context?["device"]?["storage_size"] as? Int, 994_662_584_320)
5149
}
5250

53-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
5451
func testShouldCaptureCrashReportWithoutDeviceContext() throws {
5552
givenSutWithStartedSDK()
5653

@@ -68,7 +65,6 @@ class SentryCrashInstallationReporterTests: XCTestCase {
6865
XCTAssertEqual(event?.context?["app"]?["app_name"] as? String, "iOS-Swift")
6966
}
7067

71-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
7268
func testFaultyReportIsNotSentAndDeleted() throws {
7369
givenSutWithStartedSDK()
7470

@@ -82,7 +78,6 @@ class SentryCrashInstallationReporterTests: XCTestCase {
8278
XCTAssertEqual(sentrycrash_getReportCount(), 0)
8379
}
8480

85-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
8681
private func givenSutWithStartedSDK() {
8782
let options = Options()
8883
options.dsn = TestConstants.dsnAsString(username: "SentryCrashInstallationReporterTests")

Tests/SentryTests/SentryCrash/SentryStacktraceBuilderTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class SentryStacktraceBuilderTests: XCTestCase {
7676
)
7777
}
7878

79-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
8079
func testConcurrentStacktraces() throws {
8180
guard #available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) else {
8281
throw XCTSkip("Not available for earlier platform versions")
@@ -102,7 +101,6 @@ class SentryStacktraceBuilderTests: XCTestCase {
102101
wait(for: [waitForAsyncToRun], timeout: 10)
103102
}
104103

105-
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
106104
func testConcurrentStacktraces_noStitching() throws {
107105
guard #available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) else {
108106
throw XCTSkip("Not available for earlier platform versions")

0 commit comments

Comments
 (0)