@@ -38,21 +38,19 @@ function build (opts = {}) {
38
38
* @returns {Promise }
39
39
*/
40
40
async function cleanup ( ) {
41
- // // tap.comment('Cleanup')
42
-
43
41
response = null
44
42
stash . clear ( )
45
43
46
44
try {
47
- await client . indices . delete ( { index : '_all' } , { ignore : 404 } )
45
+ await client . indices . deleteAlias ( { index : '_all' , name : '_all' } , { ignore : 404 } )
48
46
} catch ( err ) {
49
- assert . ifError ( err , 'should not error: indices.delete ' )
47
+ assert . ifError ( err , 'should not error: indices.deleteAlias ' )
50
48
}
51
49
52
50
try {
53
- await client . indices . deleteAlias ( { index : '_all' , name : '_all' } , { ignore : 404 } )
51
+ await client . indices . delete ( { index : '_all' } , { ignore : 404 } )
54
52
} catch ( err ) {
55
- assert . ifError ( err , 'should not error: indices.deleteAlias ' )
53
+ assert . ifError ( err , 'should not error: indices.delete ' )
56
54
}
57
55
58
56
try {
@@ -91,7 +89,7 @@ function build (opts = {}) {
91
89
92
90
try {
93
91
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 )
95
93
await helper . runInParallel (
96
94
client , 'security.deleteRole' ,
97
95
roles . map ( r => ( { name : r } ) )
@@ -102,7 +100,7 @@ function build (opts = {}) {
102
100
103
101
try {
104
102
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 )
106
104
await helper . runInParallel (
107
105
client , 'security.deleteUser' ,
108
106
users . map ( r => ( { username : r } ) )
@@ -836,19 +834,22 @@ function shouldSkip (esVersion, action) {
836
834
// skip based on the version
837
835
if ( action . version ) {
838
836
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
+ }
852
853
}
853
854
}
854
855
0 commit comments