-
Notifications
You must be signed in to change notification settings - Fork 128
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
Bug 1721193 - Remove reliance on Operation
for uploading tasks in the background
#1783
Conversation
a560a87
to
1dd23be
Compare
I assume this is for bug 1721193? |
This certainly simplifies things. |
Yeah, the tests were being a pain on Friday so I opted to look into them with fresh eyes today. |
Yes, I forget we have the bug linking thing if I name my PR's correctly. |
Operation
for uploading tasks in the backgroundOperation
for uploading tasks in the background
3465972
to
1c077fb
Compare
Codecov Report
@@ Coverage Diff @@
## main #1783 +/- ##
=======================================
Coverage 29.41% 29.41%
=======================================
Files 1 1
Lines 34 34
=======================================
Hits 10 10
Misses 24 24 Continue to review full report at Codecov.
|
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.
Lots of questions inline.
Code itself looks good, it's mostly about our testing strategy and why certain things are happening.
glean-core/ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift
Outdated
Show resolved
Hide resolved
glean-core/ios/GleanTests/Scheduler/MetricsPingSchedulerTests.swift
Outdated
Show resolved
Hide resolved
glean-core/ios/GleanTests/Scheduler/MetricsPingSchedulerTests.swift
Outdated
Show resolved
Hide resolved
cb2c00b
to
ed450c5
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.
Re-raising a couple points for visibility.
I merged #1791, I would appreciate if you rebase and include the changes to the URL metric type tests.
Switching to a method resetGleanDiscardingInitialPings
is a good idea!
This relies on the background operation capabilities that are built into URLSession, which we were already using wrapped in an `Operation`. This removes the wrapping, using just the URLOperation capabilities. Update changelog
This addresses the iOS tests that are leaking pings to the ingestion pipeline and are showing up in the Glean Debug View. This wraps any call to `resetGlean` with an OHTTPStub in order to intercept the request and prevent the network activity. Most test cases just reset Glean in the `setUp` function, and so the startup pings are now intercepted so they don't interfere with the tests or escape. In some cases, where we were already using stubs as we test contents of pings, the intent of the test was maintained and any setup calls to `resetGlean` were also wrapped in a way to not interfere with these tests' intents.
ed450c5
to
65dfe08
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.
Some small things left, but with those changed we can land it.
Glean.shared.setUploadEnabled(true) | ||
OHHTTPStubs.removeAllStubs() | ||
expectation = nil | ||
tearDownStubs() |
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.
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 relies on the background operation capabilities that are built into URLSession, which we were already using wrapped in an
Operation
. This removes the wrapping, using just the URLOperation capabilities.