From afb0fd5a23b34984f042471f3ae98302197f658e Mon Sep 17 00:00:00 2001 From: gnuxie Date: Thu, 13 Jan 2022 16:54:29 +0000 Subject: [PATCH] Skip policy consumption test when the rule server is not enabled --- config/harness.yaml | 2 +- test/integration/policyConsumptionTest.ts | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config/harness.yaml b/config/harness.yaml index 1d3ba39..434c4b8 100644 --- a/config/harness.yaml +++ b/config/harness.yaml @@ -190,4 +190,4 @@ web: # A web API for a description of all the combined rules from watched banlists. # GET /api/1/ruleserver/updates ruleServer: - enabled: true + enabled: false diff --git a/test/integration/policyConsumptionTest.ts b/test/integration/policyConsumptionTest.ts index d432c87..1b6a405 100644 --- a/test/integration/policyConsumptionTest.ts +++ b/test/integration/policyConsumptionTest.ts @@ -40,13 +40,21 @@ async function waitForRuleChange(thunk): Promise { describe("Test: that policy lists are consumed by the associated synapse module", function () { this.afterEach(async function () { - this.timeout(5000) - LogService.debug('policyConsumptionTest', `Rules at end of test ${JSON.stringify(await currentRules(), null, 2)}`); - const mjolnir = config.RUNTIME.client!; - // Clear any state associated with the account. - await mjolnir.setAccountData('org.matrix.mjolnir.watched_lists', { - references: [], - }); + if(config.web.ruleServer.enabled) { + this.timeout(5000) + LogService.debug('policyConsumptionTest', `Rules at end of test ${JSON.stringify(await currentRules(), null, 2)}`); + const mjolnir = config.RUNTIME.client!; + // Clear any state associated with the account. + await mjolnir.setAccountData('org.matrix.mjolnir.watched_lists', { + references: [], + }); + } + }) + this.beforeAll(async function() { + if (!config.web.ruleServer.enabled) { + LogService.warn("policyConsumptionTest", "Skipping policy consumption test because the ruleServer is not enabled") + this.skip(); + } }) this.beforeEach(async function () { this.timeout(1000);