From 1e190886fb51b9ede9d642d73f99fbecff0c8a96 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 21 Oct 2022 16:02:13 +0100 Subject: [PATCH] Fixing issue discovered by tests. --- packages/backend-core/src/queue/queue.ts | 2 +- .../server/src/api/controllers/deploy/index.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/backend-core/src/queue/queue.ts b/packages/backend-core/src/queue/queue.ts index 6dd10ee091..7eaafe38a8 100644 --- a/packages/backend-core/src/queue/queue.ts +++ b/packages/backend-core/src/queue/queue.ts @@ -22,7 +22,7 @@ export function createQueue( ): BullQueue.Queue { const queueConfig: any = redisProtocolUrl || { redis: opts } let queue: any - if (env.isTest()) { + if (!env.isTest()) { queue = new BullQueue(jobQueue, queueConfig) } else { queue = new InMemoryQueue(jobQueue, queueConfig) diff --git a/packages/server/src/api/controllers/deploy/index.ts b/packages/server/src/api/controllers/deploy/index.ts index a1cb905930..b3b875e397 100644 --- a/packages/server/src/api/controllers/deploy/index.ts +++ b/packages/server/src/api/controllers/deploy/index.ts @@ -20,6 +20,7 @@ import { import { events } from "@budibase/backend-core" import { backups } from "@budibase/pro" import { AppBackupTrigger } from "@budibase/types" +import env from "../../../environment" // the max time we can wait for an invalidation to complete before considering it failed const MAX_PENDING_TIME_MS = 30 * 60000 @@ -107,10 +108,17 @@ async function deployApp(deployment: any, userId: string) { const devAppId = getDevelopmentAppID(appId) const productionAppId = getProdAppID(appId) - // trigger backup initially - await backups.triggerAppBackup(productionAppId, AppBackupTrigger.PUBLISH, { - createdBy: userId, - }) + // can't do this in test + if (!env.isTest()) { + // trigger backup initially + await backups.triggerAppBackup( + productionAppId, + AppBackupTrigger.PUBLISH, + { + createdBy: userId, + } + ) + } const config: any = { source: devAppId,