Closed Bug 889034 Opened 11 years ago Closed 11 years ago

use a dynamic port in places/ xpcshell tests so they can be run in parallel

Categories

(Toolkit :: Places, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: mihneadb, Assigned: mihneadb)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Attached patch use -1 as httpd port (obsolete) — Splinter Review
Assignee: nobody → mihneadb
Blocks: 887064
Attachment #769796 - Flags: review?(mak77)
Comment on attachment 769796 [details] [diff] [review]
use -1 as httpd port

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

::: toolkit/components/places/tests/network/test_history_redirects.js
@@ +28,5 @@
> +});
> +
> +XPCOMUtils.defineLazyGetter(this, "FOUND_URL", function() {
> +  return "http://localhost:" + PORT + FOUND_PATH;
> +});

these don't need to be lazy getters, why not just define const?

const PORT = HTTPSVR.identity.primaryPort;
const PERMA_REDIR_URL = "http://localhost:" + PORT + PERMA_REDIR_PATH;

and so on...

@@ +77,5 @@
>  
>    var chan = NetUtil.ioService
> +                    .newChannelFromURI(uri("http://localhost:" +
> +                                           HTTPSVR.identity.primaryPort +
> +                                           "/permaredir"));

this is just .newChannelFromURI(uri(PERMA_REDIR_URL));
Attachment #769796 - Flags: review?(mak77) → review+
(In reply to Marco Bonardo [:mak] from comment #2)
> Comment on attachment 769796 [details] [diff] [review]
> use -1 as httpd port
> 
> Review of attachment 769796 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: toolkit/components/places/tests/network/test_history_redirects.js
> @@ +28,5 @@
> > +});
> > +
> > +XPCOMUtils.defineLazyGetter(this, "FOUND_URL", function() {
> > +  return "http://localhost:" + PORT + FOUND_PATH;
> > +});
> 
> these don't need to be lazy getters, why not just define const?
> 
> const PORT = HTTPSVR.identity.primaryPort;
> const PERMA_REDIR_URL = "http://localhost:" + PORT + PERMA_REDIR_PATH;
> 
> and so on...

They have to be lazy getters because the server is not started at that time. If you want I could take out the start call from the run_test function and put it at the top of the file and then I can do what you suggested. Is that ok?

> 
> @@ +77,5 @@
> >  
> >    var chan = NetUtil.ioService
> > +                    .newChannelFromURI(uri("http://localhost:" +
> > +                                           HTTPSVR.identity.primaryPort +
> > +                                           "/permaredir"));
> 
> this is just .newChannelFromURI(uri(PERMA_REDIR_URL));

Right, thanks!
(In reply to Mihnea Dobrescu-Balaur (:mihneadb) from comment #3)
> (In reply to Marco Bonardo [:mak] from comment #2)
> > Comment on attachment 769796 [details] [diff] [review]
> > use -1 as httpd port
> > 
> > Review of attachment 769796 [details] [diff] [review]:
> > -----------------------------------------------------------------
> > 
> > ::: toolkit/components/places/tests/network/test_history_redirects.js
> > @@ +28,5 @@
> > > +});
> > > +
> > > +XPCOMUtils.defineLazyGetter(this, "FOUND_URL", function() {
> > > +  return "http://localhost:" + PORT + FOUND_PATH;
> > > +});
> > 
> > these don't need to be lazy getters, why not just define const?
> > 
> > const PORT = HTTPSVR.identity.primaryPort;
> > const PERMA_REDIR_URL = "http://localhost:" + PORT + PERMA_REDIR_PATH;
> > 
> > and so on...
> 
> They have to be lazy getters because the server is not started at that time.
> If you want I could take out the start call from the run_test function and
> put it at the top of the file and then I can do what you suggested. Is that
> ok?

well, we start the server immediately regardless, so I think it's ok if you do that.
Comment on attachment 773702 [details] [diff] [review]
use a dynamic port

keeping prev r+
Attachment #773702 - Flags: review+
Attachment #769796 - Attachment is obsolete: true
here's the try run https://tbpl.mozilla.org/?tree=Try&rev=93ea699403ed
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/d19b8311599b
Flags: in-testsuite-
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d19b8311599b
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: