Native crumbs#111
Conversation
Remove Cassette related Tests
KrzaQ
left a comment
There was a problem hiding this comment.
I don't have much to say, it looks ok to me.
| self.queue = try CASQueueFile.init(path: breadcrumbSettings.getBreadcrumbLogPath().path) | ||
|
|
||
|
|
||
| self.breadcrumbLogURL = try breadcrumbSettings.getBreadcrumbLogPath() |
There was a problem hiding this comment.
why it can throw? Maybe it would be better to throw an error faster and here pass only data needed by BacktraceBreadcrumbFileHelper?
| self.queue = try CASQueueFile.init(path: breadcrumbSettings.getBreadcrumbLogPath().path) | ||
|
|
||
|
|
||
| self.breadcrumbLogURL = try breadcrumbSettings.getBreadcrumbLogPath() |
There was a problem hiding this comment.
what if the file doesn't exist? we don't create it anywhere. We always write to a file. How about creating a start method that will do startup logic?
There was a problem hiding this comment.
the file will always exist;
getBreadcrumbLogPath() method will create a file if doesn't exist
There was a problem hiding this comment.
there is no good way to do this since BacktraceBreadcrumbSettings forces us to (try/unwrap), if for any reason the file is nil the files operations methods will catch the error and warn BacktraceLogger.
Rename BacktraceBreadcrumbFileHelper to BacktraceBreadcrumbFile Code improvements
Add BacktraceBreadcrumbFile extension to host file operations Add remove(at index: Int) to Queue class Update BacktraceLogger error messages
|
|
||
| func clearBreadcrumbLogFile(at breadcrumbLogURL: URL) { | ||
| do { | ||
| try "".write(to: breadcrumbLogURL, atomically: false, encoding: .utf8) |
There was a problem hiding this comment.
what if someone deletes a file when you're generating breadcrumbs?
| BacktraceLogger.warning("Error when adding breadcrumbSize to array") | ||
| return false | ||
| } | ||
| let queueBreadcrumb = queuedBreadcrumbs[index] |
There was a problem hiding this comment.
We receive index out of bounds when we access breadcrumbs with an invalid index, right? or will it return null?
There was a problem hiding this comment.
it shouldn't but I'll guard it
| @@ -1,5 +1,15 @@ | |||
| import Foundation | |||
|
|
|||
| struct BreadcrumbRecord { | |||
There was a problem hiding this comment.
I think it should be moved to a separated file.
You implemented queue to be generic. However, putting BreadcrumbRecord definition in the Queue implementation sounds weird.
| @@ -1,5 +1,15 @@ | |||
| import Foundation | |||
There was a problem hiding this comment.
Is it QueueFile? I believe its a generic queue instead. Can we rename the file to Queue or something like that?
Add BreadcrumbRecord class definition Rename QueueFile to Queue Guard queue index when iterating
| let text = "this is Breadcrumb number \(writeIndex)" | ||
| // submit a task to the queue for background execution | ||
| DispatchQueue.global().async(group: group, execute: { | ||
| expect { breadcrumbs.addBreadcrumb(text) }.to(beTrue()) |
There was a problem hiding this comment.
Without this background task, this test doesn't do what is intended to do (in fact, the entire loop is useless).
We had lots of problems with multithreaded behavior corrupting the file, so beware!
There was a problem hiding this comment.
I'll seep a close eye on multithreaded behaviour, thank you!
| let fileSize = attr[FileAttributeKey.size] as? Int | ||
| let requestedSize = settings.maxQueueFileSizeBytes | ||
| expect { fileSize }.to(beLessThanOrEqualTo(requestedSize)) | ||
| expect { fileSize }.to(beGreaterThanOrEqualTo(requestedSize - 1000)) |
There was a problem hiding this comment.
This check is important. I would consider adjusting it, not deleting it.
| // Currently, we accept we lose this Breadcrumb in the UI - it will still be in the file | ||
| // for manual inspection. | ||
| let expectedNumberOfMatches = writeIndex - wrapIndex - 1 | ||
| expect(matches).to(beGreaterThanOrEqualTo(expectedNumberOfMatches), |
There was a problem hiding this comment.
This check is important. I would consider adjusting it, not deleting it. The -1 may no longer be necessary due to the Cassette dependency being removed.
There was a problem hiding this comment.
This test is specifically there to make sure the file rolls over, so the number of expected matches are really important. Otherwise the entire test doesn't do anything the other (smaller) tests already do.
There was a problem hiding this comment.
Removed this one for the same reason, I'll adjust it.
Thank you :)
| s.osx.public_header_files = ["Backtrace-macOS/**/*.h*"] | ||
| s.tvos.public_header_files = ["Backtrace-tvOS/**/*.h*"] | ||
|
|
||
| s.ios.dependency "Cassette", '1.0.0-beta5' |
There was a problem hiding this comment.
Check if there's any superfluous #if os(iOS) || os(OSX) left in prod/test code. I know there were a bunch of 'm
|
Hey hey! Cool that that pesky Cassette is finally being removed :). I forgot where, but there's performance test results stored in Github or Hack somewhere that document for which file sizes the performance is what. This PR seems to be doing somewhat similar to what #95 was meant to do (but is outdated now). You may want to compare and then close it. Thanks :) |
Uh oh!
There was an error while loading. Please reload this page.