diff --git a/app/stores/infra.js b/app/stores/infra.js index ebf5c69c..413afd4c 100644 --- a/app/stores/infra.js +++ b/app/stores/infra.js @@ -4,6 +4,7 @@ import { appMode, getAppMode } from "@ogw_front/utils/app_mode.js" export const useInfraStore = defineStore("infra", { state: () => ({ app_mode: getAppMode(), + ID: "", is_captcha_validated: false, status: Status.NOT_CREATED, microservices: [], @@ -65,7 +66,7 @@ export const useInfraStore = defineStore("infra", { } else if (this.app_mode == appMode.CLOUD) { console.log("[INFRA] CLOUD mode - Launching lambda...") const lambdaStore = useLambdaStore() - await lambdaStore.launch() + this.ID = await lambdaStore.launch() console.log("[INFRA] Lambda launched successfully") } diff --git a/app/stores/lambda.js b/app/stores/lambda.js index 68b3d9a4..2e74fddf 100644 --- a/app/stores/lambda.js +++ b/app/stores/lambda.js @@ -41,7 +41,7 @@ export const useLambdaStore = defineStore("lambda", { if (error.value || !data.value) { this.status = Status.NOT_CONNECTED feedbackStore.server_error = true - console.error("[LAMBDA] Failed to launch lambda backend") + console.error("[LAMBDA] Failed to launch lambda backend", error.value) throw new Error("Failed to launch lambda backend") } diff --git a/tests/integration/microservices/back/requirements.txt b/tests/integration/microservices/back/requirements.txt index 0c3a99e8..bd3a3ef5 100644 --- a/tests/integration/microservices/back/requirements.txt +++ b/tests/integration/microservices/back/requirements.txt @@ -5,4 +5,3 @@ # pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in # -opengeodeweb-back==5.*,>=5.14.0 diff --git a/tests/integration/microservices/viewer/requirements.txt b/tests/integration/microservices/viewer/requirements.txt index 0196a06e..4d097394 100644 --- a/tests/integration/microservices/viewer/requirements.txt +++ b/tests/integration/microservices/viewer/requirements.txt @@ -5,4 +5,3 @@ # pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in # -opengeodeweb-viewer==1.*,>=1.13.1rc1 diff --git a/tests/unit/stores/Infra.nuxt.test.js b/tests/unit/stores/Infra.nuxt.test.js index 2473020c..519b37de 100644 --- a/tests/unit/stores/Infra.nuxt.test.js +++ b/tests/unit/stores/Infra.nuxt.test.js @@ -283,22 +283,26 @@ describe("Infra Store", () => { await infra_store.create_backend() expect(infra_store.status).toBe(Status.CREATED) }) - // test("test with end-point", async () => { - // const infra_store = useInfraStore() - // const geodeStore = useGeodeStore() - // const viewerStore = useViewerStore() - // const feedback_store = useFeedbackStore() - - // registerEndpoint(infra_store.lambda_url, { - // method: "POST", - // handler: () => ({ ID: "123456" }), - // }) - // await infra_store.create_backend() - // expect(infra_store.status).toBe(Status.CREATED) - // expect(geodeStore.status).toBe(Status.NOT_CONNECTED) - // expect(viewerStore.status).toBe(Status.NOT_CONNECTED) - // expect(feedback_store.server_error).toBe(true) - // }) + test("test with end-point", async () => { + const infra_store = useInfraStore() + const geodeStore = useGeodeStore() + const viewerStore = useViewerStore() + const feedback_store = useFeedbackStore() + const lambdaStore = useLambdaStore() + + infra_store.app_mode = appMode.CLOUD + const ID = "123456" + registerEndpoint(lambdaStore.base_url, { + method: "POST", + handler: () => ({ ID }), + }) + await infra_store.create_backend() + expect(infra_store.status).toBe(Status.CREATED) + expect(infra_store.ID).toBe(ID) + + expect(geodeStore.status).toBe(Status.NOT_CONNECTED) + expect(viewerStore.status).toBe(Status.NOT_CONNECTED) + }) }) }) })