From 779154d1cb25f76ce2463f4e940cc97d0cd24402 Mon Sep 17 00:00:00 2001 From: Nivedithaa Mahendran Date: Wed, 3 Jun 2026 15:59:35 +0530 Subject: [PATCH] [patch] Gitops Workaround: initial user creation Job needs to ignore health application Issue: #MASCORE-14490 --- src/mas/devops/users.py | 4 +++- test/src/test_users.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mas/devops/users.py b/src/mas/devops/users.py index f8275da6..ede57ea8 100644 --- a/src/mas/devops/users.py +++ b/src/mas/devops/users.py @@ -188,7 +188,9 @@ def manage_internal_ca_pem_file_path(self): @property def mas_workspace_application_ids(self): if self._mas_workspace_application_ids is None: - self._mas_workspace_application_ids = list(map(lambda ma: ma["id"], self.get_mas_applications_in_workspace())) + # Filter out "health" + all_apps = self.get_mas_applications_in_workspace() + self._mas_workspace_application_ids = [app["id"] for app in all_apps if app["id"] != "health"] return self._mas_workspace_application_ids def get_user(self, user_id): diff --git a/test/src/test_users.py b/test/src/test_users.py index cf600834..f190e098 100644 --- a/test/src/test_users.py +++ b/test/src/test_users.py @@ -369,6 +369,18 @@ def test_mas_workspace_application_ids(user_utils, requests_mock): assert get.call_count == 1 +def test_mas_workspace_application_ids_filters_health(user_utils, requests_mock): + get = requests_mock.get( + f"{MAS_API_URL}/workspaces/{MAS_WORKSPACE_ID}/applications", + request_headers={"x-access-token": TOKEN}, + json=[{"id": "manage"}, {"id": "health"}, {"id": "iot"}], + status_code=200 + ) + # health should be filtered out + assert user_utils.mas_workspace_application_ids == ["manage", "iot"] + assert get.call_count == 1 + + def test_get_user_exists(user_utils, requests_mock, mock_manage_api_key): user_id = "user1" get_core, get_manage, get_manage_personid = mock_get_user_200(requests_mock, user_id, mock_manage_api_key)