@@ -36,37 +36,51 @@ describe('Client with Notifications', async () => {
36
36
before ( async ( ) => {
37
37
const client = new SecurityCenterClient ( ) ;
38
38
async function createNotificationConfig ( configId ) {
39
- /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_" }]*/
40
- const [ _response ] = await client . createNotificationConfig ( {
41
- parent : orgName ,
42
- configId : configId ,
43
- notificationConfig : {
44
- description : 'Sample config for node.js' ,
45
- pubsubTopic : pubsubTopic ,
46
- streamingConfig : { filter : 'state = "ACTIVE"' } ,
47
- } ,
48
- } ) ;
39
+ try {
40
+ /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_" }]*/
41
+ const [ _response ] = await client . createNotificationConfig ( {
42
+ parent : orgName ,
43
+ configId : configId ,
44
+ notificationConfig : {
45
+ description : 'Sample config for node.js' ,
46
+ pubsubTopic : pubsubTopic ,
47
+ streamingConfig : { filter : 'state = "ACTIVE"' } ,
48
+ } ,
49
+ } ) ;
50
+ } catch ( err ) {
51
+ console . error ( `Error creating config ${ configId } :` , err . message ) ;
52
+ }
49
53
}
50
54
51
55
await createNotificationConfig ( deleteConfig ) ;
56
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
52
57
await createNotificationConfig ( getConfig ) ;
58
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
53
59
await createNotificationConfig ( listConfig ) ;
60
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
54
61
await createNotificationConfig ( updateConfig ) ;
55
62
} ) ;
56
63
57
64
after ( async ( ) => {
58
65
const client = new SecurityCenterClient ( ) ;
59
66
async function deleteNotificationConfig ( configId ) {
60
- const name = client . organizationNotificationConfigPath (
61
- organizationId ,
62
- configId
63
- ) ;
64
- await client . deleteNotificationConfig ( { name : name } ) ;
67
+ try {
68
+ const name = client . organizationNotificationConfigPath (
69
+ organizationId ,
70
+ configId
71
+ ) ;
72
+ await client . deleteNotificationConfig ( { name : name } ) ;
73
+ } catch ( err ) {
74
+ console . error ( `Error deleting config ${ configId } :` , err . message ) ;
75
+ }
65
76
}
66
77
67
78
await deleteNotificationConfig ( createConfig ) ;
79
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
68
80
await deleteNotificationConfig ( getConfig ) ;
81
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
69
82
await deleteNotificationConfig ( listConfig ) ;
83
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // 1-second delay
70
84
await deleteNotificationConfig ( updateConfig ) ;
71
85
} ) ;
72
86
0 commit comments