diff --git a/packages/pro b/packages/pro index bec35b4c27..b28dbd5492 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit bec35b4c27ec10fe31dc07f9d42d8bda426b8535 +Subproject commit b28dbd549284cf450be7f25ad85aadf614d08f0b diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index a916131a39..1ee0e168a1 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -177,28 +177,26 @@ if (descriptions.length) { } async function expectRowUsage(expected: number, f: () => Promise) { - return await quotas.withEnabled(async () => { - const before = await getRowUsage() - await f() - const after = await getRowUsage() - const usage = after - before + const before = await getRowUsage() + await f() + const after = await getRowUsage() + const usage = after - before - // Because our quota tracking is not perfect, we allow a 10% margin of - // error. This is to account for the fact that parallel writes can - // result in some quota updates getting lost. We don't have any need - // to solve this right now, so we just allow for some error. - if (expected === 0) { - expect(usage).toEqual(0) - return - } - if (usage < 0) { - expect(usage).toBeGreaterThan(expected * 1.1) - expect(usage).toBeLessThan(expected * 0.9) - } else { - expect(usage).toBeGreaterThan(expected * 0.9) - expect(usage).toBeLessThan(expected * 1.1) - } - }) + // Because our quota tracking is not perfect, we allow a 10% margin of + // error. This is to account for the fact that parallel writes can + // result in some quota updates getting lost. We don't have any need + // to solve this right now, so we just allow for some error. + if (expected === 0) { + expect(usage).toEqual(0) + return + } + if (usage < 0) { + expect(usage).toBeGreaterThan(expected * 1.1) + expect(usage).toBeLessThan(expected * 0.9) + } else { + expect(usage).toBeGreaterThan(expected * 0.9) + expect(usage).toBeLessThan(expected * 1.1) + } } const defaultRowFields = isInternal diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 153a25aca7..ad41aa618c 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -2830,14 +2830,12 @@ if (descriptions.length) { expected: number, f: () => Promise ): Promise { - return await quotas.withEnabled(async () => { - const before = await getRowUsage() - const result = await f() - const after = await getRowUsage() - const usage = after - before - expect(usage).toBe(expected) - return result - }) + const before = await getRowUsage() + const result = await f() + const after = await getRowUsage() + const usage = after - before + expect(usage).toBe(expected) + return result } it("should be able to delete a row", async () => { diff --git a/packages/server/src/automations/tests/steps/openai.spec.ts b/packages/server/src/automations/tests/steps/openai.spec.ts index b370c9b71c..a06c633e5e 100644 --- a/packages/server/src/automations/tests/steps/openai.spec.ts +++ b/packages/server/src/automations/tests/steps/openai.spec.ts @@ -44,13 +44,11 @@ describe("test the openai action", () => { } const expectAIUsage = async (expected: number, f: () => Promise) => { - return await quotas.withEnabled(async () => { - const before = await getAIUsage() - const result = await f() - const after = await getAIUsage() - expect(after - before).toEqual(expected) - return result - }) + const before = await getAIUsage() + const result = await f() + const after = await getAIUsage() + expect(after - before).toEqual(expected) + return result } it("should be able to receive a response from ChatGPT given a prompt", async () => {