Skip to content

Commit 955b8ee

Browse files
committed
Use 'Write-Verbose'
1 parent 3799fe9 commit 955b8ee

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
function get_all_vm_locations
1616
{
17-
$st = Write-Output 'Getting all Azure location - Start';
17+
$st = Write-Verbose 'Getting all Azure location - Start';
1818

1919
$locations = Get-AzureLocation | where { $_.Name -like 'Microsoft.Compute/virtualMachines' } | select -ExpandProperty Locations;
2020

21-
$st = Write-Output 'Getting all Azure location - End';
21+
$st = Write-Verbose 'Getting all Azure location - End';
2222

2323
return $locations;
2424
}
@@ -27,11 +27,11 @@ function get_all_standard_vm_sizes
2727
{
2828
param ([string] $location)
2929

30-
$st = Write-Output "Getting all VM sizes in location '${location}' - Start";
30+
$st = Write-Verbose "Getting all VM sizes in location '${location}' - Start";
3131

3232
$vmsizes = Get-AzureVMSize -Location $location | where { $_.Name -like 'Standard_A*' -and $_.NumberOfCores -le 4 } | select -ExpandProperty Name;
3333

34-
$st = Write-Output "Getting all VM sizes in location [${location}] - End";
34+
$st = Write-Verbose "Getting all VM sizes in location [${location}] - End";
3535

3636
return $vmsizes;
3737
}
@@ -41,7 +41,7 @@ function get_hash_int_value
4141
# Reference: http://www.cse.yorku.ca/~oz/hash.html
4242
param ([string] $seedstr)
4343

44-
$st = Write-Output "Computing hash for '${seedstr}' - Start";
44+
$st = Write-Verbose "Computing hash for '${seedstr}' - Start";
4545

4646
if ($seedstr -eq $null) { $seedstr = ''; }
4747

@@ -52,9 +52,9 @@ function get_hash_int_value
5252
$hash = ((($hash -shl 5) + $hash) + $c) % [System.Int32]::MaxValue;
5353
}
5454

55-
$st = Write-Output "Computing hash for '${seedstr}' - `$hash = ${hash}";
55+
$st = Write-Verbose "Computing hash for '${seedstr}' - `$hash = ${hash}";
5656

57-
$st = Write-Output "Computing hash for '${seedstr}' - End";
57+
$st = Write-Verbose "Computing hash for '${seedstr}' - End";
5858

5959
return $hash;
6060
}
@@ -89,12 +89,12 @@ function get_vm_config_object
8989
{
9090
param ([string] $rgname, [string] $vmsize)
9191
92-
$st = Write-Output "Creating VM Config Object - Start";
92+
$st = Write-Verbose "Creating VM Config Object - Start";
9393
9494
$vmname = 'vm' + $rgname;
9595
$p = New-AzureVMConfig -VMName $vmname -VMSize $vmsize;
9696
97-
$st = Write-Output "Creating VM Config Object - End";
97+
$st = Write-Verbose "Creating VM Config Object - End";
9898
9999
return $p;
100100
}
@@ -108,17 +108,17 @@ function get_created_storage_account_name
108108
{
109109
param ([string] $loc, [string] $rgname)
110110
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";
112112
113113
$stoname = 'sto' + $rgname;
114114
$stotype = 'Standard_GRS';
115115
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}'";
117117
118118
$st = New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
119119
$st = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
120120
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";
122122
123123
return $stoname;
124124
}
@@ -136,7 +136,7 @@ function create_and_setup_nic_ids
136136
{
137137
param ([string] $loc, [string] $rgname, $vmconfig)
138138
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";
140140
141141
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
142142
$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
184184

185185
$fn_end =
186186
@'
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";
188188
189189
return $nic_ids;
190190
}
@@ -201,7 +201,7 @@ function create_and_setup_vm_config_object
201201
{
202202
param ([string] $loc, [string] $rgname, [string] $vmsize)
203203
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";
205205
206206
$vmconfig = get_vm_config_object $rgname $vmsize
207207
@@ -212,7 +212,7 @@ function create_and_setup_vm_config_object
212212
$computerName = "cn" + $rgname;
213213
$vmconfig = Set-AzureVMOperatingSystem -VM $vmconfig -Windows -ComputerName $computerName -Credential $cred;
214214
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";
216216
217217
return $vmconfig;
218218
}
@@ -228,7 +228,7 @@ function setup_image_and_disks
228228
{
229229
param ([string] $loc, [string] $rgname, [string] $stoname, $vmconfig)
230230
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";
232232
233233
$osDiskName = 'osDisk';
234234
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
@@ -244,7 +244,7 @@ function setup_image_and_disks
244244
# Do not add any data disks
245245
$vmconfig.StorageProfile.DataDisks = $null;
246246
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";
248248
249249
return $vmconfig;
250250
}
@@ -259,7 +259,7 @@ function Run-VMDynamicTests
259259
{
260260
param ([int] $num_total_generated_tests = 3, [string] $base_folder = '.\ScenarioTests\Generated')
261261

262-
$st = Write-Output 'Running VM Dynamic Tests - Start';
262+
$st = Write-Verbose 'Running VM Dynamic Tests - Start';
263263

264264
[bool] $isRecordMode = $true;
265265
$testMode = Get-ComputeTestMode;
@@ -268,7 +268,7 @@ function Run-VMDynamicTests
268268
$isRecordMode = $false;
269269
}
270270

