Closed Bug 884421 Opened 7 years ago Closed 6 years ago

Automatically select port for httpd.js servers

Categories

(Cloud Services :: General, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: gps, Assigned: gps)

References

Details

Attachments

(1 file)

There are a number of tests in /services/ where we start httpd.js servers on hard-coded port numbers. httpd.js supports choosing an available port at run-time. We should make use of this.

This will pave the road for parallel execution of xpcshell tests under /services/.
Blocks: 887064
No longer blocks: 660788
Duplicate of this bug: 888116
I'm actively working on this. This will be my Sync contribution for Q2 :)
Assignee: nobody → gps
Status: NEW → ASSIGNED
I owe you a drink for making you review this. I'd understand if you want
to use the FISA court rubber stamp.
Attachment #776044 - Flags: review?(rnewman)
Comment on attachment 776044 [details] [diff] [review]
Automatic network port selection for tests in /services

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

Oof.

::: services/common/tests/unit/test_restrequest.js
@@ +708,5 @@
>    };
> +  server.start();
> +  let identity = server.identity;
> +  let uri = identity.primaryScheme + "://" + identity.primaryHost + ":" +
> +            identity.primaryPort;

Sounds like `identity` should have a .baseURI accessor, no?

::: services/common/tests/unit/test_tokenauthenticatedrequest.js
@@ +25,5 @@
>    let nonce = btoa(CryptoUtils.generateRandomBytes(16));
>    let ts = Math.floor(Date.now() / 1000);
>    let extra = {ts: ts, nonce: nonce};
>  
> +  let sig, auth;

Kill these and just `let` on lines 40 and 41.

::: services/sync/tests/unit/test_history_engine.js
@@ +30,5 @@
>      return this._get(options);
>    };
>  
> +  let server = sync_httpd_setup({
> +      "/1.1/foo/storage/history": collection.handler()

Intentional double indent?

::: services/sync/tests/unit/test_syncengine.js
@@ +204,3 @@
>  }
> +
> +add_test(() => run_next_test);

*raises eyebrows*
Attachment #776044 - Flags: review?(rnewman) → review+
(In reply to Richard Newman [:rnewman] from comment #4)
> ::: services/common/tests/unit/test_restrequest.js
> @@ +708,5 @@
> >    };
> > +  server.start();
> > +  let identity = server.identity;
> > +  let uri = identity.primaryScheme + "://" + identity.primaryHost + ":" +
> > +            identity.primaryPort;
> 
> Sounds like `identity` should have a .baseURI accessor, no?

A saw a bug opened on that somewhere. It isn't ready and I'm lazy :)

> 
> ::: services/common/tests/unit/test_tokenauthenticatedrequest.js
> @@ +25,5 @@
> >    let nonce = btoa(CryptoUtils.generateRandomBytes(16));
> >    let ts = Math.floor(Date.now() / 1000);
> >    let extra = {ts: ts, nonce: nonce};
> >  
> > +  let sig, auth;
> 
> Kill these and just `let` on lines 40 and 41.

auth is used in the closure. But I fixed sig.
This introduced a few new xpcshell failures on services-central. I'll likely fix with a bustage followup.
Looks like there is still a failure on Windows. Looking into it now...
https://hg.mozilla.org/mozilla-central/rev/45c529ffbe90
https://hg.mozilla.org/mozilla-central/rev/2264c04671c4
https://hg.mozilla.org/mozilla-central/rev/75b7cf367efb
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [fixed in services]
Target Milestone: --- → mozilla25
Depends on: 895542
https://hg.mozilla.org/integration/mozilla-inbound/rev/b817406485f8

Merged all 3 patches into 1.
Status: REOPENED → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/b817406485f8
Status: ASSIGNED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Depends on: 896093
Backout out again for excessive Windows XP failures (likely due to an underlying bug in Necko or httpd.js). See bug 896093.

https://hg.mozilla.org/integration/mozilla-inbound/rev/295fcf1d88f6
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Hopefully fixed the intermittent error, so relanded.

https://hg.mozilla.org/integration/mozilla-inbound/rev/d38372fb9dfe
Status: REOPENED → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/d38372fb9dfe
Status: ASSIGNED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Still a few 8888s. http://pastebin.mozilla.org/2869360
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Let's handle that in a followup bug, it's less confusing.
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.