Skip to content

Commit 81a5ac8

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into master-fix
# Conflicts: # tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv
2 parents 3ed7a91 + 883e428 commit 81a5ac8

File tree

16 files changed

+3957
-75
lines changed

16 files changed

+3957
-75
lines changed

documentation/Using-Azure-TestFramework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ In order to Record/Playback a test, you need to setup a connection string that c
127127
1. The default mode is Playback mode, so no setting up of connection string is required.
128128

129129
#### Record Test with Interactive login using OrgId
130-
TEST_CSM_ORGID_AUTHENTICATION=SubsctiptionId={SubId};UserId={orgId};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
130+
TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId={SubId};UserId={orgId};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
131131

132132
#### Record Test with ServicePrincipal
133-
TEST_CSM_ORGID_AUTHENTICATION=SubsctiptionId={SubId};ServicePrincipal={clientId};ServicePrincipalSecret={clientSecret};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
133+
TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId={SubId};ServicePrincipal={clientId};ServicePrincipalSecret={clientSecret};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
134134

135135
2. Run the test and make sure that you got a generated .json file that matches the test name in the bin folder under *SessionRecords folder
136136
3. Copy SessionRecords folder inside the test project and add all *.json files in Visual Studio setting "Copy to Output Directory" property to "Copy if newer"
@@ -149,4 +149,4 @@ In order to Record/Playback a test, you need to setup a connection string that c
149149
TestEnvironment.Endpoints.GraphUri = new Uri("https://newGraphUri.windows.net");
150150

151151
###Note:###
152-
Changing the above properties at run-time has the potential to hard code few things in your tests. Best practice would be to use these properties to change values at run-time from immediate window at run-time and avoid hard-coding certain values.
152+
Changing the above properties at run-time has the potential to hard code few things in your tests. Best practice would be to use these properties to change values at run-time from immediate window at run-time and avoid hard-coding certain values.

src/ResourceManager/CognitiveServices/CognitiveServices.Test/Commands.Management.CognitiveServices.Test.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
<Reference Include="Microsoft.Azure.Management.Authorization">
5151
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5252
</Reference>
53-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.1.0-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
53+
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.2.1-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
5555
<Private>True</Private>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -163,6 +163,9 @@
163163
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestAccountSkus.json">
164164
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
165165
</None>
166+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestCreateAllKindsOfAccounts.json">
167+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
168+
</None>
166169
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccountKeys.json">
167170
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
168171
</None>
@@ -195,4 +198,4 @@
195198
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
196199
</ItemGroup>
197200
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
198-
</Project>
201+
</Project>

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public void TestNewAccount()
4040
TestController.NewInstance.RunPsTest("Test-NewAzureRmCognitiveServicesAccount");
4141
}
4242

43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestCreateAllKindsOfAccounts()
46+
{
47+
TestController.NewInstance.RunPsTest("Test-NewAzureRmAllKindsOfCognitiveServicesAccounts");
48+
}
49+
4350
[Fact]
4451
[Trait(Category.AcceptanceType, Category.CheckIn)]
4552
public void TestRemoveAccount()

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@ function Test-NewAzureRmCognitiveServicesAccount
4848
}
4949
}
5050

51+
<#
52+
.SYNOPSIS
53+
Test New-AzureRmCognitiveServicesAccount
54+
#>
55+
function Test-NewAzureRmAllKindsOfCognitiveServicesAccounts
56+
{
57+
# Setup
58+
$rgname = Get-CognitiveServicesManagementTestResourceName;
59+
60+
try
61+
{
62+
New-AzureRmResourceGroup -Name $rgname -Location 'West US';
63+
64+
# Create all known kinds of Cognitive Services accounts.
65+
Test-CreateCognitiveServicesAccount $rgname 'AcademicTest' 'Academic' 'S0' 'West US'
66+
Test-CreateCognitiveServicesAccount $rgname 'BingAutosuggestTest' 'Bing.Autosuggest' 'S1' 'Global'
67+
Test-CreateCognitiveServicesAccount $rgname 'BingSearchTest' 'Bing.Search' 'S1' 'Global'
68+
Test-CreateCognitiveServicesAccount $rgname 'BingSpeechTest' 'Bing.Speech' 'S0' 'Global'
69+
Test-CreateCognitiveServicesAccount $rgname 'BingSpellCheckTest' 'Bing.SpellCheck' 'S1' 'Global'
70+
Test-CreateCognitiveServicesAccount $rgname 'ComputerVisionTest' 'ComputerVision' 'S0' 'West US'
71+
Test-CreateCognitiveServicesAccount $rgname 'ContentModeratorTest' 'ContentModerator' 'S0' 'West US'
72+
Test-CreateCognitiveServicesAccount $rgname 'EmotionTest' 'Emotion' 'S0' 'West US'
73+
Test-CreateCognitiveServicesAccount $rgname 'FaceTest' 'Face' 'S0' 'West US'
74+
Test-CreateCognitiveServicesAccount $rgname 'LUISTest' 'LUIS' 'S0' 'West US'
75+
Test-CreateCognitiveServicesAccount $rgname 'RecommendationsTest' 'Recommendations' 'S1' 'West US'
76+
Test-CreateCognitiveServicesAccount $rgname 'SpeakerRecognitionTest' 'SpeakerRecognition' 'S0' 'West US'
77+
Test-CreateCognitiveServicesAccount $rgname 'SpeechTest' 'Speech' 'S0' 'West US'
78+
Test-CreateCognitiveServicesAccount $rgname 'SpeechTranslationTest' 'SpeechTranslation' 'S1' 'Global'
79+
Test-CreateCognitiveServicesAccount $rgname 'TextAnalyticsTest' 'TextAnalytics' 'S1' 'West US'
80+
Test-CreateCognitiveServicesAccount $rgname 'TextTranslationTest' 'TextTranslation' 'S1' 'Global'
81+
Test-CreateCognitiveServicesAccount $rgname 'WebLMTest' 'WebLM' 'S0' 'West US'
82+
}
83+
finally
84+
{
85+
# Cleanup
86+
Clean-ResourceGroup $rgname
87+
}
88+
}
89+
5190
<#
5291
.SYNOPSIS
5392
Test Remove-AzureRmCognitiveServicesAccount

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/Common.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ function Retry-IfException
8181
$ErrorActionPreference = $oldErrorActionPreferenceValue;
8282
}
8383

84+
<#
85+
.SYNOPSIS
86+
Create a Cognitive Services account
87+
#>
88+
function Test-CreateCognitiveServicesAccount
89+
{
90+
param([string] $rgname, [string] $accountname, [string] $accounttype, [string] $skuname, [string] $loc)
91+
92+
# Action: create
93+
$createdAccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -Force;
94+
95+
# Assert
96+
Assert-NotNull $createdAccount;
97+
98+
# Cleanup
99+
Retry-IfException { Remove-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
100+
}
101+
84102
<#
85103
.SYNOPSIS
86104
Gets random resource name

0 commit comments

Comments
 (0)