diff --git a/bin/backbeat.js b/bin/backbeat.js index 46ade69f8..fece70bee 100644 --- a/bin/backbeat.js +++ b/bin/backbeat.js @@ -5,7 +5,7 @@ const werelogs = require('werelogs'); const runServer = require('../lib/api/BackbeatServer'); const { initManagement } = require('../lib/management/index'); const setupIngestionSiteMock = require('../tests/utils/mockIngestionSite'); -const config = require('../lib/Config'); +const { config } = require('../lib/Config'); const Logger = werelogs.Logger; const log = new Logger('BackbeatServer:index'); diff --git a/bin/ingestion.js b/bin/ingestion.js index 6accc0313..7149a8161 100644 --- a/bin/ingestion.js +++ b/bin/ingestion.js @@ -14,7 +14,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils; const { reshapeExceptionError } = require('arsenal').errorUtils; const IngestionPopulator = require('../lib/queuePopulator/IngestionPopulator'); -const config = require('../lib/Config'); +const { config } = require('../lib/Config'); const { initManagement } = require('../lib/management/index'); const ZookeeperManager = require('../lib/clients/ZookeeperManager'); const { zookeeperNamespace, zkStatePath } = diff --git a/bin/queuePopulator.js b/bin/queuePopulator.js index c1328d425..84fded901 100644 --- a/bin/queuePopulator.js +++ b/bin/queuePopulator.js @@ -3,7 +3,7 @@ const schedule = require('node-schedule'); const werelogs = require('werelogs'); -const config = require('../lib/Config'); +const { config } = require('../lib/Config'); const zkConfig = config.zookeeper; const kafkaConfig = config.kafka; const extConfigs = config.extensions; diff --git a/bin/replication.js b/bin/replication.js index 242b701ee..a48fab3fc 100644 --- a/bin/replication.js +++ b/bin/replication.js @@ -5,7 +5,7 @@ const werelogs = require('werelogs'); const Logger = werelogs.Logger; const { RoundRobin } = require('arsenal').network; -const config = require('../lib/Config'); +const { config } = require('../lib/Config'); const SetupReplication = require('../extensions/replication/utils/SetupReplication'); const version = require('../package.json').version; diff --git a/extensions/gc/GarbageCollectorProducer.js b/extensions/gc/GarbageCollectorProducer.js index 3a3e5b7d2..23ffc596e 100644 --- a/extensions/gc/GarbageCollectorProducer.js +++ b/extensions/gc/GarbageCollectorProducer.js @@ -3,7 +3,7 @@ const { Logger } = require('werelogs'); const BackbeatProducer = require('../../lib/BackbeatProducer'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); class GarbageCollectorProducer { /** diff --git a/extensions/gc/service.js b/extensions/gc/service.js index 08e50fb33..70b03c127 100644 --- a/extensions/gc/service.js +++ b/extensions/gc/service.js @@ -13,7 +13,7 @@ const { ZenkoMetrics } = require('arsenal').metrics; const GarbageCollector = require('./GarbageCollector'); const { startProbeServer } = require('../../lib/util/probe'); const { initManagement } = require('../../lib/management'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const kafkaConfig = config.kafka; const s3Config = config.s3; diff --git a/extensions/lifecycle/LifecycleQueuePopulator.js b/extensions/lifecycle/LifecycleQueuePopulator.js index d41f9ad06..0295be17e 100644 --- a/extensions/lifecycle/LifecycleQueuePopulator.js +++ b/extensions/lifecycle/LifecycleQueuePopulator.js @@ -15,7 +15,7 @@ const LIFEYCLE_POPULATOR_CLIENT_ID = 'lifecycle-populator'; const METASTORE = '__metastore'; const VaultClientWrapper = require('../utils/VaultClientWrapper'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const { coldStorageRestoreAdjustTopicPrefix, coldStorageRestoreTopicPrefix, diff --git a/extensions/lifecycle/bucketProcessor/task.js b/extensions/lifecycle/bucketProcessor/task.js index 82e0abfa6..9dc2992fa 100644 --- a/extensions/lifecycle/bucketProcessor/task.js +++ b/extensions/lifecycle/bucketProcessor/task.js @@ -15,7 +15,7 @@ const { initManagement } = require('../../../lib/management/index'); const LifecycleBucketProcessor = require('./LifecycleBucketProcessor'); const { applyBucketLifecycleWorkflows } = require('../management'); const { startProbeServer } = require('../../../lib/util/probe'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { zookeeper, kafka, extensions, s3, log, queuePopulator } = config; const lcConfig = extensions.lifecycle; diff --git a/extensions/lifecycle/conductor/service.js b/extensions/lifecycle/conductor/service.js index 0aa78a2ec..6ec2c6a0e 100644 --- a/extensions/lifecycle/conductor/service.js +++ b/extensions/lifecycle/conductor/service.js @@ -12,7 +12,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils; const { ZenkoMetrics } = require('arsenal').metrics; const LifecycleConductor = require('./LifecycleConductor'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { startProbeServer } = require('../../../lib/util/probe'); const zkConfig = config.zookeeper; diff --git a/extensions/lifecycle/management.js b/extensions/lifecycle/management.js index ad60d8528..3c4e41d65 100644 --- a/extensions/lifecycle/management.js +++ b/extensions/lifecycle/management.js @@ -1,7 +1,7 @@ const AWS = require('aws-sdk'); const werelogs = require('werelogs'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const management = require('../../lib/management/index'); const { TIMEOUT_MS } = require('../../lib/clients/utils'); diff --git a/extensions/lifecycle/objectProcessor/task.js b/extensions/lifecycle/objectProcessor/task.js index 50c4872c2..8c4b1d3b0 100644 --- a/extensions/lifecycle/objectProcessor/task.js +++ b/extensions/lifecycle/objectProcessor/task.js @@ -15,7 +15,7 @@ const { initManagement } = require('../../../lib/management/index'); const LifecycleObjectExpirationProcessor = require('./LifecycleObjectExpirationProcessor'); const LifecycleObjectTransitionProcessor = require('./LifecycleObjectTransitionProcessor'); const { startProbeServer } = require('../../../lib/util/probe'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const zkConfig = config.zookeeper; const kafkaConfig = config.kafka; diff --git a/extensions/lifecycle/tasks/LifecycleTask.js b/extensions/lifecycle/tasks/LifecycleTask.js index 2c6142e7a..88341c274 100644 --- a/extensions/lifecycle/tasks/LifecycleTask.js +++ b/extensions/lifecycle/tasks/LifecycleTask.js @@ -10,7 +10,7 @@ const { } = require('arsenal').s3middleware.lifecycleHelpers; const { CompareResult, MinHeap } = require('arsenal').algorithms.Heap; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { attachReqUids } = require('../../../lib/clients/utils'); const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); diff --git a/extensions/mongoProcessor/MongoQueueProcessor.js b/extensions/mongoProcessor/MongoQueueProcessor.js index 6811079f4..020b754ae 100644 --- a/extensions/mongoProcessor/MongoQueueProcessor.js +++ b/extensions/mongoProcessor/MongoQueueProcessor.js @@ -10,7 +10,7 @@ const MongoClient = require('arsenal').storage const ObjectMD = require('arsenal').models.ObjectMD; const { extractVersionId } = require('../../lib/util/versioning'); -const Config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const BackbeatConsumer = require('../../lib/BackbeatConsumer'); const QueueEntry = require('../../lib/models/QueueEntry'); const DeleteOpQueueEntry = require('../../lib/models/DeleteOpQueueEntry'); @@ -74,7 +74,7 @@ class MongoQueueProcessor { this.logger = new Logger('Backbeat:Ingestion:MongoProcessor'); this.mongoClientConfig.logger = this.logger; this._mongoClient = new MongoClient(this.mongoClientConfig); - this._bucketMemState = new BucketMemState(Config); + this._bucketMemState = new BucketMemState(config); // in-mem batch of metrics, we only track total entry count by location // this._accruedMetrics = { zenko-location: 10 } @@ -123,9 +123,9 @@ class MongoQueueProcessor { process.exit(1); } - this._bootstrapList = Config.getBootstrapList(); - Config.on('bootstrap-list-update', () => { - this._bootstrapList = Config.getBootstrapList(); + this._bootstrapList = config.getBootstrapList(); + config.on('bootstrap-list-update', () => { + this._bootstrapList = config.getBootstrapList(); }); let consumerReady = false; diff --git a/extensions/mongoProcessor/mongoProcessorTask.js b/extensions/mongoProcessor/mongoProcessorTask.js index b78ce3443..bc9ab9af2 100644 --- a/extensions/mongoProcessor/mongoProcessorTask.js +++ b/extensions/mongoProcessor/mongoProcessorTask.js @@ -11,7 +11,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils; const { ZenkoMetrics } = require('arsenal').metrics; const MongoQueueProcessor = require('./MongoQueueProcessor'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const { initManagement } = require('../../lib/management/index'); const { startProbeServer } = require('../../lib/util/probe'); diff --git a/extensions/notification/queueProcessor/task.js b/extensions/notification/queueProcessor/task.js index d59e26fe3..ffcbef049 100644 --- a/extensions/notification/queueProcessor/task.js +++ b/extensions/notification/queueProcessor/task.js @@ -12,7 +12,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils; const QueueProcessor = require('./QueueProcessor'); const { startProbeServer } = require('../../../lib/util/probe'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const kafkaConfig = config.kafka; const notifConfig = config.extensions.notification; const mongoConfig = config.queuePopulator.mongo; diff --git a/extensions/oplogPopulator/OplogPopulatorTask.js b/extensions/oplogPopulator/OplogPopulatorTask.js index 90c33ff89..0d814010d 100644 --- a/extensions/oplogPopulator/OplogPopulatorTask.js +++ b/extensions/oplogPopulator/OplogPopulatorTask.js @@ -3,7 +3,7 @@ const werelogs = require('werelogs'); const { errors } = require('arsenal'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const OplogPopulator = require('./OplogPopulator'); const { diff --git a/extensions/replication/ReplicationAPI.js b/extensions/replication/ReplicationAPI.js index 5be6d3ea1..3935384ce 100644 --- a/extensions/replication/ReplicationAPI.js +++ b/extensions/replication/ReplicationAPI.js @@ -1,4 +1,4 @@ -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const locations = require('../../conf/locationConfig.json') || {}; const ActionQueueEntry = require('../../lib/models/ActionQueueEntry'); diff --git a/extensions/replication/ReplicationMetrics.js b/extensions/replication/ReplicationMetrics.js index ec9ae1863..872b8affd 100644 --- a/extensions/replication/ReplicationMetrics.js +++ b/extensions/replication/ReplicationMetrics.js @@ -1,6 +1,6 @@ const { ZenkoMetrics } = require('arsenal').metrics; -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const { promMetricNames } = require('./constants'); const SIZE_BUCKETS = [ diff --git a/extensions/replication/failedCRR/FailedCRRConsumer.js b/extensions/replication/failedCRR/FailedCRRConsumer.js index 5bb7b042d..3676c7005 100644 --- a/extensions/replication/failedCRR/FailedCRRConsumer.js +++ b/extensions/replication/failedCRR/FailedCRRConsumer.js @@ -7,7 +7,7 @@ const redisClient = require('../../replication/utils/getRedisClient')(); const FailedCRRProducer = require('./FailedCRRProducer'); const BackbeatConsumer = require('../../../lib/BackbeatConsumer'); const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); // BackbeatConsumer constant defaults const CONSUMER_FETCH_MAX_BYTES = 5000020; diff --git a/extensions/replication/failedCRR/FailedCRRProducer.js b/extensions/replication/failedCRR/FailedCRRProducer.js index 333915f12..a899279fd 100644 --- a/extensions/replication/failedCRR/FailedCRRProducer.js +++ b/extensions/replication/failedCRR/FailedCRRProducer.js @@ -3,7 +3,7 @@ const { Logger } = require('werelogs'); const BackbeatProducer = require('../../../lib/BackbeatProducer'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); class FailedCRRProducer { /** diff --git a/extensions/replication/management.js b/extensions/replication/management.js index d34608936..694764930 100644 --- a/extensions/replication/management.js +++ b/extensions/replication/management.js @@ -2,7 +2,7 @@ const async = require('async'); const AWS = require('aws-sdk'); const werelogs = require('werelogs'); -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); const management = require('../../lib/management/index'); const logger = new werelogs.Logger('mdManagement:replication'); diff --git a/extensions/replication/queueProcessor/task.js b/extensions/replication/queueProcessor/task.js index aa5b1de5b..da4fab0ca 100644 --- a/extensions/replication/queueProcessor/task.js +++ b/extensions/replication/queueProcessor/task.js @@ -4,7 +4,7 @@ const assert = require('assert'); const werelogs = require('werelogs'); const QueueProcessor = require('./QueueProcessor'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { initManagement } = require('../../../lib/management/index'); const { applyBucketReplicationWorkflows } = require('../management'); const { reshapeExceptionError } = require('arsenal').errorUtils; diff --git a/extensions/replication/replicationStatusProcessor/task.js b/extensions/replication/replicationStatusProcessor/task.js index fb02a0b52..64e7812c0 100644 --- a/extensions/replication/replicationStatusProcessor/task.js +++ b/extensions/replication/replicationStatusProcessor/task.js @@ -7,7 +7,7 @@ const { startProbeServer } = require('../../../lib/util/probe'); const { DEFAULT_LIVE_ROUTE, DEFAULT_METRICS_ROUTE, DEFAULT_READY_ROUTE } = require('arsenal').network.probe.ProbeServer; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const kafkaConfig = config.kafka; const repConfig = config.extensions.replication; const sourceConfig = repConfig.source; diff --git a/extensions/replication/tasks/UpdateReplicationStatus.js b/extensions/replication/tasks/UpdateReplicationStatus.js index 9ec24d444..a86cf2e3a 100644 --- a/extensions/replication/tasks/UpdateReplicationStatus.js +++ b/extensions/replication/tasks/UpdateReplicationStatus.js @@ -1,7 +1,7 @@ const errors = require('arsenal').errors; const assert = require('assert'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const ObjectQueueEntry = require('../../../lib/models/ObjectQueueEntry'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); diff --git a/extensions/replication/utils/getRedisClient.js b/extensions/replication/utils/getRedisClient.js index cbdce8cc7..28ff648c7 100644 --- a/extensions/replication/utils/getRedisClient.js +++ b/extensions/replication/utils/getRedisClient.js @@ -1,5 +1,5 @@ const { RedisClient } = require('arsenal').metrics; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const werelogs = require('werelogs'); const log = new werelogs.Logger('Backbeat:RedisClient'); diff --git a/lib/clients/VaultClientCache.js b/lib/clients/VaultClientCache.js index 229a235ee..d5d5b83ee 100644 --- a/lib/clients/VaultClientCache.js +++ b/lib/clients/VaultClientCache.js @@ -1,4 +1,4 @@ -const config = require('../Config'); +const { config } = require('../Config'); const VaultClient = require('vaultclient').Client; diff --git a/lib/management/index.js b/lib/management/index.js index f19bb10cc..c7fb2b27e 100644 --- a/lib/management/index.js +++ b/lib/management/index.js @@ -1,4 +1,4 @@ -const config = require('../Config'); +const { config } = require('../Config'); const werelogs = require('werelogs'); werelogs.configure({ diff --git a/lib/management/operatorBackend.js b/lib/management/operatorBackend.js index f88689908..d14d44729 100644 --- a/lib/management/operatorBackend.js +++ b/lib/management/operatorBackend.js @@ -1,5 +1,5 @@ const arsenal = require('arsenal'); -const config = require('../Config'); +const { config } = require('../Config'); const werelogs = require('werelogs'); const { reshapeExceptionError } = arsenal.errorUtils; diff --git a/lib/management/patchConfiguration.js b/lib/management/patchConfiguration.js index 478957506..44e581db0 100644 --- a/lib/management/patchConfiguration.js +++ b/lib/management/patchConfiguration.js @@ -1,7 +1,7 @@ 'use strict'; // eslint-disable-line strict const async = require('async'); -const config = require('../Config'); +const { config } = require('../Config'); const bucketclient = require('bucketclient'); const { patchLocations } = require('arsenal').patches.locationConstraints; const Metadata = require('arsenal').storage.metadata.MetadataWrapper; diff --git a/lib/management/pensieveBackend.js b/lib/management/pensieveBackend.js index 8667f8f6f..234b11fe0 100644 --- a/lib/management/pensieveBackend.js +++ b/lib/management/pensieveBackend.js @@ -1,7 +1,7 @@ const async = require('async'); const arsenal = require('arsenal'); const { decryptSecret } = arsenal.pensieve.credentialUtils; -const config = require('../Config'); +const { config } = require('../Config'); const werelogs = require('werelogs'); const bucketclient = require('bucketclient'); diff --git a/lib/queuePopulator/IngestionPopulator.js b/lib/queuePopulator/IngestionPopulator.js index c077ce0ef..2c758510f 100644 --- a/lib/queuePopulator/IngestionPopulator.js +++ b/lib/queuePopulator/IngestionPopulator.js @@ -6,7 +6,7 @@ const { CircuitBreaker, BreakerState } = require('breakbeat').CircuitBreaker; const Logger = require('werelogs').Logger; -const config = require('../Config'); +const { config } = require('../Config'); const IngestionReader = require('./IngestionReader'); const BackbeatProducer = require('../BackbeatProducer'); const MetricsConsumer = require('../MetricsConsumer'); diff --git a/lib/queuePopulator/LogReader.js b/lib/queuePopulator/LogReader.js index 4eab191a7..e477665d3 100644 --- a/lib/queuePopulator/LogReader.js +++ b/lib/queuePopulator/LogReader.js @@ -2,7 +2,7 @@ const async = require('async'); const jsutil = require('arsenal').jsutil; -const config = require('../Config'); +const { config } = require('../Config'); const BackbeatProducer = require('../BackbeatProducer'); const ReplicationQueuePopulator = require('../../extensions/replication/ReplicationQueuePopulator'); diff --git a/tests/functional/api/retry.js b/tests/functional/api/retry.js index ae628b94c..03d0d9ff2 100644 --- a/tests/functional/api/retry.js +++ b/tests/functional/api/retry.js @@ -5,7 +5,7 @@ const querystring = require('querystring'); const { RedisClient } = require('arsenal').metrics; const { StatsModel } = require('arsenal').metrics; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const getUrl = require('../utils/getUrl'); const { addMembers, addManyMembers } = require('../utils/sortedSetHelpers'); const { makeRetryPOSTRequest, getRequest, getResponseBody } = diff --git a/tests/functional/api/routes.js b/tests/functional/api/routes.js index c8f21d143..bdfb5c87a 100644 --- a/tests/functional/api/routes.js +++ b/tests/functional/api/routes.js @@ -7,7 +7,7 @@ const zookeeper = require('node-zookeeper-client'); const { RedisClient } = require('arsenal').metrics; const { StatsModel } = require('arsenal').metrics; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { makeRequest, getRequest, getResponseBody } = require('../utils/httpHelpers'); const getUrl = require('../utils/getUrl'); diff --git a/tests/functional/ingestion/pauseResumeState.js b/tests/functional/ingestion/pauseResumeState.js index f795a861c..0d631ef22 100644 --- a/tests/functional/ingestion/pauseResumeState.js +++ b/tests/functional/ingestion/pauseResumeState.js @@ -9,7 +9,7 @@ const ZKStateHelper = require('../utils/pauseResumeUtils/zkStateHelper'); const MockAPI = require('../utils/pauseResumeUtils/mockAPI'); // Configs -const Config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const testConfig = require('../../config.json'); const { zookeeperNamespace } = require('../../../extensions/ingestion/constants'); @@ -77,7 +77,7 @@ class IngestionPopulatorMock extends IngestionPopulator { assert.ifError(err); const buckets = [firstBucket, secondBucket]; - Config.setIngestionBuckets(existingLocationConstraints, buckets); + config.setIngestionBuckets(existingLocationConstraints, buckets); return cb(err); }); diff --git a/tests/performance/lifecycle/conductor-check-memory-balloon.js b/tests/performance/lifecycle/conductor-check-memory-balloon.js index 9933349fc..abea869f6 100644 --- a/tests/performance/lifecycle/conductor-check-memory-balloon.js +++ b/tests/performance/lifecycle/conductor-check-memory-balloon.js @@ -1,9 +1,9 @@ const assert = require('assert'); const async = require('async'); -const baseConfig = require('../../../lib/Config'); -baseConfig.zookeeper.autoCreateNamespace = true; -const mongoConfig = baseConfig.queuePopulator.mongo; +const { config } = require('../../../lib/Config'); +config.zookeeper.autoCreateNamespace = true; +const mongoConfig = config.queuePopulator.mongo; const LifecycleConductor = require('../../../extensions/lifecycle/conductor/LifecycleConductor'); const { BackbeatMetadataProxyMock } = require('../../functional/lifecycle/utils'); @@ -14,7 +14,7 @@ describe('Lifecycle Conductor', function testBackpressure() { describe('with bucketd', () => { const lcConfig = { - ...baseConfig.extensions.lifecycle, + ...config.extensions.lifecycle, auth: { type: '', }, @@ -34,11 +34,11 @@ describe('Lifecycle Conductor', function testBackpressure() { }; const lc = new LifecycleConductor( - baseConfig.zookeeper, - baseConfig.kafka, + config.zookeeper, + config.kafka, lcConfig, - baseConfig.extensions.replication, - baseConfig.s3, + config.extensions.replication, + config.s3, ); it('should apply backpressure on bucket queue instead of ballooning', done => { @@ -66,7 +66,7 @@ describe('Lifecycle Conductor', function testBackpressure() { describe('with mongodb', () => { const lcConfig = { - ...baseConfig.extensions.lifecycle, + ...config.extensions.lifecycle, auth: { type: '', }, @@ -83,16 +83,16 @@ describe('Lifecycle Conductor', function testBackpressure() { }; const zookeeperConfig = { - ...baseConfig.zookeeper, + ...config.zookeeper, autoCreateNamespace: true, }; const lc = new LifecycleConductor( zookeeperConfig, - baseConfig.kafka, + config.kafka, lcConfig, - baseConfig.extensions.replication, - baseConfig.s3, + config.extensions.replication, + config.s3, ); const injectAccounts = client => { diff --git a/tests/unit/api/BackbeatAPI.spec.js b/tests/unit/api/BackbeatAPI.spec.js index 3f163195c..9334ae67e 100644 --- a/tests/unit/api/BackbeatAPI.spec.js +++ b/tests/unit/api/BackbeatAPI.spec.js @@ -2,7 +2,7 @@ const assert = require('assert'); const BackbeatAPI = require('../../../lib/api/BackbeatAPI'); const BackbeatRequest = require('../../../lib/api/BackbeatRequest'); -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const fakeLogger = require('../../utils/fakeLogger'); const setupIngestionSiteMock = require('../../utils/mockIngestionSite'); const locationConfig = require('../../../conf/locationConfig.json'); diff --git a/tests/unit/ingestion/IngestionPopulator.js b/tests/unit/ingestion/IngestionPopulator.js index 56c98dd8f..65b37f11a 100644 --- a/tests/unit/ingestion/IngestionPopulator.js +++ b/tests/unit/ingestion/IngestionPopulator.js @@ -3,7 +3,7 @@ const assert = require('assert'); const sinon = require('sinon'); const errors = require('arsenal').errors; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const IngestionPopulator = require('../../../lib/queuePopulator/IngestionPopulator'); const IngestionReader = require('../../../lib/queuePopulator/IngestionReader'); diff --git a/tests/unit/lifecycle/LifecycleQueuePopulator.spec.js b/tests/unit/lifecycle/LifecycleQueuePopulator.spec.js index 16d3a55d8..50355b41c 100644 --- a/tests/unit/lifecycle/LifecycleQueuePopulator.spec.js +++ b/tests/unit/lifecycle/LifecycleQueuePopulator.spec.js @@ -3,7 +3,7 @@ const sinon = require('sinon'); const werelogs = require('werelogs'); const { encode } = require('arsenal').versioning.VersionID; -const config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const { coldStorageRestoreAdjustTopicPrefix, coldStorageRestoreTopicPrefix, diff --git a/tests/unit/management/patchConfiguration.js b/tests/unit/management/patchConfiguration.js index b396ddf6c..d3cd7ee84 100644 --- a/tests/unit/management/patchConfiguration.js +++ b/tests/unit/management/patchConfiguration.js @@ -5,7 +5,7 @@ const BucketInfo = require('arsenal').models.BucketInfo; const { patchConfiguration } = require('../../../lib/management/patchConfiguration'); -const Config = require('../../../lib/Config'); +const { config } = require('../../../lib/Config'); const testConfig = require('../../config.json'); const fakeLogger = require('../../utils/fakeLogger'); @@ -109,8 +109,8 @@ describe('patchConfiguration', () => { beforeEach(() => { // empty configs - Config.setBootstrapList({}); - Config.setIngestionBuckets({}, []); + config.setBootstrapList({}); + config.setIngestionBuckets({}, []); }); after(() => { @@ -129,8 +129,8 @@ describe('patchConfiguration', () => { (err, version) => { assert.ifError(err); - const bootstrapList = Config.getBootstrapList(); - const ingestionBuckets = Config.getIngestionBuckets(); + const bootstrapList = config.getBootstrapList(); + const ingestionBuckets = config.getIngestionBuckets(); assert(version === undefined); assert.strictEqual(bootstrapList.length, 0); assert.strictEqual(ingestionBuckets.length, 0); @@ -156,7 +156,7 @@ describe('patchConfiguration', () => { fakeLogger, err => { assert.ifError(err); - const bootstrapList = Config.getBootstrapList(); + const bootstrapList = config.getBootstrapList(); const scalityLocationName = Object.keys(configOverlay.locations) .find(l => (configOverlay.locations[l].locationType === 'location-file-v1')); @@ -177,7 +177,7 @@ describe('patchConfiguration', () => { (err, version) => { assert.ifError(err); - const bootstrapList = Config.getBootstrapList(); + const bootstrapList = config.getBootstrapList(); assert.strictEqual(version, undefined); assert.strictEqual(bootstrapList.length, 0); done(); @@ -191,7 +191,7 @@ describe('patchConfiguration', () => { fakeLogger, err => { assert.ifError(err); - const bootstrapList = Config.getBootstrapList(); + const bootstrapList = config.getBootstrapList(); assert.strictEqual(bootstrapList.length, expectedLocations.length); expectedLocations.forEach(location => { assert(bootstrapList.find(l => l.site === location)); @@ -206,7 +206,7 @@ describe('patchConfiguration', () => { fakeLogger, err => { assert.ifError(err); - const bootstrapList = Config.getBootstrapList(); + const bootstrapList = config.getBootstrapList(); bootstrapList.forEach(location => { assert(location.site); assert(location.type); @@ -233,7 +233,7 @@ describe('patchConfiguration', () => { it('should patch ingestion buckets config with an old overlay version', done => { - let ingestionBuckets = Config.getIngestionBuckets(); + let ingestionBuckets = config.getIngestionBuckets(); assert.strictEqual(ingestionBuckets.length, 0); const prevOverlayVersion = PATCH_VERSION + 1; @@ -241,7 +241,7 @@ describe('patchConfiguration', () => { fakeLogger, (err, version) => { assert.ifError(err); - ingestionBuckets = Config.getIngestionBuckets(); + ingestionBuckets = config.getIngestionBuckets(); assert(version === undefined); assert.strictEqual(ingestionBuckets.length, 1); expectedIngestionBuckets.forEach(bucket => { @@ -258,7 +258,7 @@ describe('patchConfiguration', () => { patchConfiguration(overlayVersion, configOverlay, this.md, true, fakeLogger, err => { assert.ifError(err); - const ingestionBuckets = Config.getIngestionBuckets(); + const ingestionBuckets = config.getIngestionBuckets(); expectedIngestionBuckets.forEach(bucket => { assert( ingestionBuckets.find(b => b.zenkoBucket === bucket.getName()) @@ -279,12 +279,12 @@ describe('patchConfiguration', () => { err => { assert.ifError(err); - const ingestionBuckets = Config.getIngestionBuckets(); + const ingestionBuckets = config.getIngestionBuckets(); assert.strictEqual(ingestionBuckets.length, 0); // should update bootstrapList given overlay version has been // updated - const bootstrapList = Config.getBootstrapList(); + const bootstrapList = config.getBootstrapList(); assert(bootstrapList.length > 0); done(); @@ -298,7 +298,7 @@ describe('patchConfiguration', () => { fakeLogger, err => { assert.ifError(err); - const ingestionBuckets = Config.getIngestionBuckets(); + const ingestionBuckets = config.getIngestionBuckets(); ingestionBuckets.forEach(bucket => { assert(bucket.credentials.accessKey); diff --git a/tests/utils/mockIngestionSite.js b/tests/utils/mockIngestionSite.js index 5e7c2dcd7..c2b19c366 100644 --- a/tests/utils/mockIngestionSite.js +++ b/tests/utils/mockIngestionSite.js @@ -1,4 +1,4 @@ -const config = require('../../lib/Config'); +const { config } = require('../../lib/Config'); /** * Mock the setting of ingestion buckets. We use the existing bootstrap list