From 96b1a913d8bb86ce46ce1d8f7245a7972217626d Mon Sep 17 00:00:00 2001 From: Yann Bertrand <5855339+yannbertrand@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:43:38 +0100 Subject: [PATCH] fix: do not wait for RA creation to comment URLs --- build/controllers/github.js | 2 +- test/acceptance/build/github_test.js | 2 +- test/unit/build/controllers/github_test.js | 18 ------------------ 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/build/controllers/github.js b/build/controllers/github.js index f559e434..bebf0832 100644 --- a/build/controllers/github.js +++ b/build/controllers/github.js @@ -165,6 +165,7 @@ async function deployPullRequest( const reviewAppName = `${appName}-pr${prId}`; try { const reviewAppExists = await client.reviewAppExists(reviewAppName); + deployedRA.push({ name: appName, isCreated: !reviewAppExists }); if (reviewAppExists) { await client.deployUsingSCM(reviewAppName, ref); } else { @@ -173,7 +174,6 @@ async function deployPullRequest( await client.disableAutoDeploy(reviewAppName); await client.deployUsingSCM(reviewAppName, ref); } - deployedRA.push({ name: appName, isCreated: !reviewAppExists }); } catch (error) { logger.error({ event: 'review-app', diff --git a/test/acceptance/build/github_test.js b/test/acceptance/build/github_test.js index 5652c06e..da5f4be8 100644 --- a/test/acceptance/build/github_test.js +++ b/test/acceptance/build/github_test.js @@ -535,7 +535,7 @@ describe('Acceptance | Build | Github', function () { expect(addRADeploymentCheck.isDone()).to.be.true; expect(res.statusCode).to.equal(200); expect(res.result).to.eql( - 'Triggered deployment of RA on app pix-api-review, pix-audit-logger-review with pr 2', + 'Triggered deployment of RA on app pix-api-review, pix-audit-logger-review, pix-front-review with pr 2', ); }); }); diff --git a/test/unit/build/controllers/github_test.js b/test/unit/build/controllers/github_test.js index e92d9f75..6f25596c 100644 --- a/test/unit/build/controllers/github_test.js +++ b/test/unit/build/controllers/github_test.js @@ -662,24 +662,6 @@ Les variables d'environnement seront accessibles sur scalingo https://dashboard. }); }); - it('throws an error on scalingo deployment fails', async function () { - // given - const scalingoClientStub = sinon.stub(); - const deployUsingSCMStub = sinon.stub().rejects(new Error('Deployment error')); - const reviewAppExistsStub = sinon.stub().resolves(true); - scalingoClientStub.getInstance = sinon.stub().returns({ - deployUsingSCM: deployUsingSCMStub, - reviewAppExists: reviewAppExistsStub, - }); - - // when - const result = await catchErr(githubController.handleRA)(request, scalingoClientStub); - - // then - expect(result).to.be.instanceOf(Error); - expect(result.message).to.equal('No RA deployed for repository pix and pr3'); - }); - describe('when the review app does not exist', function () { it('should call scalingo to create and deploy the corresponding applications', async function () { // given