From e5d465c0dead79fbb705f2f92ca5761123fe70dd Mon Sep 17 00:00:00 2001 From: arcogabbo Date: Tue, 30 Apr 2024 10:47:39 +0200 Subject: [PATCH] [#IOPID-1738] tentative: edit pipeline for it tests --- .devops/code-review-pipelines.yml | 28 ++++++++++++++++++++++++++++ e2e/runner/index.ts | 12 ++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.devops/code-review-pipelines.yml b/.devops/code-review-pipelines.yml index 839ebbf5..0d721504 100644 --- a/.devops/code-review-pipelines.yml +++ b/.devops/code-review-pipelines.yml @@ -75,5 +75,33 @@ stages: cd e2e yarn install --frozen-lockfile yarn build + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/basic/docker-compose.yml + action: "Build services" + dockerComposeFileArgs: e2e/scenarios/basic/env.scenario + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/with-aws-s3/docker-compose.yml + action: "Build services" + dockerComposeFileArgs: e2e/scenarios/basic/env.scenario + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/with-redis-cluster/docker-compose.yml + action: "Build services" + dockerComposeFileArgs: e2e/scenarios/basic/env.scenario + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/basic/docker-compose.yml + action: "Run services" + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/with-aws-s3/docker-compose.yml + action: "Run services" + - task: DockerCompose@0 + inputs: + dockerComposeFile: e2e/scenarios/with-redis-cluster/docker-compose.yml + action: "Run services" + - script: | yarn start displayName: 'Run e2e tests' diff --git a/e2e/runner/index.ts b/e2e/runner/index.ts index 62f67d79..097dcbb7 100644 --- a/e2e/runner/index.ts +++ b/e2e/runner/index.ts @@ -32,7 +32,7 @@ const runProcess = (sh: string): ChildProcess => { const promisifyProcess = (cp: ChildProcess): Promise => new Promise(async (resolve, reject) => cp - .on("exit", (code) => { + .on("exit", code => { resolve(code === 0 ? "ok" : "ko"); }) .on("error", reject) @@ -51,9 +51,9 @@ const promisifyProcess = (cp: ChildProcess): Promise => */ const composeScenarioTest = async (name: string): Promise => { try { - await promisifyProcess(runProcess(setupCmdForScenario(name))); + // await promisifyProcess(runProcess(setupCmdForScenario(name))); - await new Promise((ok) => setTimeout(ok, 5000)); + // await new Promise((ok) => setTimeout(ok, 5000)); const result = await promisifyProcess(runProcess(testCmdForScenario(name))); @@ -77,7 +77,7 @@ const composeScenarioTest = async (name: string): Promise => { // scenario may be filtered if are provided in input const selectedScenarios = inputScenarios.length - ? scenarios.filter((e) => inputScenarios.includes(e)) + ? scenarios.filter(e => inputScenarios.includes(e)) : scenarios; // create child process for each scenario @@ -103,11 +103,11 @@ const composeScenarioTest = async (name: string): Promise => { if (computedResult === "ok") return; else throw new Error("at least one test scenario failed"); })(process.argv.slice(2)) - .then((_) => { + .then(_ => { console.log("All test scenarios succeeded"); process.exit(0); }) - .catch((e) => { + .catch(e => { console.error(e); process.exit(1); });