Skip to content

Commit

Permalink
Merge 1271d8c into cdf9acd
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight authored Nov 24, 2022
2 parents cdf9acd + 1271d8c commit e2a8c76
Show file tree
Hide file tree
Showing 44 changed files with 153 additions and 361 deletions.
4 changes: 4 additions & 0 deletions Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
7BFC8B0626D4D24B000D3504 /* LoremIpsum.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */; };
844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */; };
844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */; };
84732B28292F0BE600790372 /* SentryBaseUnitTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84732B27292F0BE600790372 /* SentryBaseUnitTest.swift */; };
848A256B286E3351008A8858 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; };
848A256D286E3351008A8858 /* fatal-error-binary-images-message2.json in Resources */ = {isa = PBXBuildFile; fileRef = D83A30DF279F1F5C00372D0A /* fatal-error-binary-images-message2.json */; };
848A256F286E3351008A8858 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
Expand Down Expand Up @@ -250,6 +251,7 @@
7B64386C26A6C544000D0F65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7B79000329028C7300A7F467 /* MetricKitManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetricKitManager.swift; sourceTree = "<group>"; };
7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LoremIpsum.txt; sourceTree = "<group>"; };
84732B27292F0BE600790372 /* SentryBaseUnitTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryBaseUnitTest.swift; sourceTree = "<group>"; };
848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerformanceBenchmarks.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
848A2578286E3490008A8858 /* PerformanceBenchmarks-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PerformanceBenchmarks-Info.plist"; sourceTree = "<group>"; };
84B527B728DD24BA00475E8D /* SentryDeviceTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SentryDeviceTests.mm; path = ../../../Tests/SentryTests/Helper/SentryDeviceTests.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -426,6 +428,7 @@
D83A30DF279F1F5C00372D0A /* fatal-error-binary-images-message2.json */,
7B64386A26A6C544000D0F65 /* LaunchUITests.swift */,
D83A30E5279FE21F00372D0A /* SentryFileIOTrackingIntegrationTests.swift */,
84732B27292F0BE600790372 /* SentryBaseUnitTest.swift */,
84B527B728DD24BA00475E8D /* SentryDeviceTests.mm */,
84B527BB28DD25E400475E8D /* SentryDevice.h */,
84B527BC28DD25E400475E8D /* SentryDevice.mm */,
Expand Down Expand Up @@ -834,6 +837,7 @@
84B527B928DD24BA00475E8D /* SentryDeviceTests.mm in Sources */,
D83A30E6279FE21F00372D0A /* SentryFileIOTrackingIntegrationTests.swift in Sources */,
7B64386B26A6C544000D0F65 /* LaunchUITests.swift in Sources */,
84732B28292F0BE600790372 /* SentryBaseUnitTest.swift in Sources */,
84B527BD28DD25E400475E8D /* SentryDevice.mm in Sources */,
D83A30C8279EFD6E00372D0A /* ClearTestState.swift in Sources */,
);
Expand Down
5 changes: 5 additions & 0 deletions Samples/iOS-Swift/iOS-SwiftUITests/SentryBaseUnitTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This is a dummy copy of SentryBaseUnitTest to be used by SentryFileIOTrackingIntegrationTests when compiled into iOS-SwiftUITests

import XCTest

