If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Run the node mock push server in mochitests when running the Mochitest push suite on Android

NEW
Unassigned

Status

()

Firefox for Android
Testing
2 years ago
2 years ago

People

(Reporter: nalexander, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
Bug 1214362 tracks running the M(p) Mochitest Push suite on Android.  Desktop is moving away from the live push service in tests (\o/) and implementing a mock server in Bug 1244816.  We'd like to run this mock push server for Android tests too, which requires running a node service.
(Reporter)

Comment 1

2 years ago
gbrown: there are some patches doing some of this for Desktop in Bug 1244816.  Can you suggest an implementation plan that would get Node.js services running for Android tests?
Flags: needinfo?(gbrown)
At a glance, it looks like those patches might almost work for Android. The server start/stop code in runtests.py should work fine during Android mochitests. The only thing that troubles me is the references to "localhost"; on Android, those will be running on the device, while the server will be running on the test host. We normally handle this issue by referencing the "mochi.test" proxy instead of localhost; would that work?

I'll try to look at this in more detail soon.
Hmm, my impression is "https://mochi.test" uses ssltunnel to proxy requests to the mochitest server. For these tests, we just want it to forward to the Node H2 server running on a different port, without terminating SSL.

It seems like the `forward` option in ssltunnel should be able to do a direct forward (https://dxr.mozilla.org/mozilla-central/rev/584870f1cbc5d060a57e147ce249f736956e2b62/testing/mochitest/ssltunnel/ssltunnel.cpp#1471-1472), but only if `httpproxy` is unset. It's set for the mochitest server (https://dxr.mozilla.org/mozilla-central/rev/584870f1cbc5d060a57e147ce249f736956e2b62/testing/mochitest/runtests.py#1323-1329), so do we need to run another ssltunnel for H2?

If this becomes too complicated, we can use other tricks to avoid running a server entirely. We'll need to modify the push module to make it work, but there are alternatives. Regardless, thanks for your time, :gbrown!
Is ssltunnel involved? I am thinking of https://dxr.mozilla.org/mozilla-central/rev/584870f1cbc5d060a57e147ce249f736956e2b62/testing/mochitest/runtests.py#1672, which, I think, ends up setting network.proxy.autoconfig_url (but I'm hazy on how autoconfig_url is interpretted / how the proxy is implemented).
If we're setting a pref for the push server, presumably we can just set the pref to include the IP of the host machine running the servers (which is what options.webServer is in gbrown's link above). We don't have to go through ssltunnel, we can just have the browser point directly to the push server in this case, I would think. (I'm pretty sure this is exactly what gbrown is trying to say.)

The proxy autoconfig stuff is complicated because we want urls like "https://mochi.test/" to just work from the browser's perspective, but for things where we can override the URL with a pref we can just use the IP we have for the host.
Oh, I see. Very cool! :-) I was trying to use "https://mochi.test:{nodeServerPort}", which is why I thought ssltunnel had to be involved. But you're totally right; all we need is just the host IP and Node server port.
Apologies for the long delay here. 

I recently tried running the dom/push mochitests on Android, with patches from bug 1244816. With MOZ_NODE_PATH set appropriately, I see the new servers start when I run ./mach mochitest dom/push, but I hit these issues:
 - Push.js, Push.manifest, PushComponents.js missing from mobile/android/installer/package-manifest.in
 - buildBrowserEnv in runtestsremote.py needs to have the "env" parameter added

But with those issues addressed, tests still hang. Logcat shows:

[JavaScript Error: "NS_ERROR_XPC_BAD_IID: Component returned failure code: 0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.getService]" {file: "resource://gre/modules/XPCOMUtils.jsm" line: 230}]
Flags: needinfo?(gbrown)
(Reporter)

Comment 8

2 years ago
(In reply to Geoff Brown [:gbrown] from comment #7)
> Apologies for the long delay here. 
> 
> I recently tried running the dom/push mochitests on Android, with patches
> from bug 1244816. With MOZ_NODE_PATH set appropriately, I see the new
> servers start when I run ./mach mochitest dom/push, but I hit these issues:
>  - Push.js, Push.manifest, PushComponents.js missing from
> mobile/android/installer/package-manifest.in
>  - buildBrowserEnv in runtestsremote.py needs to have the "env" parameter
> added
> 
> But with those issues addressed, tests still hang. Logcat shows:
> 
> [JavaScript Error: "NS_ERROR_XPC_BAD_IID: Component returned failure code:
> 0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.getService]" {file:
> "resource://gre/modules/XPCOMUtils.jsm" line: 230}]

I think much of this was addressed in my earlier patches.

It's my understanding that kit and ckarlof have elected to pursue something simpler than a full Node.js Push service for all of these tests, so this is not high priority.  It's an open issue, though.
You need to log in before you can comment on or make changes to this bug.