summarylogtreecommitdiffstats
path: root/tests_use_random_ports.patch
blob: 9c3c0aeff6f7c78271bd4df5b97d9fcf4e184146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- jupyterhub/tests/mocking.py
+++ jupyterhub/tests/mocking.py

@@ -245,6 +245,8 @@
         if 'internal_certs_location' in kwargs:
             cert_location = kwargs['internal_certs_location']
             kwargs['external_certs'] = ssl_setup(cert_location, 'hub-ca')
+        self.config.JupyterHub.hub_port = random_port()
+        self.config.ConfigurableHTTPProxy.api_url = f'http://127.0.0.1:{random_port()}'
         super().__init__(*args, **kwargs)
 
     @default('subdomain_host')

--- jupyterhub/tests/test_proxy.py
+++ jupyterhub/tests/test_proxy.py

@@ -12,4 +12,5 @@
 from ..utils import url_path_join as ujoin
 from ..utils import wait_for_http_server
+from ..utils import random_port
 from .mocking import MockHub
 from .test_api import add_user
@@ -32,9 +33,10 @@
     auth_token = 'secret!'
     proxy_ip = '127.0.0.1'
-    proxy_port = 54321
+    proxy_port = random_port()
     cfg = Config()
     cfg.ConfigurableHTTPProxy.auth_token = auth_token
     cfg.ConfigurableHTTPProxy.api_url = 'http://%s:%i' % (proxy_ip, proxy_port)
     cfg.ConfigurableHTTPProxy.should_start = False
+    cfg.JupyterHub.hub_port = random_port()
 
     app = MockHub.instance(config=cfg)