class SentryBaseUnitTest: XCTestCase {}
8 changes: 4 additions & 4 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@
7BCFBD6D2681D0A900BC27D8 /* SentryCrashScopeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */; };
7BCFBD6F2681D0EE00BC27D8 /* SentryCrashScopeObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */; };
7BD337E424A356180050DB6E /* SentryCrashIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD337E324A356180050DB6E /* SentryCrashIntegrationTests.swift */; };
7BD47B4E268F0B470076A663 /* ClearTestState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD47B4C268F0B080076A663 /* ClearTestState.swift */; };
7BD4BD4127EB0F0D0071F4FF /* SentryDiscardReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD4BD4027EB0F0C0071F4FF /* SentryDiscardReason.h */; };
7BD4BD4327EB29BA0071F4FF /* SentryClientReport.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD4BD4227EB29BA0071F4FF /* SentryClientReport.h */; };
7BD4BD4527EB29F50071F4FF /* SentryClientReport.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD4BD4427EB29F50071F4FF /* SentryClientReport.m */; };
Expand Down Expand Up @@ -602,6 +601,7 @@
8419C0C428C1889D001C8259 /* SentryProfilerSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419C0C328C1889D001C8259 /* SentryProfilerSwiftTests.swift */; };
8453421228BE855D00C22EEC /* SentrySampleDecision.m in Sources */ = {isa = PBXBuildFile; fileRef = 8453421128BE855D00C22EEC /* SentrySampleDecision.m */; };
8453421628BE8A9500C22EEC /* SentrySpanStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 8453421528BE8A9500C22EEC /* SentrySpanStatus.m */; };
84732A71292C3CF800790372 /* SentryBaseUnitTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84732A70292C3CF800790372 /* SentryBaseUnitTest.swift */; };
84A888FD28D9B11700C51DFD /* SentryProfiler+Test.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A888FC28D9B11700C51DFD /* SentryProfiler+Test.h */; };
84A8891C28DBD28900C51DFD /* SentryDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A8891A28DBD28900C51DFD /* SentryDevice.h */; };
84A8891D28DBD28900C51DFD /* SentryDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84A8891B28DBD28900C51DFD /* SentryDevice.mm */; };
Expand Down Expand Up @@ -1290,7 +1290,6 @@
7BCFBD6C2681D0A900BC27D8 /* SentryCrashScopeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashScopeObserver.h; path = include/SentryCrashScopeObserver.h; sourceTree = "<group>"; };
7BCFBD6E2681D0EE00BC27D8 /* SentryCrashScopeObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashScopeObserver.m; sourceTree = "<group>"; };
7BD337E324A356180050DB6E /* SentryCrashIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashIntegrationTests.swift; sourceTree = "<group>"; };
7BD47B4C268F0B080076A663 /* ClearTestState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearTestState.swift; sourceTree = "<group>"; };
7BD4BD4027EB0F0C0071F4FF /* SentryDiscardReason.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDiscardReason.h; path = include/SentryDiscardReason.h; sourceTree = "<group>"; };
7BD4BD4227EB29BA0071F4FF /* SentryClientReport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryClientReport.h; path = include/SentryClientReport.h; sourceTree = "<group>"; };
7BD4BD4427EB29F50071F4FF /* SentryClientReport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryClientReport.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1413,6 +1412,7 @@
844DA81F28246DE300E6B62E /* scripts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = scripts; sourceTree = "<group>"; };
8453421128BE855D00C22EEC /* SentrySampleDecision.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySampleDecision.m; sourceTree = "<group>"; };
8453421528BE8A9500C22EEC /* SentrySpanStatus.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySpanStatus.m; sourceTree = "<group>"; };
84732A70292C3CF800790372 /* SentryBaseUnitTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryBaseUnitTest.swift; sourceTree = "<group>"; };
84A888FC28D9B11700C51DFD /* SentryProfiler+Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SentryProfiler+Test.h"; path = "Sources/Sentry/include/SentryProfiler+Test.h"; sourceTree = SOURCE_ROOT; };
84A8891A28DBD28900C51DFD /* SentryDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDevice.h; path = include/SentryDevice.h; sourceTree = "<group>"; };
84A8891B28DBD28900C51DFD /* SentryDevice.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryDevice.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1962,7 +1962,6 @@
639889D21EDF06C100EA7442 /* SentryTests-Bridging-Header.h */,
63AA75951EB8AEDB00D153DE /* SentryTests.m */,
7B9421C4260CA393001F9349 /* SentrySDK+Tests.h */,
7BD47B4C268F0B080076A663 /* ClearTestState.swift */,
7BA8409F24A1EC6E00B718AA /* SentrySDKTests.swift */,
630436151EC0AD3100C4D3FA /* SentryNSDataCompressionTests.m */,
630C01931EC3402C00C52CEF /* SentryKSCrashReportConverterTests.m */,
Expand All @@ -1981,6 +1980,7 @@
7B0002312477F0520035FEF1 /* SentrySessionTests.m */,
7B0002332477F52D0035FEF1 /* SentrySessionTests.swift */,
7B944FAF2469B46000A10721 /* TestClient.swift */,
84732A70292C3CF800790372 /* SentryBaseUnitTest.swift */,
7B0A54552523178700A71716 /* SentryScopeSwiftTests.swift */,
8E70B10025CB8695002B3155 /* SentrySpanIdTests.swift */,
7B4260332630315C00B36EDD /* SampleError.swift */,
Expand Down Expand Up @@ -3657,6 +3657,7 @@
63FE722220DA66EC00CDBAE8 /* SentryCrashJSONCodec_Tests.m in Sources */,
7B0A5452252311CE00A71716 /* SentryBreadcrumbTests.swift in Sources */,
7BA0C04A280563AA003E0326 /* TestTransportAdapter.swift in Sources */,
84732A71292C3CF800790372 /* SentryBaseUnitTest.swift in Sources */,
7BE3C7752445C82300A38442 /* SentryCurrentDateTests.swift in Sources */,
7B3398672459C4AE00BD9C96 /* SentryEnvelopeRateLimitTests.swift in Sources */,
8EA9AF492665AC48002771B4 /* SentryPerformanceTrackerTests.swift in Sources */,
Expand Down Expand Up @@ -3756,7 +3757,6 @@
7BC6EC18255C44540059822A /* SentryDebugMetaTests.swift in Sources */,
A811D867248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift in Sources */,
7B82D54924E2A2D400EE670F /* SentryIdTests.swift in Sources */,
7BD47B4E268F0B470076A663 /* ClearTestState.swift in Sources */,
7B6D98ED24C703F8005502FA /* Async.swift in Sources */,
7BA0C04C28056556003E0326 /* SentryTransportAdapterTests.swift in Sources */,
7BE0DC29272A9E1C004FA8B7 /* SentryBreadcrumbTrackerTests.swift in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions Sources/SentryCrash/Recording/Tools/SentryCrashFileUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ sentrycrashfu_removeFile(const char *path, bool mustExist)
bool
sentrycrashfu_deleteContentsOfPath(const char *path)
{
if (path == NULL) {
return false;
}

if (!canDeletePath(path)) {
return false;
}
Expand Down
30 changes: 0 additions & 30 deletions Tests/SentryTests/ClearTestState.swift

This file was deleted.

10 changes: 2 additions & 8 deletions Tests/SentryTests/Helper/SentrySwizzleWrapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension SentrySwizzleWrapper {

}

class SentrySwizzleWrapperTests: XCTestCase {
class SentrySwizzleWrapperTests: SentryBaseUnitTest {

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

Expand All @@ -31,16 +31,10 @@ class SentrySwizzleWrapperTests: XCTestCase {

override func setUp() {
super.setUp()

fixture = Fixture()
sut = SentrySwizzleWrapper.sharedInstance
}

override func tearDown() {
super.tearDown()
clearTestState()
}


func testSendAction_RegisterCallbacks_CallbacksCalled() {
let firstExpectation = expectation(description: "first")
sut.swizzleSendAction({ actualAction, _, _, actualEvent in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {

override func tearDown() {
sut.uninstall()
clearTestState()
super.tearDown()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Sentry
import XCTest

class SentryAutoBreadcrumbTrackingIntegrationTests: XCTestCase {
class SentryAutoBreadcrumbTrackingIntegrationTests: SentryBaseUnitTest {

private class Fixture {
let tracker = SentryTestBreadcrumbTracker(swizzleWrapper: SentrySwizzleWrapper.sharedInstance)
Expand All @@ -18,11 +18,6 @@ class SentryAutoBreadcrumbTrackingIntegrationTests: XCTestCase {
fixture = Fixture()
}

override func tearDown() {
super.tearDown()
clearTestState()
}

func testInstallWithSwizzleEnabled_StartSwizzleCalled() {
let sut = fixture.sut

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest

class SentryBreadcrumbTrackerTests: XCTestCase {
class SentryBreadcrumbTrackerTests: SentryBaseUnitTest {

private var scope: Scope!

Expand All @@ -12,12 +12,7 @@ class SentryBreadcrumbTrackerTests: XCTestCase {
let hub = TestHub(client: client, andScope: scope)
SentrySDK.setCurrentHub(hub)
}

override func tearDown() {
super.tearDown()
clearTestState()
}


#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

func testStopRemovesSwizzleSendAction() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@testable import Sentry
import XCTest

class SentrySystemEventBreadcrumbsTest: XCTestCase {
class SentrySystemEventBreadcrumbsTest: SentryBaseUnitTest {

// This feature only works on iOS
#if os(iOS)
Expand Down Expand Up @@ -59,8 +59,6 @@ class SentrySystemEventBreadcrumbsTest: XCTestCase {

override func tearDown() {
super.tearDown()
clearTestState()
fixture.fileManager.deleteTimezoneOffset()
sut.stop()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import XCTest
import UIKit
#endif

class NotificationCenterTestCase: XCTestCase {
class NotificationCenterTestCase: SentryBaseUnitTest {

#if os(tvOS) || os(iOS)
let willEnterForegroundNotification = UIApplication.willEnterForegroundNotification
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest

class SentryOutOfMemoryIntegrationTests: XCTestCase {
class SentryOutOfMemoryIntegrationTests: SentryBaseUnitTest {

private class Fixture {
let options: Options
Expand Down Expand Up @@ -37,8 +37,6 @@ class SentryOutOfMemoryIntegrationTests: XCTestCase {

override func tearDown() {
sut?.uninstall()
fixture.fileManager.deleteAllFolders()
clearTestState()
super.tearDown()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class SentryOutOfMemoryTrackerTests: NotificationCenterTestCase {
override func tearDown() {
super.tearDown()
sut.stop()
fixture.client.fileManager.deleteAllFolders()

clearTestState()
}

func testStart_StoresAppState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class SentryAppStartTrackerTests: NotificationCenterTestCase {
super.tearDown()
sut.stop()
fixture.fileManager.deleteAllFolders()
clearTestState()
}

func testFirstStart_IsColdStart() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CoreData
import XCTest

class SentryCoreDataTrackerTests: XCTestCase {
class SentryCoreDataTrackerTests: SentryBaseUnitTest {

private class Fixture {
let context = TestNSManagedObjectContext()
Expand Down Expand Up @@ -30,11 +30,6 @@ class SentryCoreDataTrackerTests: XCTestCase {
fixture = Fixture()
}

override func tearDown() {
super.tearDown()
clearTestState()
}

func testConstants() {
//Test constants to make sure we don't accidentally change it
XCTAssertEqual(SENTRY_COREDATA_FETCH_OPERATION, "db.sql.query")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CoreData
import XCTest

class SentryCoreDataTrackingIntegrationTests: XCTestCase {
class SentryCoreDataTrackingIntegrationTests: SentryBaseUnitTest {

private class Fixture {
let context = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
Expand Down Expand Up @@ -29,7 +29,6 @@ class SentryCoreDataTrackingIntegrationTests: XCTestCase {
override func tearDown() {
super.tearDown()
fixture.coreDataStack.reset()
clearTestState()
}

func test_InstallAndUninstall() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XCTest
// GitHub Actions doesn't have simulators for iOS 11 and 10.
// That's why we need to keep it generic, without access
// to any private part of the SDK.
class SentryFileIOTrackingIntegrationTests: XCTestCase {
class SentryFileIOTrackingIntegrationTests: SentryBaseUnitTest {

private class Fixture {
let data = "SOME DATA".data(using: .utf8) ?? Data()
Expand Down Expand Up @@ -52,7 +52,6 @@ class SentryFileIOTrackingIntegrationTests: XCTestCase {
if deleteFileDirectory {
try? FileManager.default.removeItem(at: fixture.fileDirectory)
}
clearTestState()
}

func test_WritingTrackingDisabled_forIOOption() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest

class SentryNSDataTrackerTests: XCTestCase {
class SentryNSDataTrackerTests: SentryBaseUnitTest {

private class Fixture {

Expand All @@ -26,11 +26,6 @@ class SentryNSDataTrackerTests: XCTestCase {
SentrySDK.start { $0.enableFileIOTracking = true }
}

override func tearDown() {
super.tearDown()
clearTestState()
}

func testConstants() {
//A test to ensure this constants don't accidentally change
XCTAssertEqual("file.read", SENTRY_FILE_READ_OPERATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Sentry
import SwiftUI
import XCTest

class SentryNetworkTrackerIntegrationTests: XCTestCase {
class SentryNetworkTrackerIntegrationTests: SentryBaseUnitTest {

private static let dsnAsString = TestConstants.dsnAsString(username: "SentryNetworkTrackerIntegrationTests")
private static let testBaggageURL = URL(string: "http://localhost:8080/echo-baggage-header")!
Expand All @@ -12,7 +12,7 @@ class SentryNetworkTrackerIntegrationTests: XCTestCase {
private static let transactionOperation = "Test"

private class Fixture {
let dateProvider = TestCurrentDateProvider()
let dateProvider = CurrentDate.getProvider()! as! TestCurrentDateProvider
let options: Options

init() {
Expand All @@ -28,11 +28,6 @@ class SentryNetworkTrackerIntegrationTests: XCTestCase {
super.setUp()
fixture = Fixture()
}

override func tearDown() {
super.tearDown()
clearTestState()
}

func testNSURLSessionConfiguration_NoActiveSpan_NoHeadersAdded() {
startSDK()
Expand Down
Loading

0 comments on commit e2a8c76

Please sign in to comment.