Closed Bug 1023341 Opened 7 years ago Closed 7 years ago

Intermittent test_networkstats_alarms.html | addAlarm() shouldn't fail.

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33
Tracking Status
firefox31 --- unaffected
firefox32 --- fixed
firefox33 --- fixed
firefox-esr24 --- unaffected
b2g-v1.4 --- unaffected
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: emorley, Assigned: johnshih.bugs)

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

b2g_emulator_vm fx-team opt test mochitest-7 on 2014-06-09 23:13:19 PDT for push 410f509e9913

slave: tst-linux64-spot-112

https://tbpl.mozilla.org/php/getParsedLog.php?id=41418586&tree=Fx-Team

{
23:44:54     INFO -  218 INFO TEST-START | /tests/dom/network/tests/test_networkstats_alarms.html
23:45:03     INFO -  219 INFO TEST-INFO | dumping last 11 message(s)
23:45:03     INFO -  220 INFO TEST-INFO | if you need more context, please use SimpleTest.requestCompleteLog() in your test
23:45:03     INFO -  221 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Checking if no alarms are set.
23:45:03     INFO -  222 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Succeeded to get alarms.
23:45:03     INFO -  223 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | There are no alarms set.
23:45:03     INFO -  224 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Calling getAllAlarms() with invalid network.
23:45:03     INFO -  225 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Get InvalidInterface error
23:45:03     INFO -  226 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Calling addAlarm() with invalid network or parameters.
23:45:03     INFO -  227 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no parameters
23:45:03     INFO -  228 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no network
23:45:03     INFO -  229 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no threshold
23:45:03     INFO -  230 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Get InvalidThresholdValue error
23:45:03     INFO -  231 INFO TEST-PASS | /tests/dom/network/tests/test_networkstats_alarms.html | Calling addAlarm()
23:45:03     INFO -  232 INFO TEST-UNEXPECTED-FAIL | /tests/dom/network/tests/test_networkstats_alarms.html | addAlarm() shouldn't fail.
23:49:58     INFO -  233 INFO TEST-UNEXPECTED-FAIL | /tests/dom/network/tests/test_networkstats_alarms.html | Test timed out.
}
This one seems to be a new symptom other than bug 958689.
(In reply to Gene Lian [:gene] (needinfo? encouraged) from comment #2)
> This one seems to be a new symptom other than bug 958689.

Except this one is near perma-fail.
Flags: needinfo?(gene.lian)
Disabled test_networkstats_alarms.html on B2G for too many intermittent test failures:
https://hg.mozilla.org/integration/mozilla-inbound/rev/70f19803d1ba
Keywords: leave-open
Whiteboard: [test disabled]
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #31)
> (In reply to Gene Lian [:gene] (needinfo? encouraged) from comment #2)
> > This one seems to be a new symptom other than bug 958689.
> 
> Except this one is near perma-fail.

I did land a patch at bug 958689 but it only modifies the test logic instead of the Gecko:

--- a/dom/network/tests/test_networkstats_alarms.html	
+++ a/dom/network/tests/test_networkstats_alarms.html	
@@ -166,14 +166,28 @@ function next() {
   } catch(ex) {
     ok(false, "Caught exception", ex);
   }
 }
 
 SimpleTest.waitForExplicitFinish();
 
 SpecialPowers.addPermission("networkstats-manage", true, document);
-SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]}, test);
+SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
+                          function() {
+  ok(SpecialPowers.hasPermission("networkstats-manage", document),
+     "Has permission 'networkstats-manage'.");
+
+  ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
+     "Preference 'dom.mozNetworkStats.enabled' is true.");
+
+  ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
+
+  ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
+     "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
+
+  test();
+});
 
The test failure point has already passed the checks I added and also some of other existing API tests, which means the preference/permission doesn't disable the API. Could it be related to the recent change by the WebIDL migration?
Flags: needinfo?(jshih)
Flags: needinfo?(gene.lian)
Just note that I'm investigating on this bug, will provide further information later.
Flags: needinfo?(jshih)
No problem, happy to re-enable on Aurora as well when a fix is ready :)
After having some investigation, I found the root cause is that the test case is affected by wifi test enabled on emulator. Now wifi (wlan0) can be active on emulator, such that the consumed network traffic can now be stored into DB. In the test case, we try to set an alarm for wlan0 with given threshold 1 MB, which can be easily less than the consumed stats. That's how the test failed.

My quick solution is simply making the threshold larger (1MB -> 100 MB). In general (by observing the test result), the stored stats lies around 1MB ~ 2MB, so that 100 MB could be a safe amount.
Attachment #8446922 - Flags: review?(gene.lian)
Assignee: nobody → jshih
Comment on attachment 8446922 [details] [diff] [review]
Bug 1023341: Fix test_networkstats.alarm.html. r=gene

Review of attachment 8446922 [details] [diff] [review]:
-----------------------------------------------------------------

Awesome! Thank you! r=gene
Attachment #8446922 - Flags: review?(gene.lian) → review+
Keywords: checkin-needed
Ryan,

Can we close this one? Test cases seem don't fail on this situation anymore.
Flags: needinfo?(ryanvm)
Sure.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(ryanvm)
Keywords: leave-open
Resolution: --- → FIXED
Whiteboard: [test disabled]
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.