Update the RustSDK and adopt the new tracing configuration that allows maximum size and age limits on all logs.
Set that 100Mb and a week and remove previous rageshake uploading checks as they are no longer required.
This commit is contained in:
committed by
Stefan Ceriu
parent
7111569f7c
commit
4ec2516d55
@@ -55,7 +55,6 @@ class BugReportServiceTests: XCTestCase {
|
||||
let service = BugReportService(rageshakeURLPublisher: urlPublisher.asCurrentValuePublisher(),
|
||||
applicationID: "mock_app_id",
|
||||
sdkGitSHA: "1234",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
XCTAssertTrue(service.isEnabled)
|
||||
@@ -67,7 +66,6 @@ class BugReportServiceTests: XCTestCase {
|
||||
let service = BugReportService(rageshakeURLPublisher: urlPublisher.asCurrentValuePublisher(),
|
||||
applicationID: "mock_app_id",
|
||||
sdkGitSHA: "1234",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
XCTAssertFalse(service.isEnabled)
|
||||
@@ -79,7 +77,6 @@ class BugReportServiceTests: XCTestCase {
|
||||
let service = BugReportService(rageshakeURLPublisher: urlPublisher.asCurrentValuePublisher(),
|
||||
applicationID: "mock_app_id",
|
||||
sdkGitSHA: "1234",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
|
||||
@@ -107,7 +104,6 @@ class BugReportServiceTests: XCTestCase {
|
||||
let service = BugReportService(rageshakeURLPublisher: appSettings.bugReportRageshakeURL.publisher,
|
||||
applicationID: "mock_app_id",
|
||||
sdkGitSHA: "1234",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
XCTAssertTrue(service.isEnabled)
|
||||
@@ -139,31 +135,6 @@ class BugReportServiceTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(defaultConfigurationResponse.reportURL, initialURL.absoluteString.replacingOccurrences(of: "submit", with: "123"))
|
||||
}
|
||||
|
||||
func testLogsMaxSize() {
|
||||
// Given a new set of logs
|
||||
var logs = BugReportService.Logs(maxFileSize: 1000)
|
||||
XCTAssertEqual(logs.zippedSize, 0)
|
||||
XCTAssertEqual(logs.originalSize, 0)
|
||||
XCTAssertTrue(logs.files.isEmpty)
|
||||
|
||||
// When adding new files within the size limit
|
||||
logs.appendFile(at: .homeDirectory, zippedSize: 250, originalSize: 1000)
|
||||
logs.appendFile(at: .picturesDirectory, zippedSize: 500, originalSize: 2000)
|
||||
|
||||
// Then the logs should be included
|
||||
XCTAssertEqual(logs.zippedSize, 750)
|
||||
XCTAssertEqual(logs.originalSize, 3000)
|
||||
XCTAssertEqual(logs.files, [.homeDirectory, .picturesDirectory])
|
||||
|
||||
// When adding a new file larger that will exceed the size limit
|
||||
logs.appendFile(at: .homeDirectory, zippedSize: 500, originalSize: 2000)
|
||||
|
||||
// Then the files shouldn't be included.
|
||||
XCTAssertEqual(logs.zippedSize, 750)
|
||||
XCTAssertEqual(logs.originalSize, 3000)
|
||||
XCTAssertEqual(logs.files, [.homeDirectory, .picturesDirectory])
|
||||
}
|
||||
}
|
||||
|
||||
private class MockURLProtocol: URLProtocol {
|
||||
|
||||
@@ -19,8 +19,9 @@ class LoggingTests: XCTestCase {
|
||||
Tracing.logsDirectoryOverride = nil
|
||||
try reloadTracingFileWriter(configuration: .init(path: URL.appGroupLogsDirectory.path(percentEncoded: false),
|
||||
filePrefix: "console-tests",
|
||||
fileSuffix: "log",
|
||||
maxFiles: 100))
|
||||
fileSuffix: ".log",
|
||||
maxTotalSizeBytes: 1000,
|
||||
maxAgeSeconds: 1000))
|
||||
}
|
||||
|
||||
func testFileLogging() throws {
|
||||
@@ -343,8 +344,9 @@ class LoggingTests: XCTestCase {
|
||||
if redirectTracingFileWriter {
|
||||
try reloadTracingFileWriter(configuration: .init(path: testDirectory.path(percentEncoded: false),
|
||||
filePrefix: "console",
|
||||
fileSuffix: "log",
|
||||
maxFiles: 100))
|
||||
fileSuffix: ".log",
|
||||
maxTotalSizeBytes: 1000,
|
||||
maxAgeSeconds: 1000))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user