elastictest
Advanced tools
Comparing version 2.0.0 to 3.0.0
var randomstring = require('randomstring'), | ||
elasticsearch = require('elasticsearch'), | ||
async = require('async'); | ||
const _ = require('lodash'); | ||
const randomstring = require('randomstring'); | ||
const elasticsearch = require('elasticsearch'); | ||
const async = require('async'); | ||
@@ -15,3 +16,3 @@ function Suite( clientOpts, props ){ | ||
this.props = props || {}; | ||
if( !this.props.hasOwnProperty('index') ){ | ||
if( !_.has(this, 'props.index') ){ | ||
this.props.index = 'testindex-' + randomstring.generate(7).toLowerCase(); | ||
@@ -35,4 +36,4 @@ } | ||
Suite.prototype.create = function( cb ){ | ||
var cmd = { index: this.props.index }; | ||
if( this.props.hasOwnProperty('schema') ){ | ||
var cmd = _.merge(this.props.create, { index: this.props.index }); | ||
if( _.has(this, 'props.schema') ){ | ||
cmd.body = this.props.schema; | ||
@@ -44,3 +45,3 @@ } | ||
Suite.prototype.delete = function( cb ){ | ||
var cmd = { index: this.props.index }; | ||
var cmd = _.merge(this.props.delete, { index: this.props.index }); | ||
this.client.indices.delete( cmd, cb ); | ||
@@ -50,3 +51,3 @@ }; | ||
Suite.prototype.refresh = function( cb ){ | ||
var cmd = { index: this.props.index }; | ||
var cmd = _.merge(this.props.refresh, { index: this.props.index }); | ||
this.client.indices.refresh( cmd, cb ); | ||
@@ -73,18 +74,18 @@ }; | ||
var self = this; | ||
self.start( function( err ){ | ||
self.start( err => { | ||
if( err ){ throw new Error( err ); } | ||
self.waitForStatus( 'yellow', function( err ){ | ||
self.waitForStatus( 'yellow', err => { | ||
if( err ){ throw new Error( err ); } | ||
self.create( function( err ){ | ||
self.create( err => { | ||
if( err ){ throw new Error( err ); } | ||
async.series( self.actions, function( err ){ | ||
async.series( self.actions, err => { | ||
if( err ){ throw new Error( err ); } | ||
self.refresh( function( err ){ | ||
self.refresh( err => { | ||
if( err ){ throw new Error( err ); } | ||
self.optimize( async.series( self.asserts, function( err ){ | ||
self.optimize( async.series( self.asserts, err => { | ||
if( err ){ throw new Error( err ); } | ||
self.delete( function( err ){ | ||
self.delete( err => { | ||
if( err ){ throw new Error( err ); } | ||
self.client.close(); | ||
if( 'function' === typeof cb ){ | ||
if( _.isFunction( cb ) ){ | ||
cb(); | ||
@@ -91,0 +92,0 @@ } |
{ | ||
"name": "elastictest", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "A simple test harness for elasticsearch functional testing", | ||
@@ -29,6 +29,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "^2.6.1", | ||
"elasticsearch": "^15.1.1", | ||
"async": "^3.1.0", | ||
"elasticsearch": "^16.5.0", | ||
"lodash": "^4.17.15", | ||
"randomstring": "^1.1.5" | ||
} | ||
} |
@@ -8,3 +8,3 @@ | ||
settings: { index: { refresh_interval: '-1' } }, | ||
mappings: { mytype: { properties: { name: { type: 'long' } } } } | ||
mappings: { _doc: { properties: { name: { type: 'long' } } } } | ||
}; | ||
@@ -23,3 +23,3 @@ | ||
index: suite.props.index, | ||
type: 'mytype' | ||
type: '_doc' | ||
}, function( err, res ){ | ||
@@ -26,0 +26,0 @@ t.deepEqual( res[suite.props.index].mappings, custom_schema.mappings, 'mappings set' ); |
@@ -14,3 +14,3 @@ | ||
index: suite.props.index, | ||
type: 'mytype', | ||
type: '_doc', | ||
id: '1', | ||
@@ -17,0 +17,0 @@ body: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11728
223
4
+ Addedlodash@^4.17.15
+ Addedasync@3.2.6(transitive)
+ Addedelasticsearch@16.7.3(transitive)
- Removedasync@2.6.4(transitive)
- Removedelasticsearch@15.5.0(transitive)
Updatedasync@^3.1.0
Updatedelasticsearch@^16.5.0