271-
$st = Write-Output "Running VM Dynamic Tests - `$isRecordMode = $isRecordMode";
271+
$st = Write-Verbose "Running VM Dynamic Tests - `$isRecordMode = $isRecordMode";
272272

273273
$generated_file_names = @($null) * $num_total_generated_tests;
274274
$generated_func_names = @($null) * $num_total_generated_tests;
@@ -289,7 +289,7 @@ function Run-VMDynamicTests
289289
$generated_func_name = 'ps_vm_dynamic_test_func_' + $index + '_' + $rgname_str;
290290
$generated_func_names[$i] = $generated_func_name;
291291

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}";
293293
}
294294

295295
$locations = get_all_vm_locations;
@@ -302,7 +302,7 @@ function Run-VMDynamicTests
302302
$generated_file_name = $generated_file_names[$i];
303303
$generated_func_name = $generated_func_names[$i];
304304

305-
$st = Write-Output ('Running VM Dynamic Tests - Generating Test #' + (1 + $i));
305+
$st = Write-Verbose ('Running VM Dynamic Tests - Generating Test #' + (1 + $i));
306306

307307
# Generate New Dynamic Test Files
308308
$st = New-Item -Path $generated_file_name -Type File -Value '' -Force;
@@ -332,9 +332,9 @@ function ${generated_func_name}
332332
`$loc = '${loc_name_str}';
333333
`$vmsize = '${vm_size_str}';
334334
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}';
336336
337-
`$st = Write-Output 'Running Test ${generated_func_name} - Creating Resource Group';
337+
`$st = Write-Verbose 'Running Test ${generated_func_name} - Creating Resource Group';
338338
`$st = New-AzureResourceGroup -Location `$loc -Name `$rgname;
339339
340340
`$vmconfig = create_and_setup_vm_config_object `$loc `$rgname `$vmsize;
@@ -349,20 +349,20 @@ function ${generated_func_name}
349349
`$st = setup_image_and_disks `$loc `$rgname `$stoname `$vmconfig;
350350
351351
# Virtual Machine
352-
`$st = Write-Output 'Running Test ${generated_func_name} - Creating VM';
352+
`$st = Write-Verbose 'Running Test ${generated_func_name} - Creating VM';
353353
354354
`$vmname = 'vm' + `$rgname;
355355
`$st = New-AzureVM -ResourceGroupName `$rgname -Location `$loc -Name `$vmname -VM `$vmconfig;
356356
357357
# Get VM
358-
`$st = Write-Output 'Running Test ${generated_func_name} - Getting VM';
358+
`$st = Write-Verbose 'Running Test ${generated_func_name} - Getting VM';
359359
`$vm1 = Get-AzureVM -Name `$vmname -ResourceGroupName `$rgname;
360360
361361
# Remove
362-
`$st = Write-Output 'Running Test ${generated_func_name} - Removing VM';
362+
`$st = Write-Verbose 'Running Test ${generated_func_name} - Removing VM';
363363
`$st = Remove-AzureVM -Name `$vmname -ResourceGroupName `$rgname -Force;
364364
365-
`$st = Write-Output 'Running Test ${generated_func_name} - End';
365+
`$st = Write-Verbose 'Running Test ${generated_func_name} - End';
366366
}
367367
finally
368368
{
@@ -374,7 +374,7 @@ function ${generated_func_name}
374374
"@;
375375
$st = $fn_body | Out-File -Encoding ASCII -Append -FilePath $generated_file_name -Force;
376376

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);
378378
}
379379
}
380380

@@ -385,10 +385,10 @@ function ${generated_func_name}
385385

386386
$generated_func_name = $generated_func_names[$i];
387387

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);
389389

390390
$st = Invoke-Expression -Command $generated_func_name;
391391
}
392392

393-
$st = Write-Output 'Running VM Dynamic Tests - End';
393+
$st = Write-Verbose 'Running VM Dynamic Tests - End';
394394
}

0 commit comments

Comments
 (0)