Skip to content

Commit 779154d

Browse files
author
Nivedithaa Mahendran
committed
[patch] Gitops Workaround: initial user creation Job needs to ignore health application
Issue: #MASCORE-14490
1 parent e58c89b commit 779154d

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/mas/devops/users.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def manage_internal_ca_pem_file_path(self):
188188
@property
189189
def mas_workspace_application_ids(self):
190190
if self._mas_workspace_application_ids is None:
191-
self._mas_workspace_application_ids = list(map(lambda ma: ma["id"], self.get_mas_applications_in_workspace()))
191+
# Filter out "health"
192+
all_apps = self.get_mas_applications_in_workspace()
193+
self._mas_workspace_application_ids = [app["id"] for app in all_apps if app["id"] != "health"]
192194
return self._mas_workspace_application_ids
193195

194196
def get_user(self, user_id):

test/src/test_users.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ def test_mas_workspace_application_ids(user_utils, requests_mock):
369369
assert get.call_count == 1
370370

371371

372+
def test_mas_workspace_application_ids_filters_health(user_utils, requests_mock):
373+
get = requests_mock.get(
374+
f"{MAS_API_URL}/workspaces/{MAS_WORKSPACE_ID}/applications",
375+
request_headers={"x-access-token": TOKEN},
376+
json=[{"id": "manage"}, {"id": "health"}, {"id": "iot"}],
377+
status_code=200
378+
)
379+
# health should be filtered out
380+
assert user_utils.mas_workspace_application_ids == ["manage", "iot"]
381+
assert get.call_count == 1
382+
383+
372384
def test_get_user_exists(user_utils, requests_mock, mock_manage_api_key):
373385
user_id = "user1"
374386
get_core, get_manage, get_manage_personid = mock_get_user_200(requests_mock, user_id, mock_manage_api_key)

0 commit comments

Comments
 (0)