@@ -38,21 +38,19 @@ function build (opts = {}) {
3838 * @returns {Promise }
3939 */
4040 async function cleanup ( ) {
41- // // tap.comment('Cleanup')
42-
4341 response = null
4442 stash . clear ( )
4543
4644 try {
47- await client . indices . delete ( { index : '_all' } , { ignore : 404 } )
45+ await client . indices . deleteAlias ( { index : '_all' , name : '_all' } , { ignore : 404 } )
4846 } catch ( err ) {
49- assert . ifError ( err , 'should not error: indices.delete ' )
47+ assert . ifError ( err , 'should not error: indices.deleteAlias ' )
5048 }
5149
5250 try {
53- await client . indices . deleteAlias ( { index : '_all' , name : '_all' } , { ignore : 404 } )
51+ await client . indices . delete ( { index : '_all' } , { ignore : 404 } )
5452 } catch ( err ) {
55- assert . ifError ( err , 'should not error: indices.deleteAlias ' )
53+ assert . ifError ( err , 'should not error: indices.delete ' )
5654 }
5755
5856 try {
@@ -91,7 +89,7 @@ function build (opts = {}) {
9189
9290 try {
9391 const { body } = await client . security . getRole ( )
94- const roles = Object . keys ( body ) . filter ( n => helper . esDefaultRoles . indexOf ( n ) === - 1 )
92+ const roles = Object . keys ( body ) . filter ( n => ! body [ n ] . metadata . _reserved )
9593 await helper . runInParallel (
9694 client , 'security.deleteRole' ,
9795 roles . map ( r => ( { name : r } ) )
@@ -102,7 +100,7 @@ function build (opts = {}) {
102100
103101 try {
104102 const { body } = await client . security . getUser ( )
105- const users = Object . keys ( body ) . filter ( n => helper . esDefaultUsers . indexOf ( n ) === - 1 )
103+ const users = Object . keys ( body ) . filter ( n => ! body [ n ] . metadata . _reserved )
106104 await helper . runInParallel (
107105 client , 'security.deleteUser' ,
108106 users . map ( r => ( { username : r } ) )
@@ -836,19 +834,22 @@ function shouldSkip (esVersion, action) {
836834 // skip based on the version
837835 if ( action . version ) {
838836 if ( action . version . trim ( ) === 'all' ) return true
839- const [ min , max ] = action . version . split ( '-' ) . map ( v => v . trim ( ) )
840- // if both `min` and `max` are specified
841- if ( min && max ) {
842- shouldSkip = semver . satisfies ( esVersion , action . version )
843- // if only `min` is specified
844- } else if ( min ) {
845- shouldSkip = semver . gte ( esVersion , min )
846- // if only `max` is specified
847- } else if ( max ) {
848- shouldSkip = semver . lte ( esVersion , max )
849- // something went wrong!
850- } else {
851- throw new Error ( `skip: Bad version range: ${ action . version } ` )
837+ const versions = action . version . split ( ',' ) . filter ( Boolean )
838+ for ( const version of versions ) {
839+ const [ min , max ] = version . split ( '-' ) . map ( v => v . trim ( ) )
840+ // if both `min` and `max` are specified
841+ if ( min && max ) {
842+ shouldSkip = semver . satisfies ( esVersion , action . version )
843+ // if only `min` is specified
844+ } else if ( min ) {
845+ shouldSkip = semver . gte ( esVersion , min )
846+ // if only `max` is specified
847+ } else if ( max ) {
848+ shouldSkip = semver . lte ( esVersion , max )
849+ // something went wrong!
850+ } else {
851+ throw new Error ( `skip: Bad version range: ${ action . version } ` )
852+ }
852853 }
853854 }
854855
0 commit comments