TelemetryTestUtils.assertScalar assumes Number (so behaves odd for boolean, strings)
Categories
(Toolkit :: Telemetry, task)
Tracking
()
People
(Reporter: Mardak, Assigned: Mardak)
References
Details
Attachments
(1 obsolete file)
The test function currently checks value > 0
to decide between asserting the value or asserting that the scalar is not set:
https://searchfox.org/mozilla-central/rev/2c991232499e826e46f9d976eb653817340ba389/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm#14-28
There are some uses that indeed pass in an expected value of 0
which seems like indeed doesn't set a scalar value:
https://searchfox.org/mozilla-central/rev/2c991232499e826e46f9d976eb653817340ba389/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_telemetry.js#163-168
As well as true
for boolean:
https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell/test_ext_telemetry.js#163-167
And a string "hello"
that seems to be incorrectly passing(??):
https://searchfox.org/mozilla-central/rev/2c991232499e826e46f9d976eb653817340ba389/toolkit/components/extensions/test/xpcshell/test_ext_telemetry.js#592-596
I noticed this when trying to add a test that asserted false
in bug 1715348.
Assignee | ||
Comment 1•3 years ago
|
||
(In reply to Ed Lee :Mardak from comment #0)
And a string
"hello"
that seems to be incorrectly passing(??):
https://searchfox.org/mozilla-central/rev/2c991232499e826e46f9d976eb653817340ba389/toolkit/components/extensions/test/xpcshell/test_ext_telemetry.js#592-596
Looking at other uses of assertScalar
in test_ext_telemetry, maybe it should be passed in "dynamic" instead of "parent"
https://searchfox.org/mozilla-central/rev/2c991232499e826e46f9d976eb653817340ba389/toolkit/components/extensions/test/xpcshell/test_ext_telemetry.js#659-663
Assignee | ||
Comment 2•3 years ago
|
||
Allow both 0 and undefined to have TelemetryTestUtils.assertScalar check for not reported scalar.
Comment 3•3 years ago
|
||
Comment on attachment 9226400 [details]
Bug 1715847 - TelemetryTestUtils.assertScalar assumes Number (so behaves odd for boolean, strings) r?Standard8
Revision D117457 was moved to bug 1633883. Setting attachment 9226400 [details] to obsolete.
Assignee | ||
Updated•3 years ago
|
Description
•