Add a withResetFOG helper function for tests that need to reset FOG after every subtask
Categories
(Toolkit :: Telemetry, enhancement, P4)
Tracking
()
People
(Reporter: aminomancer, Unassigned)
References
(Blocks 1 open bug)
Details
While working on some telemetry tests, I encountered an issue where Services.fog.testResetFOG()
hanged for 60+ seconds, apparently because I ran it once at the start of the test (working fine and quickly) and again at the end of the test (which hanged for a minute). When I instead added it to the end of every subtask, it all worked very quickly. So it seems like, at least under certain (unknown) conditions, there is a bug that causes testResetFOG()
to hang if it hasn't been run often enough. No idea what difference that makes technically, but I assume each subtask is accumulating some kind of data that, once it croshes a certain threshold, becomes problematic for testResetFOG to deal with. So it has to be cleared out more frequently. But that means adding a lot of extra boilerplate, especially if we also add testFlushAllChildren()
, which seems to be good practice. So, we thought it would be a good idea to add a wrapper for the boilerplate:
function withResetFOG(callback) {
await Services.fog.testFlushAllChildren();
Services.fog.testResetFOG();
await callback();
Services.fog.testResetFOG();
}
add_task(async function test_something() {
await withResetFOG(async () => {
const events = Glean.some.property.testGetValue();
is(events[0].name, "event", `Glean event should have name "event"`);
});
}
Updated•4 days ago
|
Description
•