Open Bug 1566168 Opened 5 years ago Updated 2 years ago

Support WebSocket tests on Android

Categories

(Core :: Networking: WebSockets, task, P2)

task

Tracking

()

People

(Reporter: agi, Unassigned, NeedInfo)

References

Details

(Whiteboard: [necko-triaged])

Right now WS tests don't run on android. We should add support and re-enable them.

Agi, what is missing on the Android side so we can have support for websockets? Put differently, any chance I could assign this one to you as well?

Flags: needinfo?(agi)
See Also: → 1561964
Component: DOM: Security → Networking: WebSockets

I don't understand what's needed to be done here. What is wrong with the patch at https://phabricator.services.mozilla.com/D37488 ?

Unfortunately I'm not sure what exactly needs to be done. What I could see when I was working on Bug 1561964 is that the websocket server wasn't running at all for android tests, but I'm not too familiar with the infrastructure. Maybe someone from networking can look at this?

Flags: needinfo?(agi)

Andrew, could this be something in testing/mochitest/runtests.py? But, I don't see any platform conditionality around starting pywebsocket server.

Flags: needinfo?(ahal)

I'd guess the server is running on the host, but the tests are running on a device so can't find it. Looks like it's hardcoded to localhost:
https://searchfox.org/mozilla-central/source/testing/mochitest/runtests.py#586

I'm super unfamiliar with Android, but if there's a way to access the host's IP, you probably just need to add an option to specify it on the command line and pass it in via task configuration (or the mach command locally).

Flags: needinfo?(ahal)

Sounds reasonable. Geoff, are you someone who could weigh on on if this sounds like a good approach?

Flags: needinfo?(gbrown)

From an android mochitest test log, you can see that it looks like the websocket server is being started and stopped at appropriate times...

[task 2019-09-30T16:52:20.591Z] 16:52:20     INFO -  runtests.py | Server pid: 1806
[task 2019-09-30T16:52:20.593Z] 16:52:20     INFO -  runtests.py | Websocket server pid: 1809
[task 2019-09-30T16:52:20.596Z] 16:52:20     INFO -  runtests.py | SSL tunnel pid: 1812
...
[task 2019-09-30T16:53:39.617Z] 16:53:39     INFO -  Stopping web server
[task 2019-09-30T16:53:39.620Z] 16:53:39     INFO -  Stopping web socket server
[task 2019-09-30T16:53:39.640Z] 16:53:39     INFO -  Stopping ssltunnel

All 3 servers are run on the host. For the web server, there is an option to set the address, --remote-webserver. In continuous integration, we set --remote-webserver=10.0.2.2 for emulator tasks and --remote-webserver=<ip addr of host> for device tests on bitbar.

There is also a handy default that I would expect to work fine:

https://searchfox.org/mozilla-central/rev/23f836a71cfe961373c8bd0d0219ec60a64b3c8f/testing/mochitest/mochitest_options.py#944-946

I think assuming the web socket server is on the --remote-webserver IP (self.remoteWebServer or self.webServer in runtests.py) is the way to go.

I always thought the proxy took care of this:

https://searchfox.org/mozilla-central/rev/23f836a71cfe961373c8bd0d0219ec60a64b3c8f/testing/mochitest/runtests.py#1854-1866

but never understood the confusion between the ssl and ws ports.

Flags: needinfo?(gbrown)

Thanks Geoff!

Priority: -- → P2
Whiteboard: [necko-triaged]

I'll try to take a look.

Flags: needinfo?(valentin.gosu)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.