14
14
15
15
function get_all_vm_locations
16
16
{
17
+ $st = Write-Output ' Getting all Azure location - Start' ;
18
+
17
19
$locations = Get-AzureLocation | where { $_.Name -like ' Microsoft.Compute/virtualMachines' } | select - ExpandProperty Locations;
18
20
21
+ $st = Write-Output ' Getting all Azure location - End' ;
22
+
19
23
return $locations ;
20
24
}
21
25
22
26
function get_all_standard_vm_sizes
23
27
{
24
28
param ([string ] $location )
25
29
30
+ $st = Write-Output " Getting all VM sizes in location '${location} ' - Start" ;
31
+
26
32
$vmsizes = Get-AzureVMSize - Location $location | where { $_.Name -like ' Standard_A*' -and $_.NumberOfCores -le 4 } | select - ExpandProperty Name;
27
33
34
+ $st = Write-Output " Getting all VM sizes in location [${location} ] - End" ;
35
+
28
36
return $vmsizes ;
29
37
}
30
38
@@ -33,6 +41,8 @@ function get_hash_int_value
33
41
# Reference: http://www.cse.yorku.ca/~oz/hash.html
34
42
param ([string ] $seedstr )
35
43
44
+ $st = Write-Output " Computing hash for '${seedstr} ' - Start" ;
45
+
36
46
if ($seedstr -eq $null ) { $seedstr = ' ' ; }
37
47
38
48
[System.Int32 ]$hash = 5381 ;
@@ -42,6 +52,10 @@ function get_hash_int_value
42
52
$hash = ((($hash -shl 5 ) + $hash ) + $c ) % [System.Int32 ]::MaxValue;
43
53
}
44
54
55
+ $st = Write-Output " Computing hash for '${seedstr} ' - `$ hash = ${hash} " ;
56
+
57
+ $st = Write-Output " Computing hash for '${seedstr} ' - End" ;
58
+
45
59
return $hash ;
46
60
}
47
61
@@ -75,9 +89,13 @@ function get_vm_config_object
75
89
{
76
90
param ([string] $rgname, [string] $vmsize)
77
91
92
+ $st = Write-Output "Creating VM Config Object - Start";
93
+
78
94
$vmname = 'vm' + $rgname;
79
95
$p = New-AzureVMConfig -VMName $vmname -VMSize $vmsize;
80
96
97
+ $st = Write-Output "Creating VM Config Object - End";
98
+
81
99
return $p;
82
100
}
83
101
@@ -90,11 +108,17 @@ function get_created_storage_account_name
90
108
{
91
109
param ([string] $loc, [string] $rgname)
92
110
111
+ $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - Start";
112
+
93
113
$stoname = 'sto' + $rgname;
94
114
$stotype = 'Standard_GRS';
95
115
116
+ $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - '${stotype}' & '${stoname}'";
117
+
96
118
$st = New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
97
119
$st = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
120
+
121
+ $st = Write-Output "Creating and getting storage account for '${loc}' and '${rgname}' - End";
98
122
99
123
return $stoname;
100
124
}
@@ -112,6 +136,8 @@ function create_and_setup_nic_ids
112
136
{
113
137
param ([string] $loc, [string] $rgname, $vmconfig)
114
138
139
+ $st = Write-Output "Creating and getting NICs for '${loc}' and '${rgname}' - Start";
140
+
115
141
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
116
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;
117
143
$vnet = Get-AzureVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
@@ -158,6 +184,7 @@ function create_and_setup_nic_ids
158
184
159
185
$fn_end =
160
186
@'
187
+ $st = Write-Output "Creating and getting NICs for '${loc}' and '${rgname}' - End";
161
188
162
189
return $nic_ids;
163
190
}
@@ -174,6 +201,8 @@ function create_and_setup_vm_config_object
174
201
{
175
202
param ([string] $loc, [string] $rgname, [string] $vmsize)
176
203
204
+ $st = Write-Output "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - Start";
205
+
177
206
$vmconfig = get_vm_config_object $rgname $vmsize
178
207
179
208
$user = "Foo12";
@@ -183,6 +212,8 @@ function create_and_setup_vm_config_object
183
212
$computerName = "cn" + $rgname;
184
213
$vmconfig = Set-AzureVMOperatingSystem -VM $vmconfig -Windows -ComputerName $computerName -Credential $cred;
185
214
215
+ $st = Write-Output "Creating and setting up the VM config object for '${loc}', '${rgname}' and '${vmsize}' - End";
216
+
186
217
return $vmconfig;
187
218
}
188
219
@@ -197,6 +228,8 @@ function setup_image_and_disks
197
228
{
198
229
param ([string] $loc, [string] $rgname, [string] $stoname, $vmconfig)
199
230
231
+ $st = Write-Output "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - Start";
232
+
200
233
$osDiskName = 'osDisk';
201
234
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
202
235
$osDiskCaching = 'ReadWrite';
@@ -211,6 +244,8 @@ function setup_image_and_disks
211
244
# Do not add any data disks
212
245
$vmconfig.StorageProfile.DataDisks = $null;
213
246
247
+ $st = Write-Output "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - End";
248
+
214
249
return $vmconfig;
215
250
}
216
251
@@ -224,13 +259,17 @@ function Run-VMDynamicTests
224
259
{
225
260
param ([int ] $num_total_generated_tests = 3 , [string ] $base_folder = ' .\ScenarioTests\Generated' )
226
261
262
+ $st = Write-Output ' Running VM Dynamic Tests - Start' ;
263
+
227
264
[bool ] $isRecordMode = $true ;
228
265
$testMode = Get-ComputeTestMode ;
229
266
if ($testMode.ToLower () -eq ' playback' )
230
267
{
231
268
$isRecordMode = $false ;
232
269
}
233
270
271
+ $st = Write-Output " Running VM Dynamic Tests - `$ isRecordMode = $isRecordMode " ;
272
+
234
273
$generated_file_names = @ ($null ) * $num_total_generated_tests ;
235
274
$generated_func_names = @ ($null ) * $num_total_generated_tests ;
236
275
$generated_rgrp_names = @ ($null ) * $num_total_generated_tests ;
@@ -249,6 +288,8 @@ function Run-VMDynamicTests
249
288
250
289
$generated_func_name = ' ps_vm_dynamic_test_func_' + $index + ' _' + $rgname_str ;
251
290
$generated_func_names [$i ] = $generated_func_name ;
291
+
292
+ $st = Write-Output " Running VM Dynamic Tests - File & Test Name #${index} : ${generated_file_name} & ${generated_func_name} " ;
252
293
}
253
294
254
295
$locations = get_all_vm_locations;
@@ -261,7 +302,8 @@ function Run-VMDynamicTests
261
302
$generated_file_name = $generated_file_names [$i ];
262
303
$generated_func_name = $generated_func_names [$i ];
263
304
264
- # $st = Write-Host ('Generating Test #' + (1 + $i));
305
+ $st = Write-Output (' Running VM Dynamic Tests - Generating Test #' + (1 + $i ));
306
+
265
307
# Generate New Dynamic Test Files
266
308
$st = New-Item - Path $generated_file_name - Type File - Value ' ' - Force;
267
309
$st = $comment_header_str | Out-File - Encoding ASCII - Append - FilePath $generated_file_name - Force;
@@ -322,6 +364,8 @@ function ${generated_func_name}
322
364
323
365
"@ ;
324
366
$st = $fn_body | Out-File - Encoding ASCII - Append - FilePath $generated_file_name - Force;
367
+
368
+ $st = Write-Output (' Running VM Dynamic Tests - Generated Function #' + (1 + $i ) + ' : ' + $fn_body );
325
369
}
326
370
}
327
371
@@ -331,6 +375,11 @@ function ${generated_func_name}
331
375
$st = . " $generated_file_name " ;
332
376
333
377
$generated_func_name = $generated_func_names [$i ];
378
+
379
+ $st = Write-Output (' Running VM Dynamic Tests - Invoking Function #' + (1 + $i ) + ' : ' + $generated_func_name );
380
+
334
381
$st = Invoke-Expression - Command $generated_func_name ;
335
382
}
383
+
384
+ $st = Write-Output ' Running VM Dynamic Tests - End' ;
336
385
}
0 commit comments