diff --git a/extensions/notification/configManager/MongoConfigManager.js b/extensions/notification/configManager/MongoConfigManager.js index 2ec679f68..1ddc3c5ff 100644 --- a/extensions/notification/configManager/MongoConfigManager.js +++ b/extensions/notification/configManager/MongoConfigManager.js @@ -97,7 +97,7 @@ class MongoConfigManager extends BaseConfigManager { * @returns {undefined} */ async _setupMongoClient(cb) { - const mongoUrl = constructConnectionString(this._mongoConfig); + const mongoUrl = constructConnectionString(this._mongoConfig); try { const client = await new MongoClient(mongoUrl, { replicaSet: this._mongoConfig.replicaSet, diff --git a/lib/util/LocationStatusManager.js b/lib/util/LocationStatusManager.js index 6c9787868..77252fa70 100644 --- a/lib/util/LocationStatusManager.js +++ b/lib/util/LocationStatusManager.js @@ -173,7 +173,7 @@ class LocationStatusManager { this._locationStatusColl.insertOne({ _id: location, value: locationConfig.getValue(), - }).finally(next); + }).then(() => next()).catch(next); }, err => { if (err) { this._logger.error('Could not add new locations', { diff --git a/tests/functional/ingestion/IngestionReader.js b/tests/functional/ingestion/IngestionReader.js index 968a8adb6..8762af85c 100644 --- a/tests/functional/ingestion/IngestionReader.js +++ b/tests/functional/ingestion/IngestionReader.js @@ -120,11 +120,12 @@ describe('ingestion reader tests with mock', function fD() { topic, num_partitions: 1, // eslint-disable-line camelcase replication_factor: 1, // eslint-disable-line camelcase - }).catch(err => { + }) + } catch(err) { if (err.code !== 36) { // if topic does not already exist throw err; } - }); + }; producer = new BackbeatProducer({ kafka: testConfig.kafka, topic: testConfig.extensions.ingestion.topic, @@ -154,9 +155,6 @@ describe('ingestion reader tests with mock', function fD() { const metadataMock = new MetadataMock(); httpServer = http.createServer((req, res) => metadataMock.onRequest(req, res)) .listen(testPort); - } catch (err) { - throw err; - } }); after(async () => {