testing: configure Pulse in local MozReview environments
authorGregory Szorc <gps@mozilla.com>
Wed, 21 Jan 2015 11:24:06 -0500
changeset 360216 47ba7a351ab726f4a0138f28bebfd6cf25a24cad
parent 360215 4530df2b8727c9155cb7cd00a837dd0a854d2bc8
child 360217 e098a6e0fd0b2c7bc029a912106a9b7d3445124b
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
testing: configure Pulse in local MozReview environments Before, Pulse was running but not configured. We manually had Pulse configured as part of the Review Board tests. Now, we configure Pulse as part of local MozReview environments.
testing/vcttesting/docker.py
testing/vcttesting/mozreview.py
testing/vcttesting/mozreview_mach_commands.py
--- a/testing/vcttesting/docker.py
+++ b/testing/vcttesting/docker.py
@@ -411,17 +411,24 @@ class Docker(object):
         #rb_url = 'http://%s:%s/' % (hostname, wait_rbweb_port)
 
         print('waiting for Bugzilla to start')
         wait_for_http(self.docker_hostname, wait_bmoweb_port)
         #wait_for_http(self.docker_hostname, wait_rbweb_port)
         # TODO wait on Rabbit TCP port.
         print('Bugzilla accessible on %s' % url)
         #print('Review Board accessible at %s' % rb_url)
-        return url, db_id, web_id
+
+        return {
+            'bugzilla_url': url,
+            'db_id': db_id,
+            'web_id': web_id,
+            'pulse_host': self.docker_hostname,
+            'pulse_port': pulse_port,
+        }
 
     def stop_bmo(self, cluster):
         count = 0
         for container in reversed(self.state['containers'].get(cluster, [])):
             count += 1
             self.client.stop(container, timeout=10)
             self.client.remove_container(container)
 
--- a/testing/vcttesting/mozreview.py
+++ b/testing/vcttesting/mozreview.py
@@ -76,44 +76,52 @@ class MozReview(object):
 
     def get_bugzilla(self, username=None, password=None):
         username = username or self.bugzilla_username or 'admin@example.com'
         password = password or self.bugzilla_password or 'password'
 
         return Bugzilla(self.bugzilla_url, username=username, password=password)
 
     def start(self, bugzilla_port=None, reviewboard_port=None,
-            mercurial_port=None, verbose=False, db_image=None, web_image=None):
+            mercurial_port=None, pulse_port=None, verbose=False,
+            db_image=None, web_image=None, pulse_image=None):
         """Start a MozReview instance."""
         if not bugzilla_port:
             bugzilla_port = get_available_port()
         if not reviewboard_port:
             reviewboard_port = get_available_port()
         if not mercurial_port:
             mercurial_port = get_available_port()
+        if not pulse_port:
+            pulse_port = get_available_port()
 
-        bugzilla_url = self._docker.start_mozreview(cluster=self._name,
-                hostname=None, http_port=bugzilla_port,
+        mr_info = self._docker.start_mozreview(cluster=self._name,
+                hostname=None, http_port=bugzilla_port, pulse_port=pulse_port,
                 db_image=db_image, web_image=web_image,
-                verbose=verbose)[0]
+                pulse_image=pulse_image, verbose=verbose)
+
+        bugzilla_url = mr_info['bugzilla_url']
 
         self.bugzilla_url = bugzilla_url
         bugzilla = self.get_bugzilla()
 
-        rb = MozReviewBoard(self._path, bugzilla_url=bugzilla_url)
+        rb = MozReviewBoard(self._path, bugzilla_url=bugzilla_url,
+            pulse_host=mr_info['pulse_host'], pulse_port=mr_info['pulse_port'])
         rb.create()
         reviewboard_pid = rb.start(reviewboard_port)
 
         reviewboard_url = 'http://localhost:%s/' % reviewboard_port
 
         self.bugzilla_url = bugzilla_url
         self.reviewboard_url = reviewboard_url
         self.reviewboard_pid = reviewboard_pid
         self.admin_username = bugzilla.username
         self.admin_password = bugzilla.password
+        self.pulse_host = mr_info['pulse_host']
+        self.pulse_port = mr_info['pulse_port']
 
         mercurial_pid = self._start_mercurial_server(mercurial_port)
 
         self.mercurial_url = 'http://localhost:%s/' % mercurial_port
         with open(self._hg_url_path, 'w') as fh:
             fh.write(self.mercurial_url)
 
         self.mercurial_pid = mercurial_pid
@@ -121,16 +129,18 @@ class MozReview(object):
         state = {
             'bugzilla_url': bugzilla_url,
             'reviewboard_url': reviewboard_url,
             'reviewboard_pid': reviewboard_pid,
             'mercurial_url': self.mercurial_url,
             'mercurial_pid': mercurial_pid,
             'admin_username': bugzilla.username,
             'admin_password': bugzilla.password,
+            'pulse_host': mr_info['pulse_host'],
+            'pulse_port': mr_info['pulse_port'],
         }
 
         with open(self._state_path, 'wb') as fh:
             json.dump(state, fh, indent=2, sort_keys=True)
 
     def stop(self):
         """Stop all services associated with this MozReview instance."""
         if os.path.exists(self._hg_pid_path):
--- a/testing/vcttesting/mozreview_mach_commands.py
+++ b/testing/vcttesting/mozreview_mach_commands.py
@@ -25,27 +25,31 @@ class MozReviewCommands(object):
     @CommandArgument('where', nargs='?',
         help='Directory of MozReview instance')
     @CommandArgument('--bugzilla-port', type=int,
         help='Port Bugzilla HTTP server should listen on.')
     @CommandArgument('--reviewboard-port', type=int,
         help='Port Review Board HTTP server should listen on.')
     @CommandArgument('--mercurial-port', type=int,
         help='Port Mercurial HTTP server should listen on.')
-    def start(self, where, bugzilla_port, reviewboard_port,
-            mercurial_port):
+    @CommandArgument('--pulse-port', type=int,
+        help='Port Pulse should listen on.')
+    def start(self, where, bugzilla_port=None, reviewboard_port=None,
+            mercurial_port=None, pulse_port=None):
         mr = self._get_mozreview(where)
         mr.start(bugzilla_port=bugzilla_port,
                 reviewboard_port=reviewboard_port,
                 mercurial_port=mercurial_port,
+                pulse_port=pulse_port,
                 verbose=True)
 
         print('Bugzilla URL: %s' % mr.bugzilla_url)
         print('Review Board URL: %s' % mr.reviewboard_url)
         print('Mercurial URL: %s' % mr.mercurial_url)
+        print('Pulse endpoint: %s:%s' % (mr.pulse_host, mr.pulse_port))
         print('Admin username: %s' % mr.admin_username)
         print('Admin password: %s' % mr.admin_password)
         print('Run the following to use this instance with all future commands:')
         print('  export MOZREVIEW_HOME=%s' % mr._path)
 
     @Command('stop', category='mozreview',
         description='Stop a MozReview instance')
     @CommandArgument('where', nargs='?',