From 28da71be61d2718a659d57bf8fa167e7859509ae Mon Sep 17 00:00:00 2001 From: Hamid Zare <12127420+hamidzr@users.noreply.github.com> Date: Mon, 5 Jun 2023 12:51:22 -0700 Subject: [PATCH] chore: fix a missing check for global permissions in jq (#874) we had missed a check for global permissions when determining [e2e_tests changes only] --- e2e_tests/tests/cluster/test_users.py | 7 +++++++ e2e_tests/tests/job/test_rbac.py | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/e2e_tests/tests/cluster/test_users.py b/e2e_tests/tests/cluster/test_users.py index ad34fef470b..a7428c226dc 100644 --- a/e2e_tests/tests/cluster/test_users.py +++ b/e2e_tests/tests/cluster/test_users.py @@ -60,6 +60,13 @@ def logged_in_user(credentials: authentication.Credentials) -> Generator: log_out_user() +@pytest.mark.e2e_cpu +def test_logged_in_user() -> None: + with logged_in_user(ADMIN_CREDENTIALS): + output = det_run(["user", "whoami"]) + assert f"You are logged in as user '{ADMIN_CREDENTIALS.username}'" in output + + def get_random_string() -> str: return str(uuid.uuid4()) diff --git a/e2e_tests/tests/job/test_rbac.py b/e2e_tests/tests/job/test_rbac.py index 62e2a80f499..2db316bead3 100644 --- a/e2e_tests/tests/job/test_rbac.py +++ b/e2e_tests/tests/job/test_rbac.py @@ -9,7 +9,7 @@ from tests import api_utils from tests import experiment as exp from tests.cluster.test_rbac import create_workspaces_with_users, rbac_disabled -from tests.cluster.test_users import ADMIN_CREDENTIALS, logged_in_user +from tests.cluster.test_users import ADMIN_CREDENTIALS, det_run, logged_in_user def seed_workspace(ws: bindings.v1Workspace) -> None: @@ -33,6 +33,19 @@ def seed_workspace(ws: bindings.v1Workspace) -> None: api_utils.launch_ntsc(admin_session, workspace_id=ws.id, typ=ntsc, exp_id=experiment_id) +@pytest.mark.e2e_cpu_rbac +@pytest.mark.skipif(rbac_disabled(), reason="ee rbac is required for this test") +def test_job_global_perm() -> None: + with logged_in_user(ADMIN_CREDENTIALS): + experiment_id = exp.create_experiment( + conf.fixtures_path("no_op/single.yaml"), + conf.fixtures_path("no_op"), + ["--project_id", str(1)], + ) + output = det_run(["job", "ls"]) + assert str(experiment_id) in str(output) + + @pytest.mark.e2e_cpu_rbac @pytest.mark.skipif(rbac_disabled(), reason="ee rbac is required for this test") def test_job_filtering() -> None: