From 8492ef18fa56d0600b35b5bd6b3b70d921e8293d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 9 Jun 2023 12:36:09 +0100 Subject: [PATCH 1/5] Ignore 409 errors on user syncs --- packages/server/src/events/docUpdates/syncUsers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/server/src/events/docUpdates/syncUsers.ts b/packages/server/src/events/docUpdates/syncUsers.ts index 7957178168..5777445249 100644 --- a/packages/server/src/events/docUpdates/syncUsers.ts +++ b/packages/server/src/events/docUpdates/syncUsers.ts @@ -26,6 +26,10 @@ export default function process(updateCb?: UpdateCallback) { // if something not found - no changes to perform if (err?.status === 404) { return + } + // The user has already been sync in another process + else if (err?.status === 409) { + return } else { logging.logAlert("Failed to perform user/group app sync", err) } From 2e76885cd174c2b4498eaf0bf4b26327c0df262c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 9 Jun 2023 14:22:49 +0000 Subject: [PATCH 2/5] Bump version to 2.7.7-alpha.3 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index eded0d214d..e3e6aa1627 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.7.7-alpha.2", + "version": "2.7.7-alpha.3", "npmClient": "yarn", "packages": [ "packages/backend-core", From b1287d6a9f121d783cfc60bdedd4f8d9a686471d Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 9 Jun 2023 20:39:14 +0100 Subject: [PATCH 3/5] Update qa test notify script to be env aware --- qa-core/scripts/testResultsWebhook.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qa-core/scripts/testResultsWebhook.js b/qa-core/scripts/testResultsWebhook.js index b4725cae56..40cc42082d 100644 --- a/qa-core/scripts/testResultsWebhook.js +++ b/qa-core/scripts/testResultsWebhook.js @@ -15,6 +15,12 @@ async function generateReport() { return JSON.parse(report) } +const env = process.argv.slice(2)[0] + +if (!env) { + throw new Error("environment argument is required") +} + async function discordResultsNotification(report) { const { numTotalTestSuites, @@ -39,8 +45,8 @@ async function discordResultsNotification(report) { content: `**Nightly Tests Status**: ${OUTCOME}`, embeds: [ { - title: "Budi QA Bot", - description: `Nightly Tests`, + title: `Budi QA Bot - ${env}`, + description: `API Integration Tests`, url: GITHUB_ACTIONS_RUN_URL, color: OUTCOME === "success" ? 3066993 : 15548997, timestamp: new Date(), From 25fc792d24153fc1047fc5be6fc4565e161cac39 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 9 Jun 2023 20:58:42 +0100 Subject: [PATCH 4/5] Fix qa-core teardown --- qa-core/src/account-api/api/apis/AccountAPI.ts | 7 +++++-- qa-core/src/jest/globalTeardown.ts | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qa-core/src/account-api/api/apis/AccountAPI.ts b/qa-core/src/account-api/api/apis/AccountAPI.ts index c18dde3d4a..35e7e5495e 100644 --- a/qa-core/src/account-api/api/apis/AccountAPI.ts +++ b/qa-core/src/account-api/api/apis/AccountAPI.ts @@ -59,9 +59,12 @@ export default class AccountAPI { return [response, json] } - async delete(accountID: string) { + async delete(accountID: string, opts: APIRequestOpts = { doExpect: true }) { const [response, json] = await this.client.del(`/api/accounts/${accountID}`) - expect(response).toHaveStatusCode(200) + + if (opts.doExpect) { + expect(response).toHaveStatusCode(200) + } return response } } diff --git a/qa-core/src/jest/globalTeardown.ts b/qa-core/src/jest/globalTeardown.ts index 51f6046f4f..5d6e1364d9 100644 --- a/qa-core/src/jest/globalTeardown.ts +++ b/qa-core/src/jest/globalTeardown.ts @@ -10,7 +10,8 @@ const API_OPTS: APIRequestOpts = { doExpect: false } async function deleteAccount() { // @ts-ignore const accountID = global.qa.accountId - await accountsApi.accounts.delete(accountID) + // can't run 'expect' blocks in teardown + await accountsApi.accounts.delete(accountID, { doExpect: false }) } async function teardown() { From 7bd7cdcdcf437675a45a43583e393e3f7a4b4b52 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 12 Jun 2023 15:08:22 +0100 Subject: [PATCH 5/5] Fix qa-core global teardown --- qa-core/src/account-api/api/apis/AccountAPI.ts | 12 +++++++----- qa-core/src/jest/globalTeardown.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qa-core/src/account-api/api/apis/AccountAPI.ts b/qa-core/src/account-api/api/apis/AccountAPI.ts index 35e7e5495e..54784814b7 100644 --- a/qa-core/src/account-api/api/apis/AccountAPI.ts +++ b/qa-core/src/account-api/api/apis/AccountAPI.ts @@ -59,11 +59,13 @@ export default class AccountAPI { return [response, json] } - async delete(accountID: string, opts: APIRequestOpts = { doExpect: true }) { - const [response, json] = await this.client.del(`/api/accounts/${accountID}`) - - if (opts.doExpect) { - expect(response).toHaveStatusCode(200) + async delete(accountID: string) { + const [response, json] = await this.client.del(`/api/accounts/${accountID}`, { + internal: true, + }) + // can't use expect here due to use in global teardown + if (response.status !== 204) { + throw new Error(`Could not delete accountId=${accountID}`) } return response } diff --git a/qa-core/src/jest/globalTeardown.ts b/qa-core/src/jest/globalTeardown.ts index 5d6e1364d9..52696a72f8 100644 --- a/qa-core/src/jest/globalTeardown.ts +++ b/qa-core/src/jest/globalTeardown.ts @@ -11,7 +11,7 @@ async function deleteAccount() { // @ts-ignore const accountID = global.qa.accountId // can't run 'expect' blocks in teardown - await accountsApi.accounts.delete(accountID, { doExpect: false }) + await accountsApi.accounts.delete(accountID) } async function teardown() {