From a269fe98e72e87278b32756291e83b6e66b22b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Thu, 8 Aug 2024 14:06:46 +0200 Subject: [PATCH] adjust deployment, fix api tests --- ansible/group_vars/develop/shd-client.yml | 1 - .../shd-client-core/defaults/main.yml} | 1 - .../roles/shd-client-core/templates/configmap.yml.j2 | 2 -- .../roles/shd-client-core/templates/deployment.yml.j2 | 4 ++-- ansible/roles/shd-client-core/templates/ingress.yml.j2 | 2 +- ansible/roles/shd-client-core/templates/svc.yml.j2 | 2 +- src/modules/data/auth/auth.store.unit.ts | 8 ++++---- src/modules/data/env-config/envConfig.store.unit.ts | 10 ++++++---- 8 files changed, 14 insertions(+), 16 deletions(-) rename ansible/{group_vars/all/shd-client.yml => roles/shd-client-core/defaults/main.yml} (89%) diff --git a/ansible/group_vars/develop/shd-client.yml b/ansible/group_vars/develop/shd-client.yml index a3f9a28..434fda7 100644 --- a/ansible/group_vars/develop/shd-client.yml +++ b/ansible/group_vars/develop/shd-client.yml @@ -1,4 +1,3 @@ --- -PORT: 4100 SHD_CLIENT_IMAGE: ghcr.io/hpi-schul-cloud/shd-client SHD_CLIENT_PREFIX: shd2- \ No newline at end of file diff --git a/ansible/group_vars/all/shd-client.yml b/ansible/roles/shd-client-core/defaults/main.yml similarity index 89% rename from ansible/group_vars/all/shd-client.yml rename to ansible/roles/shd-client-core/defaults/main.yml index 9dd752b..98b2ed5 100644 --- a/ansible/group_vars/all/shd-client.yml +++ b/ansible/roles/shd-client-core/defaults/main.yml @@ -1,4 +1,3 @@ --- -PORT: 4100 SHD_CLIENT_IMAGE: quay.io/schulcloudverbund/shd-client SHD_CLIENT_PREFIX: dashboard2. diff --git a/ansible/roles/shd-client-core/templates/configmap.yml.j2 b/ansible/roles/shd-client-core/templates/configmap.yml.j2 index 8a8dba4..e1950fd 100644 --- a/ansible/roles/shd-client-core/templates/configmap.yml.j2 +++ b/ansible/roles/shd-client-core/templates/configmap.yml.j2 @@ -7,7 +7,5 @@ metadata: labels: app: shd-client data: - # general - NODE_ENV: "production" TZ: "Europe/Berlin" API_URL: "https://{{ DOMAIN }}/api" diff --git a/ansible/roles/shd-client-core/templates/deployment.yml.j2 b/ansible/roles/shd-client-core/templates/deployment.yml.j2 index 735d36b..a820ded 100644 --- a/ansible/roles/shd-client-core/templates/deployment.yml.j2 +++ b/ansible/roles/shd-client-core/templates/deployment.yml.j2 @@ -82,10 +82,10 @@ spec: resources: limits: cpu: {{ SHD_CLIENT_CPU_LIMITS|default("1000m", true) }} - memory: {{ SHD_CLIENT_MEMORY_LIMITS|default("256Mi", true) }} + memory: {{ SHD_CLIENT_MEMORY_LIMITS|default("2Gi", true) }} requests: cpu: {{ SHD_CLIENT_CPU_REQUESTS|default("100m", true) }} - memory: {{ SHD_CLIENT_MEMORY_REQUESTS|default("32Mi", true) }} + memory: {{ SHD_CLIENT_MEMORY_REQUESTS|default("128Mi", true) }} {% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %} affinity: podAffinity: diff --git a/ansible/roles/shd-client-core/templates/ingress.yml.j2 b/ansible/roles/shd-client-core/templates/ingress.yml.j2 index 4af2346..d27dab5 100644 --- a/ansible/roles/shd-client-core/templates/ingress.yml.j2 +++ b/ansible/roles/shd-client-core/templates/ingress.yml.j2 @@ -37,4 +37,4 @@ spec: service: name: shd-client-svc port: - number: {{ PORT }} + number: 4100 diff --git a/ansible/roles/shd-client-core/templates/svc.yml.j2 b/ansible/roles/shd-client-core/templates/svc.yml.j2 index 6ab25a6..59c3f5e 100644 --- a/ansible/roles/shd-client-core/templates/svc.yml.j2 +++ b/ansible/roles/shd-client-core/templates/svc.yml.j2 @@ -8,7 +8,7 @@ metadata: spec: type: ClusterIP ports: - - port: {{ PORT }} + - port: 4100 targetPort: 4100 protocol: TCP name: shd-client diff --git a/src/modules/data/auth/auth.store.unit.ts b/src/modules/data/auth/auth.store.unit.ts index 1fa7bc5..089ba2e 100644 --- a/src/modules/data/auth/auth.store.unit.ts +++ b/src/modules/data/auth/auth.store.unit.ts @@ -1,4 +1,4 @@ -import * as serverApi from "@/serverApi/v3/api"; +import * as serverMeApi from "@/serverApi/v3/api/me-api"; import { meResponseFactory } from "@@/tests/test-utils/factory"; import { mockApiResponse } from "@@/tests/test-utils/mockApiResponse"; import { createMock, DeepMocked } from "@golevelup/ts-jest"; @@ -6,14 +6,14 @@ import { createPinia, setActivePinia } from "pinia"; import { useAuthStore } from "./auth.store"; describe("AuthStore", () => { - let meApi: DeepMocked; + let meApi: DeepMocked; beforeEach(() => { setActivePinia(createPinia()); - meApi = createMock(); + meApi = createMock(); - jest.spyOn(serverApi, "MeApiFactory").mockReturnValue(meApi); + jest.spyOn(serverMeApi, "MeApiFactory").mockReturnValue(meApi); }); afterEach(() => { diff --git a/src/modules/data/env-config/envConfig.store.unit.ts b/src/modules/data/env-config/envConfig.store.unit.ts index 00cc9e6..a0a5ce2 100644 --- a/src/modules/data/env-config/envConfig.store.unit.ts +++ b/src/modules/data/env-config/envConfig.store.unit.ts @@ -1,4 +1,4 @@ -import * as serverApi from "@/serverApi/v3/api"; +import * as serverDefaultApi from "@/serverApi/v3/api/default-api"; import { envsFactory } from "@@/tests/test-utils/factory"; import { mockApiResponse } from "@@/tests/test-utils/mockApiResponse"; import { createMock, DeepMocked } from "@golevelup/ts-jest"; @@ -6,14 +6,16 @@ import { createPinia, setActivePinia } from "pinia"; import { useEnvConfigStore } from "./envConfig.store"; describe("EnvConfigStore", () => { - let defaultApi: DeepMocked; + let defaultApi: DeepMocked; beforeEach(() => { setActivePinia(createPinia()); - defaultApi = createMock(); + defaultApi = createMock(); - jest.spyOn(serverApi, "DefaultApiFactory").mockReturnValue(defaultApi); + jest + .spyOn(serverDefaultApi, "DefaultApiFactory") + .mockReturnValue(defaultApi); }); afterEach(() => {