From ad3c41b5693b4f0b2a151e9c3221551e24f8264d Mon Sep 17 00:00:00 2001 From: ilanap Date: Wed, 25 Apr 2018 13:39:19 +0300 Subject: Fix for BDD multiple servers Change-Id: Ibfc9813e471d4ac2509ee5e62828a07661cc704e Issue-ID: SDC-1262 Signed-off-by: ilanap --- openecomp-bdd/stepDefinitions/world.js | 36 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'openecomp-bdd/stepDefinitions/world.js') diff --git a/openecomp-bdd/stepDefinitions/world.js b/openecomp-bdd/stepDefinitions/world.js index 75f93afb89..0ffcc8e39c 100644 --- a/openecomp-bdd/stepDefinitions/world.js +++ b/openecomp-bdd/stepDefinitions/world.js @@ -14,13 +14,24 @@ * limitations under the License. */ const { setWorldConstructor } = require('cucumber'); -const config = require('../config.json'); -let localDevConfig = {}; +const _ = require('lodash'); + +let config = require('../config.json'); +let localConfig = {}; try { - localDevConfig = require('../devConfig.json'); -} catch (e) {} + localConfig = require('../devConfig.json'); +} catch (e) { + try { + localConfig = require('../jenkinsConfig.json'); + } catch (e) { + console.error("no env configuration was found!"); + } +} + +config = _.merge(config, localConfig); var {setDefaultTimeout} = require('cucumber'); + /** * @module Context * @description Context that is used per feature file and can be accessed as 'this.context' in all steps.
@@ -38,15 +49,12 @@ class CustomWorld { constructor(options) { this.context = {}; this.context.headers = {}; - if (localDevConfig.user) { - this.context.headers['USER_ID'] = localDevConfig.user; - } else { - this.context.headers['USER_ID'] = process.env.USER; - } - if (localDevConfig.server) { - this.context.server = localDevConfig.server; - } else { - this.context.server = process.env.SERVER; + let typeName; + for (typeName in config) { + this.context.headers[typeName] = {}; + if (config[typeName].user) { + this.context.headers[typeName]['USER_ID'] = config[typeName].user; + } } this.context.vlm = {id: null, versionId: null}; @@ -69,7 +77,7 @@ class CustomWorld { return function(type) { let typeData = _config[type]; let _url = _config.protocol + '://' + - _server + ':' + + typeData.server + ':' + typeData.port + '/' + typeData.prefix; return _url; -- cgit 1.2.3-korg