Closed Bug 996325 Opened 10 years ago Closed 10 years ago

Tests shouldn't require port 8080

Categories

(Firefox OS Graveyard :: Certification Suite, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jgriffin, Unassigned)

References

Details

Per malini:

It turns out that certsuite/cert.py has a hardcoded port it runs on (8080). If that port is used, then we can't assign it to something else.

I ran into this issue when running ./run.sh. It may be the case that the user will have 8080 already being used (as was the case with me, since Jenkins runs on this port by default). We should make this configurable, or scan for an open port and use it, so it'll be fool-proof.
If we opt for a different default (rather than trying to find an open port), I think we should use something different than 8080, which is the default port for Jenkins and a few other things.
Allowing it to be defined through a flag, but to use a free port by default would perhaps offer the best fault-proof solution.
This is trivial to do, you just pass 0 as the port number and the system will give you a free port. We implemented this in mozhttpd and added a get_url method for convenience:
http://hg.mozilla.org/mozilla-central/annotate/5b6e82e7bbbf/testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py#l281
web-platform-tests also has requirements here.

By default it uses port 8000 and a couple of randomly-chosen ports. This could be changed or made configurable, but there is a fairly big downside to using a random port for something that a human will have to interact with (more applicable to cert.py than web-platform-tests in this case); it makes entering urls much harder and breaks browser history. I suggest we pick one port that we say has to be free and check that it is on startup.
Is there a reason we can't just auto-load the URL in the browser from cert.py? We have Marionette installed, right?
Just for clarity certsuite/cer.app doesn't use mozhttpd, but wptserve.

The point about choosing a predefined port because this is something the user has to enter manually makes sense though.  Let's just pick a less obviously occupied port than 8080 and friends.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #5)
> Is there a reason we can't just auto-load the URL in the browser from
> cert.py? We have Marionette installed, right?

I think the point is that Marionette isn't installed at this point and that cert.py at least used to install the extension for us.  Or is that delegated to the meta harness now?

Regardless, at some point we need the user to manually enter something so that she can navigate to a server and install the Marionette extension.
The metaharness installs Marionette before running any subharnesses: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/certsuite/harness.py#L167
I believe we discussed this in IRC and agreed that standardizing on port 8000 was the best approach given firewalls running on people's laptops, etc.

I had something working for cert.py that just picked an open port, but we changed this back to using 8000 during review.

Any objections to closing this?
Flags: needinfo?(jgriffin)
Flags: needinfo?(james)
Sounds good to me.
Flags: needinfo?(jgriffin)
Yes, I am just finishing up a patch to check that ports 8000 and 8001 are open as part of the initial setup. The documentation also mentions 8888, but I don't know if anything depends on that anymore.
Flags: needinfo?(james)
Thanks!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
We no longer rely on port 8888 being available.  I patched docs/requirements.rst to not list it: https://github.com/mozilla-b2g/fxos-certsuite/commit/383b7f1a8a42541853dffc7b0dfd894e123e9806
You need to log in before you can comment on or make changes to this bug.