1
1
const jmespath = require ( "jmespath" ) ;
2
- const { Before, Given, Then } = require ( "@cucumber/cucumber" ) ;
2
+ const { After, Before, Given, Then } = require ( "@cucumber/cucumber" ) ;
3
+
4
+ const dbsgNames = [ ] ;
3
5
4
6
Before ( { tags : "@rds" } , function ( scenario , callback ) {
5
7
const { RDS } = require ( "../../../clients/client-rds" ) ;
6
8
this . service = new RDS ( { } ) ;
7
9
callback ( ) ;
8
10
} ) ;
9
11
12
+ After ( { tags : "@rds" } , async function ( ) {
13
+ while ( dbsgNames . length ) {
14
+ const name = dbsgNames . pop ( ) ;
15
+ if ( name ) {
16
+ await this . service . deleteDBSecurityGroup ( {
17
+ DBSecurityGroupName : name ,
18
+ } ) ;
19
+ }
20
+ }
21
+ } ) ;
22
+
10
23
Given ( "I create a RDS security group with prefix name {string}" , function ( prefix , callback ) {
11
24
this . dbGroupName = this . uniqueName ( prefix ) ;
25
+ dbsgNames . push ( this . dbGroupName ) ;
12
26
const params = {
13
27
DBSecurityGroupDescription : "Description" ,
14
28
DBSecurityGroupName : this . dbGroupName ,
@@ -24,7 +38,10 @@ Then("the value at {string} should contain {string} with {string}", function (pa
24
38
containDefault = true ;
25
39
}
26
40
} ) ;
27
- this . assert . ok ( containDefault === true , `No ${ path } has member key ${ key } of the value ${ value } ` ) ;
41
+ this . assert . ok (
42
+ containDefault === true ,
43
+ `No ${ path } has member key ${ key } of the value ${ value } : ${ JSON . stringify ( this . data , null , 2 ) } `
44
+ ) ;
28
45
callback ( ) ;
29
46
} ) ;
30
47
0 commit comments