Skip to content

Commit a486e0a

Browse files
authored
Merge pull request #275 from Geode-solutions/fix/cloud_id
fix(Cloud): store ID in infraStore
2 parents f25a273 + c430099 commit a486e0a

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

app/stores/infra.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { appMode, getAppMode } from "@ogw_front/utils/app_mode.js"
44
export const useInfraStore = defineStore("infra", {
55
state: () => ({
66
app_mode: getAppMode(),
7+
ID: "",
78
is_captcha_validated: false,
89
status: Status.NOT_CREATED,
910
microservices: [],
@@ -65,7 +66,7 @@ export const useInfraStore = defineStore("infra", {
6566
} else if (this.app_mode == appMode.CLOUD) {
6667
console.log("[INFRA] CLOUD mode - Launching lambda...")
6768
const lambdaStore = useLambdaStore()
68-
await lambdaStore.launch()
69+
this.ID = await lambdaStore.launch()
6970
console.log("[INFRA] Lambda launched successfully")
7071
}
7172

app/stores/lambda.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const useLambdaStore = defineStore("lambda", {
4141
if (error.value || !data.value) {
4242
this.status = Status.NOT_CONNECTED
4343
feedbackStore.server_error = true
44-
console.error("[LAMBDA] Failed to launch lambda backend")
44+
console.error("[LAMBDA] Failed to launch lambda backend", error.value)
4545
throw new Error("Failed to launch lambda backend")
4646
}
4747

tests/integration/microservices/back/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
# pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
66
#
77

8-
opengeodeweb-back==5.*,>=5.14.0

tests/integration/microservices/viewer/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
# pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
66
#
77

8-
opengeodeweb-viewer==1.*,>=1.13.1rc1

tests/unit/stores/Infra.nuxt.test.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,26 @@ describe("Infra Store", () => {
283283
await infra_store.create_backend()
284284
expect(infra_store.status).toBe(Status.CREATED)
285285
})
286-
// test("test with end-point", async () => {
287-
// const infra_store = useInfraStore()
288-
// const geodeStore = useGeodeStore()
289-
// const viewerStore = useViewerStore()
290-
// const feedback_store = useFeedbackStore()
291-
292-
// registerEndpoint(infra_store.lambda_url, {
293-
// method: "POST",
294-
// handler: () => ({ ID: "123456" }),
295-
// })
296-
// await infra_store.create_backend()
297-
// expect(infra_store.status).toBe(Status.CREATED)
298-
// expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
299-
// expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
300-
// expect(feedback_store.server_error).toBe(true)
301-
// })
286+
test("test with end-point", async () => {
287+
const infra_store = useInfraStore()
288+
const geodeStore = useGeodeStore()
289+
const viewerStore = useViewerStore()
290+
const feedback_store = useFeedbackStore()
291+
const lambdaStore = useLambdaStore()
292+
293+
infra_store.app_mode = appMode.CLOUD
294+
const ID = "123456"
295+
registerEndpoint(lambdaStore.base_url, {
296+
method: "POST",
297+
handler: () => ({ ID }),
298+
})
299+
await infra_store.create_backend()
300+
expect(infra_store.status).toBe(Status.CREATED)
301+
expect(infra_store.ID).toBe(ID)
302+
303+
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
304+
expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
305+
})
302306
})
303307
})
304308
})

0 commit comments

Comments
 (0)