Skip to content

Commit

Permalink
Update jupyterhub to 0.9.x series (#604)
Browse files Browse the repository at this point in the history
* MAINT: update jupyterhub to 0.9.0

* MAINT: add sqlalchemy version constraint to fix deprecated package bug

* TST: update expected cookie name for spawner login

* TST: remove expected log message

* Revert "TST: remove expected log message"

This reverts commit 1f5a2f0.

* TST: fix selenium tests for admin logins

* ENH: minor change to spawner options form html

* TST: fix to mocking in BaseHandler tests

* MAINT: bump jupyterhub to latest patch in 0.9.x series

* FIX: ensure spawner stop_single_user is waited for when logging admin out

* TST: potential fix to flakey selenium test

* TST: wait for modal to disappear from flakey selenium test
  • Loading branch information
flongford committed May 30, 2022
1 parent 9081860 commit ada647d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion remoteappmanager/handlers/tests/test_base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def get_app(self):
return app


@mock.patch.dict('os.environ', {"JUPYTERHUB_CLIENT_ID": 'client-id'})
@mock.patch('jupyterhub.services.auth.HubOAuth.get_user')
class TestBaseHandlerInvalidAccounting(TestBaseHandler):
def get_file_config(self):
file_config = super().get_file_config()
file_config.database_class = 'this_should_fail'
return file_config

def test_home_internal_error(self):
def test_home_internal_error(self, mock_get_user):
with ExpectLog('tornado.application', ''), \
ExpectLog('tornado.access', ''):
res = self.fetch("/user/johndoe/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get(self):
if user.admin and user.spawner is not None:
self.log.info(f"Shutting down {user.name}'s server")
try:
yield gen.maybe_future(self.stop_single_user(user))
yield self.stop_single_user(user)
except HTTPClientError:
self.log.warning("Failed to shut down server")
self.log.info("User logged out: %s", user.name)
Expand Down
2 changes: 1 addition & 1 deletion remoteappmanager/jupyterhub/spawners.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _options_form_default(self):
if self.user.admin:
return """
<div>
<label for="session">Choose RemoteAppManager Session:</label>
<legend>Choose RemoteAppManager Session:</legend>
<select id="session_form" name="session" size="2">
<option value="admin" selected>Admin</option>
<option value="user">User</option>
Expand Down
4 changes: 2 additions & 2 deletions remoteappmanager/jupyterhub/tests/test_spawners.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ def test_args(self):
self.spawner.config_file_path = path
args = self.spawner.get_args()
self.assertIn("--ip=\"127.0.0.1\"", args)
self.assertIn("--cookie-name=jupyter-hub-token", args)
self.assertIn("--cookie-name=jupyterhub-hub-login", args)
self.assertIn("--proxy-api-url=http://127.0.0.1:12345/foo/bar/", args)
self.assertIn("--config-file={}".format(path), args)
self.assertIn("--base-urlpath=\"/\"", args)

def test_args_without_config_file_path(self):
args = self.spawner.get_args()
self.assertIn("--ip=\"127.0.0.1\"", args)
self.assertIn("--cookie-name=jupyter-hub-token", args)
self.assertIn("--cookie-name=jupyterhub-hub-login", args)
self.assertIn("--proxy-api-url=http://127.0.0.1:12345/foo/bar/", args)
self.assertFalse(any("--config-file=" in arg for arg in args))
self.assertIn("--base-urlpath=\"/\"", args)
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ tornado==5.1.1
requests==2.11.1
docker==2.2
escapism==0.0.1
jupyterhub==0.8.1
jupyterhub==0.9.6
jupyter_client>=4.3.0
click==6.6
tabulate==0.7.5
tornadowebapi @ git+http://github.com/simphony/tornado-webapi.git@8b6846faae23657a04cf97ca5229ce8ea083d000#egg=tornadowebapi
oauthenticator==0.11.0
jinja2>=2.8
# Workaround for following bug in older versions of jupyterhub: https://github.com/jupyterhub/jupyterhub/pull/3383
sqlalchemy<1.4
1 change: 0 additions & 1 deletion selenium_tests/AdminDriverTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def admin_login(self):
"""
self.login("admin")

self.click_first_element_located(By.ID, "start")
self.click_first_element_located(By.CSS_SELECTOR, "input.btn")

def setUp(self):
Expand Down
3 changes: 3 additions & 0 deletions selenium_tests/UserDriverTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def wait_until_application_list_loaded(self):
""" Wait until the application list is completely loaded and displayed
"""
self.wait_until_invisibility_of_element_located(By.ID, "loading-spinner")
self.wait_until_invisibility_of_element_located(
By.CSS_SELECTOR, ".modal-fade-leave-to")

@contextlib.contextmanager
def running_container(self, index=0):
Expand All @@ -69,6 +71,7 @@ def running_container(self, index=0):
try:
yield
finally:
self.wait_until_application_list_loaded()
self.select_application(index)
self.wait_until_application_running()
self.open_application_settings()
Expand Down
2 changes: 0 additions & 2 deletions selenium_tests/test_spawner_options_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class TestSpawnerOptionsForm(RemoteAppDriverTest):
def test_admin_login_default_session(self):
self.login("admin")

self.click_first_element_located(By.ID, "start")
self.click_first_element_located(By.CSS_SELECTOR, "input.btn")

self.wait_until_text_inside_element_located(
Expand All @@ -17,7 +16,6 @@ def test_admin_login_default_session(self):
def test_admin_login_user_session(self):
self.login("admin")

self.click_first_element_located(By.ID, "start")
self.click_first_element_located(
By.CSS_SELECTOR, "#session_form > option:nth-child(2)")
self.click_first_element_located(By.CSS_SELECTOR, "input.btn")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def write_version_py():
"click>=6.6",
"tabulate>=0.7.5",
"oauthenticator>=0.5",
"sqlalchemy>=1.0",
"sqlalchemy<1.4",
# Pinning jinja2 requirements when building on RTD due to
# regression when using old versions of sphinx<2
# https://github.com/readthedocs/readthedocs.org/issues/9037
Expand Down

0 comments on commit ada647d

Please sign in to comment.