From 16b58d2dd7a3665414d59ee6a9e6bc5885677e5d Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 14 Oct 2021 20:44:24 -0700 Subject: [PATCH] release 2.8.28 (#2987) * nodeunit -> nodeunit-x (+security updates) * avoid tests/plugins failures due to timing issues * bump haraka-net-utils version: fixes #2985 --- Changes.md | 4 +++ contrib/plugin2npm.sh | 6 ++-- docs/plugins/queue/smtp_forward.md | 2 +- package.json | 6 ++-- run_tests | 5 +-- tests/plugins.js | 49 +++++++++++++++--------------- 6 files changed, 38 insertions(+), 34 deletions(-) diff --git a/Changes.md b/Changes.md index 384fa0cad..ef644fa94 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,9 @@ ## NEXT - 2021-MM-DD + +## 2.8.28 - 2021-10-14 + ### Changes - breaking: dkim.js has changed the constructor opts @@ -113,6 +116,7 @@ * TLS: don't abort loading certs in config/tls dir when an error is encountered. Process every cert file and then emit errors. #2729 * restore TLS version, correctly #2723 + ## 2.8.25 - 2019-10-11 ### Changes diff --git a/contrib/plugin2npm.sh b/contrib/plugin2npm.sh index 9c75472da..9efa5f37f 100755 --- a/contrib/plugin2npm.sh +++ b/contrib/plugin2npm.sh @@ -83,7 +83,7 @@ if [ -f "tests/plugins/$1.js" ]; then #!/usr/bin/env node 'use strict' try { - var reporter = require('nodeunit').reporters.default; + var reporter = require('nodeunit-x').reporters.default; } catch (e) { console.log(` @@ -102,8 +102,8 @@ reporter.run([ 'test' ], undefined, (err) => { EO_TEST_RUN sed -i '' \ - -e 's/"_mocha"/"nodeunit"/' \ - -e 's/"mocha"/"nodeunit"/' \ + -e 's/"_mocha"/"nodeunit-x"/' \ + -e 's/"mocha"/"nodeunit-x"/' \ "$PLUGIN_REPO/package.json" $GIT_CMD add package.json diff --git a/docs/plugins/queue/smtp_forward.md b/docs/plugins/queue/smtp_forward.md index 10e059fb2..270f862d5 100644 --- a/docs/plugins/queue/smtp_forward.md +++ b/docs/plugins/queue/smtp_forward.md @@ -122,4 +122,4 @@ forwarding for specific domains. # Split host forward routing -When an incoming email transaction has multiple recipients with different forward routes, recipients to subsequent forward routes are deferred. Example: an incoming email transaction has recipients user@example1.com, user@example2.com, and user@example3.com. The first two messages will be accepted (they share the same forward destination) and the latter one will be deferred. It will arrive in a future delivery attempt by the remote. +When an incoming email transaction has multiple recipients with different forward routes, recipients to subsequent forward routes are deferred. Example: an incoming email transaction has recipients user@example1.com, user@example2.com, and user@example3.com. The first two recipients will be accepted (they share the same forward destination) and the latter will be deferred. It will arrive in a future delivery attempt by the remote. diff --git a/package.json b/package.json index 169530348..b0a6b8d9f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "server", "email" ], - "version": "2.8.27", + "version": "2.8.28", "homepage": "http://haraka.github.io", "repository": { "type": "git", @@ -36,7 +36,7 @@ "haraka-config" : "^1.0.20", "haraka-constants" : "^1.0.5", "haraka-dsn" : "^1.0.3", - "haraka-net-utils" : "^1.3.0", + "haraka-net-utils" : "^1.3.1", "haraka-notes" : "^1.0.4", "haraka-plugin-redis" : "^1.0.12", "haraka-results" : "^2.0.3", @@ -69,7 +69,7 @@ "tmp" : "~0.2.1" }, "devDependencies": { - "nodeunit" : "^0.11", + "nodeunit-x" : "^0.15.0", "haraka-test-fixtures" : "^1.0.33", "mock-require" : "^3.0.3", "eslint" : "^8.0", diff --git a/run_tests b/run_tests index 4d2bcc04b..f3e179463 100755 --- a/run_tests +++ b/run_tests @@ -1,9 +1,10 @@ #!/usr/bin/env node -"use strict"; +'use strict'; + let reporter; try { - reporter = require('nodeunit').reporters.default; + reporter = require('nodeunit-x').reporters.default; } catch (e) { console.log(`Error: ${e.message} diff --git a/tests/plugins.js b/tests/plugins.js index a0be421b9..9a823d407 100644 --- a/tests/plugins.js +++ b/tests/plugins.js @@ -1,5 +1,7 @@ 'use strict'; +process.env.WITHOUT_CONFIG_CACHE=true; + const fs = require('fs'); const path = require('path'); const plugin = require('../plugins'); @@ -46,46 +48,43 @@ exports.plugin = { } } -const toPath = path.join('config', `${piName }.timeout`); - -const toVals = [ '0', '3', '60', 'apple']; -function getVal () { - return toVals.shift(); -} +const toPath = path.join('config', `${piName}.timeout`); exports.get_timeout = { - setUp (done) { - process.env.WITHOUT_CONFIG_CACHE=true; - this.to = getVal(); - const self = this; - fs.writeFile(toPath, this.to, () => { - self.plugin = new plugin.Plugin(piName); - done(); - }); - }, tearDown : done => { - delete process.env.WITHOUT_CONFIG_CACHE; fs.unlink(toPath, done); }, '0s' (test) { test.expect(1); - test.equal( this.plugin.timeout, this.to ); - test.done(); + fs.writeFile(toPath, '0', () => { + this.plugin = new plugin.Plugin(piName); + test.equal( this.plugin.timeout, 0 ); + test.done(); + }) }, '3s' (test) { test.expect(1); - test.equal( this.plugin.timeout, this.to ); - test.done(); + fs.writeFile(toPath, '3', () => { + this.plugin = new plugin.Plugin(piName); + test.equal( this.plugin.timeout, 3 ); + test.done(); + }) }, '60s' (test) { test.expect(1); - test.equal( this.plugin.timeout, this.to ); - test.done(); + fs.writeFile(toPath, '60', () => { + this.plugin = new plugin.Plugin(piName); + test.equal( this.plugin.timeout, 60 ); + test.done(); + }) }, - '30s default (overrides NaN apple)' (test) { + '30s default (overrides NaN)' (test) { test.expect(1); - test.equal( this.plugin.timeout, 30 ); - test.done(); + fs.writeFile(toPath, 'apple', () => { + this.plugin = new plugin.Plugin(piName); + test.equal( this.plugin.timeout, 30 ); + test.done(); + }) }, }