-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to save test results to disk #64
base: main
Are you sure you want to change the base?
Conversation
c830440
to
43100d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good!
Sorry that we missed it earlier.
Is it still useful for you to get it merged?
Just a couple of line notes.
@@ -72,6 +72,7 @@ extension EnvironmentValues { | |||
var analyticsBaseURL: URL? { self.url(for: "BUILDKITE_ANALYTICS_BASE_URL") } | |||
|
|||
var isAnalyticsDebugEnabled: Bool { self.bool(for: "BUILDKITE_ANALYTICS_DEBUG_ENABLED") ?? false } | |||
var isAnalyticsCachingEnabled: Bool { self.bool(for: "BUILDKITE_ANALYTICS_CACHING_ENABLED") ?? true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this default to false
?
} | ||
|
||
private func saveTestData(_ testData: TestResults) throws { | ||
try fileController.saveData(testData, fileName: "TestResults-\(UUID().uuidString)", fileExtension: "json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if a timestamp near the left of the filename would be useful for sort order, and to differentiate e.g. todays results from stale results sitting around?
/// Whether caching is enabled. | ||
var isCacheEnabled: Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about calling this “cache” 🤔
I figure cache is generally an additional layer of storage, often for performance, and the cache subsystem manages writing and reading from that store.
Whereas this feels like an output mode; it's storing data in a location for some other process to pick up later (for subsequent out-of-band uploading).
Maybe it's “store local files” e.g. isStoreLocalFilesEnabled
?
💬 Summary of Changes
true
into a new environment value ofBUILDKITE_ANALYTICS_CACHING_ENABLED
. When this value isfalse
, traces won't be recorded and will also prevent data from being written to disk .json
file, containing the data that would otherwise be sent over to the API.🧾 Checklist
📝 Items of Note
Due to the app sandbox restrictions, test results can't be written to an arbitrary folder in the macOS file systems when unit tests are being run on Xcode simulators. As such, test results are saved in the app container's directory, in
Documents/BuildkiteTestCollector
.