14
14
15
15
function get_all_vm_locations
16
16
{
17
- $st = Write-Output ' Getting all Azure location - Start' ;
17
+ $st = Write-Verbose ' Getting all Azure location - Start' ;
18
18
19
19
$locations = Get-AzureLocation | where { $_.Name -like ' Microsoft.Compute/virtualMachines' } | select - ExpandProperty Locations;
20
20
21
- $st = Write-Output ' Getting all Azure location - End' ;
21
+ $st = Write-Verbose ' Getting all Azure location - End' ;
22
22
23
23
return $locations ;
24
24
}
@@ -27,11 +27,11 @@ function get_all_standard_vm_sizes
27
27
{
28
28
param ([string ] $location )
29
29
30
- $st = Write-Output " Getting all VM sizes in location '${location} ' - Start" ;
30
+ $st = Write-Verbose " Getting all VM sizes in location '${location} ' - Start" ;
31
31
32
32
$vmsizes = Get-AzureVMSize - Location $location | where { $_.Name -like ' Standard_A*' -and $_.NumberOfCores -le 4 } | select - ExpandProperty Name;
33
33
34
- $st = Write-Output " Getting all VM sizes in location [${location} ] - End" ;
34
+ $st = Write-Verbose " Getting all VM sizes in location [${location} ] - End" ;
35
35
36
36
return $vmsizes ;
37
37
}
@@ -41,7 +41,7 @@ function get_hash_int_value
41
41
# Reference: http://www.cse.yorku.ca/~oz/hash.html
42
42
param ([string ] $seedstr )
43
43
44
- $st = Write-Output " Computing hash for '${seedstr} ' - Start" ;
44
+ $st = Write-Verbose " Computing hash for '${seedstr} ' - Start" ;
45
45
46
46
if ($seedstr -eq $null ) { $seedstr = ' ' ; }
47
47
@@ -52,9 +52,9 @@ function get_hash_int_value
52
52
$hash = ((($hash -shl 5 ) + $hash ) + $c ) % [System.Int32 ]::MaxValue;
53
53
}
54
54
55
- $st = Write-Output " Computing hash for '${seedstr} ' - `$ hash = ${hash} " ;
55
+ $st = Write-Verbose " Computing hash for '${seedstr} ' - `$ hash = ${hash} " ;
56
56
57
- $st = Write-Output " Computing hash for '${seedstr} ' - End" ;
57
+ $st = Write-Verbose " Computing hash for '${seedstr} ' - End" ;
58
58
59
59
return $hash ;
60
60
}
@@ -89,12 +89,12 @@ function get_vm_config_object
89
89
{
90
90
param ([string] $rgname, [string] $vmsize)
91
91
92
- $st = Write-Output "Creating VM Config Object - Start";
92
+ $st = Write-Verbose "Creating VM Config Object - Start";
93
93
94
94
$vmname = 'vm' + $rgname;
95
95
$p = New-AzureVMConfig -VMName $vmname -VMSize $vmsize;
96
96
97
- $st = Write-Output "Creating VM Config Object - End";
97
+ $st = Write-Verbose "Creating VM Config Object - End";
98
98
99
99
return $p;
100
100
}
@@ -108,17 +108,17 @@ function get_created_storage_account_name
108
108
{
109
109
param ([string] $loc, [string] $rgname)
110
110
111
- $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - Start";
111
+ $st = Write-Verbose "Creating and getting storage account for '${loc}' and '${rgname}' - Start";
112
112
113
113
$stoname = 'sto' + $rgname;
114
114
$stotype = 'Standard_GRS';
115
115
116
- $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - '${stotype}' & '${stoname}'";
116
+ $st = Write-Verbose "Creating and getting storage account for '${loc}' and '${rgname}' - '${stotype}' & '${stoname}'";
117
117
118
118
$st = New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
119
119
$st = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
120
120
121
- $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - End";
121
+ $st = Write-Verbose "Creating and getting storage account for '${loc}' and '${rgname}' - End";
122
122
123
123
return $stoname;
124
124
}
@@ -136,7 +136,7 @@ function create_and_setup_nic_ids
136
136
{
137
137
param ([string] $loc, [string] $rgname, $vmconfig)
138
138
139
- $st = Write-Output "Creating and getting NICs for '${loc}' and '${rgname}' - Start";
139
+ $st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - Start";
140
140
141
141
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
142
142
$vnet = New-AzureVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -DnsServer "10.1.1.1" -Subnet $subnet;
@@ -184,7 +184,7 @@ function create_and_setup_nic_ids
184
184
185
185
$fn_end =
186
186
@'
187
- $st = Write-Output "Creating and getting NICs for '${loc}' and '${rgname}' - End";
187
+ $st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - End";
188
188
189
189
return $nic_ids;
190
190
}
@@ -201,7 +201,7 @@ function create_and_setup_vm_config_object
201
201
{
202
202
param ([string] $loc, [string] $rgname, [string] $vmsize)
203
203
204
- $st = Write-Output "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - Start";
204
+ $st = Write-Verbose "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - Start";
205
205
206
206
$vmconfig = get_vm_config_object $rgname $vmsize
207
207
@@ -212,7 +212,7 @@ function create_and_setup_vm_config_object
212
212
$computerName = "cn" + $rgname;
213
213
$vmconfig = Set-AzureVMOperatingSystem -VM $vmconfig -Windows -ComputerName $computerName -Credential $cred;
214
214
215
- $st = Write-Output "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - End";
215
+ $st = Write-Verbose "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - End";
216
216
217
217
return $vmconfig;
218
218
}
@@ -228,7 +228,7 @@ function setup_image_and_disks
228
228
{
229
229
param ([string] $loc, [string] $rgname, [string] $stoname, $vmconfig)
230
230
231
- $st = Write-Output "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - Start";
231
+ $st = Write-Verbose "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - Start";
232
232
233
233
$osDiskName = 'osDisk';
234
234
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
@@ -244,7 +244,7 @@ function setup_image_and_disks
244
244
# Do not add any data disks
245
245
$vmconfig.StorageProfile.DataDisks = $null;
246
246
247
- $st = Write-Output "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - End";
247
+ $st = Write-Verbose "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - End";
248
248
249
249
return $vmconfig;
250
250
}
@@ -259,7 +259,7 @@ function Run-VMDynamicTests
259
259
{
260
260
param ([int ] $num_total_generated_tests = 3 , [string ] $base_folder = ' .\ScenarioTests\Generated' )
261
261
262
- $st = Write-Output ' Running VM Dynamic Tests - Start' ;
262
+ $st = Write-Verbose ' Running VM Dynamic Tests - Start' ;
263
263
264
264
[bool ] $isRecordMode = $true ;
265
265
$testMode = Get-ComputeTestMode ;
@@ -268,7 +268,7 @@ function Run-VMDynamicTests
268
268
$isRecordMode = $false ;
269
269
}
270
270
271
- $st = Write-Output " Running VM Dynamic Tests - `$ isRecordMode = $isRecordMode " ;
271
+ $st = Write-Verbose " Running VM Dynamic Tests - `$ isRecordMode = $isRecordMode " ;
272
272
273
273
$generated_file_names = @ ($null ) * $num_total_generated_tests ;
274
274
$generated_func_names = @ ($null ) * $num_total_generated_tests ;
@@ -289,7 +289,7 @@ function Run-VMDynamicTests
289
289
$generated_func_name = ' ps_vm_dynamic_test_func_' + $index + ' _' + $rgname_str ;
290
290
$generated_func_names [$i ] = $generated_func_name ;
291
291
292
- $st = Write-Output " Running VM Dynamic Tests - File & Test Name #${index} : ${generated_file_name} & ${generated_func_name} " ;
292
+ $st = Write-Verbose " Running VM Dynamic Tests - File & Test Name #${index} : ${generated_file_name} & ${generated_func_name} " ;
293
293
}
294
294
295
295
$locations = get_all_vm_locations;
@@ -302,7 +302,7 @@ function Run-VMDynamicTests
302
302
$generated_file_name = $generated_file_names [$i ];
303
303
$generated_func_name = $generated_func_names [$i ];
304
304
305
- $st = Write-Output (' Running VM Dynamic Tests - Generating Test #' + (1 + $i ));
305
+ $st = Write-Verbose (' Running VM Dynamic Tests - Generating Test #' + (1 + $i ));
306
306
307
307
# Generate New Dynamic Test Files
308
308
$st = New-Item - Path $generated_file_name - Type File - Value ' ' - Force;
@@ -332,9 +332,9 @@ function ${generated_func_name}
332
332
`$ loc = '${loc_name_str} ';
333
333
`$ vmsize = '${vm_size_str} ';
334
334
335
- `$ st = Write-Output 'Running Test ${generated_func_name} - Start ${rgname_str} , ${loc_name_str} & ${vm_size_str} ';
335
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - Start ${rgname_str} , ${loc_name_str} & ${vm_size_str} ';
336
336
337
- `$ st = Write-Output 'Running Test ${generated_func_name} - Creating Resource Group';
337
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - Creating Resource Group';
338
338
`$ st = New-AzureResourceGroup -Location `$ loc -Name `$ rgname;
339
339
340
340
`$ vmconfig = create_and_setup_vm_config_object `$ loc `$ rgname `$ vmsize;
@@ -349,20 +349,20 @@ function ${generated_func_name}
349
349
`$ st = setup_image_and_disks `$ loc `$ rgname `$ stoname `$ vmconfig;
350
350
351
351
# Virtual Machine
352
- `$ st = Write-Output 'Running Test ${generated_func_name} - Creating VM';
352
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - Creating VM';
353
353
354
354
`$ vmname = 'vm' + `$ rgname;
355
355
`$ st = New-AzureVM -ResourceGroupName `$ rgname -Location `$ loc -Name `$ vmname -VM `$ vmconfig;
356
356
357
357
# Get VM
358
- `$ st = Write-Output 'Running Test ${generated_func_name} - Getting VM';
358
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - Getting VM';
359
359
`$ vm1 = Get-AzureVM -Name `$ vmname -ResourceGroupName `$ rgname;
360
360
361
361
# Remove
362
- `$ st = Write-Output 'Running Test ${generated_func_name} - Removing VM';
362
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - Removing VM';
363
363
`$ st = Remove-AzureVM -Name `$ vmname -ResourceGroupName `$ rgname -Force;
364
364
365
- `$ st = Write-Output 'Running Test ${generated_func_name} - End';
365
+ `$ st = Write-Verbose 'Running Test ${generated_func_name} - End';
366
366
}
367
367
finally
368
368
{
@@ -374,7 +374,7 @@ function ${generated_func_name}
374
374
"@ ;
375
375
$st = $fn_body | Out-File - Encoding ASCII - Append - FilePath $generated_file_name - Force;
376
376
377
- $st = Write-Output (' Running VM Dynamic Tests - Generated Function #' + (1 + $i ) + ' : ' + $fn_body );
377
+ $st = Write-Verbose (' Running VM Dynamic Tests - Generated Function #' + (1 + $i ) + ' : ' + $fn_body );
378
378
}
379
379
}
380
380
@@ -385,10 +385,10 @@ function ${generated_func_name}
385
385
386
386
$generated_func_name = $generated_func_names [$i ];
387
387
388
- $st = Write-Output (' Running VM Dynamic Tests - Invoking Function #' + (1 + $i ) + ' : ' + $generated_func_name );
388
+ $st = Write-Verbose (' Running VM Dynamic Tests - Invoking Function #' + (1 + $i ) + ' : ' + $generated_func_name );
389
389
390
390
$st = Invoke-Expression - Command $generated_func_name ;
391
391
}
392
392
393
- $st = Write-Output ' Running VM Dynamic Tests - End' ;
393
+ $st = Write-Verbose ' Running VM Dynamic Tests - End' ;
394
394
}
0 commit comments