@@ -105,14 +105,13 @@ describe("Monitor test", () => {
105
105
const res = await logic_client . workflows . createOrUpdate ( resourceGroup , workflowName , {
106
106
location : location ,
107
107
definition : {
108
- $schema :
109
- "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#" ,
110
- contentVersion : "1.0.0.0" ,
111
- parameters : { } ,
112
- triggers : { } ,
113
- actions : { } ,
114
- outputs : { } ,
115
- } ,
108
+ "$schema" : "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#" ,
109
+ "contentVersion" : "1.0.0.0" ,
110
+ "parameters" : { } ,
111
+ "triggers" : { } ,
112
+ "actions" : { } ,
113
+ "outputs" : { }
114
+ }
116
115
} ) ;
117
116
workflowsId = ( res . id || "/" ) . substring ( 1 ) ;
118
117
@@ -149,6 +148,17 @@ describe("Monitor test", () => {
149
148
storageId = storageaccount . id || "" ;
150
149
151
150
// namespaces.beginCreateOrUpdateAndWait
151
+ await eventhub_client . namespaces . beginCreateOrUpdateAndWait ( resourceGroup , namespaceName , {
152
+ sku : {
153
+ name : "Standard" ,
154
+ tier : "Standard" ,
155
+ } ,
156
+ location : location ,
157
+ tags : {
158
+ tag1 : "value1" ,
159
+ tag2 : "value2" ,
160
+ }
161
+ } , testPollingOptions )
152
162
// namespaces.createOrUpdateAuthorizationRule
153
163
const authorization = await eventhub_client . namespaces . createOrUpdateAuthorizationRule (
154
164
resourceGroup ,
@@ -179,23 +189,29 @@ describe("Monitor test", () => {
179
189
// skip this case as no data plane write permissions
180
190
it . skip ( "eventhub create test" , async ( ) => {
181
191
// eventHubs.createOrUpdate
182
- } ) ;
192
+ await eventhub_client . eventHubs . createOrUpdate ( resourceGroup , namespaceName , eventhubName , {
193
+ messageRetentionInDays : 4 ,
194
+ partitionCount : 4 ,
195
+ status : "Active" ,
196
+ captureDescription : {
197
+ enabled : true ,
198
+ encoding : "Avro" ,
199
+ intervalInSeconds : 120 ,
200
+ sizeLimitInBytes : 10485763 ,
201
+ destination : {
202
+ name : "EventHubArchive.AzureBlockBlob" ,
203
+ storageAccountResourceId : "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Storage/storageAccounts/" + storageAccountName ,
204
+ blobContainer : "container" ,
205
+ archiveNameFormat : "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}" ,
206
+ }
207
+ }
208
+ } ) ;
209
+ } )
183
210
184
211
it ( "diagnosticSettings create test" , async ( ) => {
185
- workflowsId = (
186
- ( await logic_client . workflows . get ( resourceGroup , workflowName ) ) . id || "/"
187
- ) . substring ( 1 ) ;
188
- storageId =
189
- ( await storage_client . storageAccounts . getProperties ( resourceGroup , storageAccountName ) ) . id ||
190
- "" ;
191
- authorizationId =
192
- (
193
- await eventhub_client . namespaces . getAuthorizationRule (
194
- resourceGroup ,
195
- namespaceName ,
196
- authorizationRuleName ,
197
- )
198
- ) . id || "" ;
212
+ workflowsId = ( ( await logic_client . workflows . get ( resourceGroup , workflowName ) ) . id || "/" ) . substring ( 1 )
213
+ storageId = ( await storage_client . storageAccounts . getProperties ( resourceGroup , storageAccountName ) ) . id || "" ;
214
+ authorizationId = ( await eventhub_client . namespaces . getAuthorizationRule ( resourceGroup , namespaceName , authorizationRuleName ) ) . id || "" ;
199
215
workspaceId = ( await op_client . workspaces . get ( resourceGroup , workspaceName ) ) . id || "" ;
200
216
const res = await client . diagnosticSettings . createOrUpdate ( workflowsId , diagnosticName , {
201
217
storageAccountId : storageId ,
@@ -209,11 +225,11 @@ describe("Monitor test", () => {
209
225
enabled : true ,
210
226
retentionPolicy : {
211
227
enabled : false ,
212
- days : 0 ,
213
- } ,
214
- } ,
215
- ] ,
216
- } ) ;
228
+ days : 0
229
+ }
230
+ }
231
+ ]
232
+ } )
217
233
assert . equal ( res . name , diagnosticName ) ;
218
234
} ) ;
219
235
@@ -222,29 +238,41 @@ describe("Monitor test", () => {
222
238
assert . equal ( res . name , diagnosticName ) ;
223
239
} ) ;
224
240
225
- it ( "diagnosticSettings list test" , async ( ) => { } ) ;
241
+ it ( "diagnosticSettings list test" , async ( ) => {
242
+ const res = await client . diagnosticSettings . list ( workflowsId ) ;
243
+ assert . ok ( res ) ;
244
+ } ) ;
226
245
227
- it ( "diagnosticSettings delete test" , async ( ) => { } ) ;
246
+ it ( "diagnosticSettings delete test" , async ( ) => {
247
+ const res = await client . diagnosticSettings . delete ( workflowsId , diagnosticName ) ;
248
+ assert . ok ( res ) ;
249
+ } ) ;
228
250
229
251
it ( "logProfiles create test" , async ( ) => {
230
- // delete sample logfile
252
+ //delete sample logfile
231
253
const resArray = new Array ( ) ;
232
254
for await ( const item of client . logProfiles . list ( ) ) {
233
255
resArray . push ( item ) ;
234
256
}
235
257
if ( resArray . length >= 1 ) {
236
- await client . logProfiles . delete ( "sample-log-profile" ) ;
258
+ await client . logProfiles . delete ( "sample-log-profile" )
237
259
}
238
260
const res = await client . logProfiles . createOrUpdate ( logProfileName , {
239
261
location : "" ,
240
- locations : [ "global" ] ,
241
- categories : [ "Write" , "Delete" , "Action" ] ,
262
+ locations : [
263
+ "global"
264
+ ] ,
265
+ categories : [
266
+ "Write" ,
267
+ "Delete" ,
268
+ "Action"
269
+ ] ,
242
270
retentionPolicy : {
243
271
enabled : true ,
244
- days : 3 ,
272
+ days : 3
245
273
} ,
246
- storageAccountId : storageId ,
247
- } ) ;
274
+ storageAccountId : storageId
275
+ } )
248
276
assert . equal ( res . name , logProfileName ) ;
249
277
} ) ;
250
278
@@ -266,9 +294,8 @@ describe("Monitor test", () => {
266
294
resourceGroup ,
267
295
azureMonitorWorkspaceName ,
268
296
{
269
- location,
270
- } ,
271
- ) ;
297
+ location
298
+ } ) ;
272
299
assert . equal ( res . name , azureMonitorWorkspaceName ) ;
273
300
} ) ;
274
301
@@ -287,23 +314,44 @@ describe("Monitor test", () => {
287
314
288
315
it ( "workspace delete test" , async ( ) => {
289
316
const resArray = new Array ( ) ;
317
+ await client . azureMonitorWorkspaces . beginDeleteAndWait ( resourceGroup , azureMonitorWorkspaceName ) ;
290
318
for await ( const item of client . azureMonitorWorkspaces . listByResourceGroup ( resourceGroup ) ) {
291
319
resArray . push ( item ) ;
292
320
}
293
321
assert . equal ( resArray . length , 0 ) ;
294
322
} ) ;
295
323
296
- it ( "metric listAtSubscriptionScope test" , async ( ) => { } ) ;
324
+ it ( "metric listAtSubscriptionScope test" , async ( ) => {
325
+ await client . metricsOperations . listAtSubscriptionScope (
326
+ location ,
327
+ {
328
+ metricnamespace : "microsoft.compute/virtualmachines"
329
+ }
330
+ ) ;
331
+ } ) ;
297
332
298
- it ( "metric list test" , async ( ) => { } ) ;
333
+ it ( "metric list test" , async ( ) => {
334
+ await client . metricsOperations . list (
335
+ "subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Storage/storageAccounts/" + storageAccountName + "/blobServices/default" ,
336
+ {
337
+ metricnamespace : "Microsoft.Storage/storageAccounts/blobServices"
338
+ }
339
+ ) ;
340
+ } ) ;
299
341
300
- it ( "delete parameters for diagnosticSettings" , async ( ) => { } ) ;
342
+ it ( "delete parameters for diagnosticSettings" , async ( ) => {
343
+ await logic_client . workflows . delete ( resourceGroup , workflowName ) ;
344
+ await storage_client . storageAccounts . delete ( resourceGroup , storageAccountName ) ;
345
+ await eventhub_client . namespaces . beginDeleteAndWait ( resourceGroup , namespaceName , testPollingOptions ) ;
346
+ await op_client . workspaces . beginDeleteAndWait ( resourceGroup , workspaceName , testPollingOptions ) ;
347
+ } ) ;
301
348
302
349
it ( "logProfiles delete test" , async ( ) => {
350
+ await client . logProfiles . delete ( logProfileName ) ;
303
351
const resArray = new Array ( ) ;
304
352
for await ( const item of client . logProfiles . list ( ) ) {
305
353
resArray . push ( item ) ;
306
354
}
307
- assert . equal ( resArray . length , 1 ) ; // still exist sample logfile
355
+ assert . equal ( resArray . length , 1 ) ; // still exist sample logfile
308
356
} ) ;
309
357
} ) ;
0 commit comments