From c1f584cd3ec8f7375b3f875ad97c587c79e63372 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 2 Jul 2015 13:03:53 -0700 Subject: [PATCH] added snapshot paths to the esvm config --- .gitignore | 1 + grunt/config/esvm.js | 107 +++++++++++++++++++++---------------------- grunt/utils.js | 2 +- package.json | 4 +- scripts/jenkins.sh | 2 +- 5 files changed, 56 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index 236628c75..ab6832d54 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ test/integration/yaml_suite/log .aws-config.json .idea .esvm +.es-snapshot-repos ## generated files test/integration/yaml_suite/yaml_tests*.json diff --git a/grunt/config/esvm.js b/grunt/config/esvm.js index bcda6fef2..c118e45af 100644 --- a/grunt/config/esvm.js +++ b/grunt/config/esvm.js @@ -1,67 +1,58 @@ var utils = require('../utils'); -var _ = require('lodash'); -var join = require('path').join; +var fromRoot = require('path').join.bind(null, __dirname, '..', '..'); var Version = require('../../scripts/Version'); - -var defaultOpts = { - directory: join(__dirname, '..', '..', '.esvm'), - nodes: 1, - quiet: false, - config: { - 'node.name': 'elasticsearch_js_test_runner', - 'cluster.name': 'elasticsearch_js_test_runners', - 'http.port': 9400, - 'network.host': 'localhost', - 'discovery.zen.ping_timeout': 1, - 'discovery.zen.ping.multicast.enabled': false - } -}; - -/** - * set config vars based on the ref. - * - * @param {string} ref - either a tag or branch name - * @param {[type]} target - the grunt target to configure - */ -function setConfig(ref, target) { - var v = Version.fromBranch(String(ref).replace(/^v/, '').replace(/(\d+\.\d+)\..+/, '$1')); - var config = target.options.config = (target.options.config || {}); - - if (v.satisfies('^1.2')) { - _.merge(config, { +var opts = [ + { + version: '*', + directory: fromRoot('.esvm'), + nodes: 1, + quiet: false, + config: { + 'node.name': 'elasticsearch_js_test_runner', + 'cluster.name': 'elasticsearch_js_test_runners', + 'http.port': 9400, + 'network.host': 'localhost', + 'discovery.zen.ping.multicast.enabled': false + } + }, + { + version: '<1.6', + config: { + 'discovery.zen.ping_timeout': 1 + } + }, + { + version: '^1.2 <1.6', + config: { 'node.bench': true, 'script.disable_dynamic': false - }); - } - - if (v.satisfies('>=1.6')) { - _.merge(config, { + } + }, + { + version: '>=1.6', + config: { 'node.bench': true, 'script.inline': true, 'script.indexed': true - }); + } + }, + { + version: '>=2.0', + config: { + 'path.repo': process.env.ES_PATH_REPO || fromRoot('.es-snapshot-repos') + } } - - _.defaultsDeep(target.options, defaultOpts); - - if (v.satisfies('>=1.6')) { - delete config['discovery.zen.ping_timeout']; - } - - if (target.options.branch && !target.options.version) { - target.options.fresh = true; - } -} +]; // targets for each branch utils.branches.forEach(function (branch) { exports[branch] = { - options: { - branch: branch - } + options: Version.fromBranch(branch).mergeOpts(opts, { + branch: branch, + fresh: true + }) }; - setConfig(branch, exports[branch]); }); @@ -71,23 +62,27 @@ utils.branches.forEach(function (branch) { var ref = process.env.ES_REF; var port = process.env.ES_PORT; - var options = { + var v; + var defaults = { config: { 'http.port': port || 9200 } }; if (release) { - options.version = release; + v = new Version(String(release).replace(/^v/, '')); + defaults.version = v.version; } else if (ref) { - // assume it is a ref to a branch - options.branch = ref; + v = new Version.fromBranch(String(ref).replace(/v?(\d+\.\d+)\..+/, '$1')); + defaults.branch = ref; + defaults.fresh = true; } else { return; } - exports.ci_env = { options: options }; - setConfig(ref, exports.ci_env); + exports.ci_env = { + options: v.mergeOpts(opts, defaults) + }; }()); \ No newline at end of file diff --git a/grunt/utils.js b/grunt/utils.js index c71b88857..0a8e8413f 100644 --- a/grunt/utils.js +++ b/grunt/utils.js @@ -9,7 +9,7 @@ var utils = { branchSuffix: function (branch) { return branch === utils.branches._default ? '' : '_' + _.snakeCase(branch); }, - branches: [].concat(stable, unstable), + branches: [].concat(unstable, stable), stableBranches: stable, unstableBranches: unstable }; diff --git a/package.json b/package.json index e98c17a9f..255ccbc08 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-watch": "~0.5.3", "grunt-esvm": "^1.1.0", - "grunt-mocha-cov": "~0.2.0", + "grunt-mocha-cov": "^0.4.0", "grunt-open": "~0.2.2", "grunt-prompt": "~0.1.2", "grunt-run": "~0.2.2", @@ -79,7 +79,7 @@ "through2-map": "~1.4.0", "xmlbuilder": "~0.4.3" }, - "license": "Apache 2.0", + "license": "Apache-2.0", "dependencies": { "bluebird": "^2.9.14", "chalk": "^1.0.0", diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 0d0124d8a..3642e5000 100644 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -64,4 +64,4 @@ install_node "$NODE_V" npm install release_lock -ES_PORT=$((9400 + EXECUTOR_NUMBER)) RUN=NODE_UNIT,NODE_INTEGRATION VERBOSE=true node ./scripts/ci.js \ No newline at end of file +ES_PATH_REPO="./.es-snapshot-repos/$EXECUTOR_NUMBER/" ES_PORT=$((9400 + EXECUTOR_NUMBER)) RUN=NODE_UNIT,NODE_INTEGRATION VERBOSE=true node ./scripts/ci.js \ No newline at end of file