Bug 1548535 - Cancel any pending workers when ping upload disabled#235
Conversation
Codecov Report
@@ Coverage Diff @@
## master #235 +/- ##
============================================
+ Coverage 70.47% 70.55% +0.08%
- Complexity 187 188 +1
============================================
Files 51 51
Lines 3062 3067 +5
Branches 453 454 +1
============================================
+ Hits 2158 2164 +6
Misses 579 579
+ Partials 325 324 -1
Continue to review full report at Codecov.
|
Dexterp37
left a comment
There was a problem hiding this comment.
Thanks for taking care of this! It looks good overall, I have a few design considerations below. My "biggest concern" is testing: let's try to make these tests more "unit" and less "integration"
|
|
||
| @Test | ||
| fun `Workers should be cancelled when disabling uploading`() { | ||
| // Force the MetricsPingScheduler to schedule the MetricsPingWorker |
There was a problem hiding this comment.
I think I'd like to see this being more "unit" and less "integration": if we have two cancel functions, then we can test each one independently in their modules using the workmanager. Here, we'd just stub out and make sure that cancel is called when setUploadEnabled is called.
There was a problem hiding this comment.
If I'm going to make the cancel functions static members of their respective classes, it's not really practical to stub out a static method using Mockito so I propose to leave this test as it is and file a follow up bug to investigate the best way to approach this. I did add unit tests for the cancel functions in each of the test classes associated with the workers.
There was a problem hiding this comment.
Good point, makes sense.
This updates the cancel functions that were recently added to cancel WorkManager workers when the metrics were disabled. This keeps glean-ac in line with the change requests for [this PR](mozilla/glean#235) in Glean-Core.
This updates the cancel functions that were recently added to cancel WorkManager workers when the metrics were disabled. This keeps glean-ac in line with the change requests for [this PR](mozilla/glean#235) in Glean-Core.
This cancels any pending
PingUploadWorkersorMetricsPingWorkerswhen upload is disabled.Pull Request checklist
make testruns without emitting any warningsmake lintruns without emitting any errors