test refactor: reduce timeout for starting user server, sleep less

This commit is contained in:
Erik Sundell
2023-06-07 01:35:34 +02:00
parent f127322aa3
commit cdc4a9d388
2 changed files with 10 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ async def test_admin_login():
async with User(username, hub_url, partial(login_dummy, password=password)) as u: async with User(username, hub_url, partial(login_dummy, password=password)) as u:
await u.login() await u.login()
# If user is not logged in, this will raise an exception # If user is not logged in, this will raise an exception
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
@pytest.mark.parametrize( @pytest.mark.parametrize(

View File

@@ -59,7 +59,7 @@ async def test_user_code_execute():
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
await u.start_kernel() await u.start_kernel()
await u.assert_code_output("5 * 4", "20", 5, 5) await u.assert_code_output("5 * 4", "20", 5, 5)
@@ -102,7 +102,7 @@ async def test_user_server_started_with_custom_base_url():
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# unset base_url to avoid problems with other tests # unset base_url to avoid problems with other tests
assert ( assert (
@@ -154,7 +154,7 @@ async def test_user_admin_add():
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
assert pwd.getpwnam(f"jupyter-{username}") is not None assert pwd.getpwnam(f"jupyter-{username}") is not None
@@ -200,7 +200,7 @@ async def test_user_admin_remove():
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
assert pwd.getpwnam(f"jupyter-{username}") is not None assert pwd.getpwnam(f"jupyter-{username}") is not None
@@ -224,7 +224,7 @@ async def test_user_admin_remove():
) )
await u.stop_server() await u.stop_server()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user does *not* have admin rights # Assert that the user does *not* have admin rights
assert f"jupyter-{username}" not in grp.getgrnam("jupyterhub-admins").gr_mem assert f"jupyter-{username}" not in grp.getgrnam("jupyterhub-admins").gr_mem
@@ -254,7 +254,7 @@ async def test_long_username():
try: try:
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
system_username = generate_system_username(f"jupyter-{username}") system_username = generate_system_username(f"jupyter-{username}")
@@ -307,7 +307,7 @@ async def test_user_group_adding():
try: try:
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
system_username = generate_system_username(f"jupyter-{username}") system_username = generate_system_username(f"jupyter-{username}")
@@ -379,7 +379,7 @@ async def test_idle_server_culled():
await u.login() await u.login()
# Start user's server # Start user's server
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
assert pwd.getpwnam(f"jupyter-{username}") is not None assert pwd.getpwnam(f"jupyter-{username}") is not None
@@ -498,7 +498,7 @@ async def test_active_server_not_culled():
async with User(username, hub_url, partial(login_dummy, password="")) as u: async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login() await u.login()
# Start user's server # Start user's server
await u.ensure_server_simulate() await u.ensure_server_simulate(timeout=60, spawn_refresh_time=5)
# Assert that the user exists # Assert that the user exists
assert pwd.getpwnam(f"jupyter-{username}") is not None assert pwd.getpwnam(f"jupyter-{username}") is not None