Skip to content

Commit 90593b5

Browse files
authored
Merge pull request #2787 from anilyela/dev-anilyela
Add cmdlets for Azure SQL Advisors and Recommended Actions APIs
2 parents 8dd308b + d8b627c commit 90593b5

File tree

70 files changed

+25160
-7414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+25160
-7414
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
<DesignTime>True</DesignTime>
203203
<DependentUpon>Resources.resx</DependentUpon>
204204
</Compile>
205+
<Compile Include="ScenarioTests\RecommendedActionTests.cs" />
205206
<Compile Include="ScenarioTests\DatabaseBackupStretchTests.cs" />
206207
<Compile Include="ScenarioTests\DatabaseCrudStretchTests.cs" />
207208
<Compile Include="ScenarioTests\ThreatDetectionTests.cs" />
@@ -210,6 +211,12 @@
210211
<Compile Include="ScenarioTests\DatabaseReplicationTests.cs" />
211212
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
212213
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
214+
<None Include="ScenarioTests\RecommendedActionTests.ps1">
215+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
216+
</None>
217+
<None Include="ScenarioTests\AdvisorTests.ps1">
218+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
219+
</None>
213220
<None Include="ScenarioTests\DatabaseBackupStretchTests.ps1">
214221
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
215222
</None>
@@ -253,6 +260,7 @@
253260
<Compile Include="ScenarioTests\ServerActiveDirectoryAdministratorTest.cs" />
254261
<Compile Include="ScenarioTests\ServerCommunicationLinkCrudTests.cs" />
255262
<Compile Include="ScenarioTests\ServiceTierAdvisorTests.cs" />
263+
<Compile Include="ScenarioTests\AdvisorTests.cs" />
256264
<Compile Include="ScenarioTests\RecommendedElasticPoolTests.cs" />
257265
<Compile Include="ScenarioTests\ElasticPoolCrudTests.cs" />
258266
<Compile Include="ScenarioTests\AuditingTests.cs" />
@@ -351,6 +359,42 @@
351359
<None Include="ScenarioTests\TransparentDataEncryptionCrudTests.ps1">
352360
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
353361
</None>
362+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestGetElasticPoolAdvisor.json">
363+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
364+
</None>
365+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestGetServerAdvisor.json">
366+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
367+
</None>
368+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListElasticPoolAdvisors.json">
369+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
370+
</None>
371+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListElasticPoolAdvisorsExpanded.json">
372+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
373+
</None>
374+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListServerAdvisors.json">
375+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
376+
</None>
377+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListServerAdvisorsExpanded.json">
378+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
379+
</None>
380+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListDatabaseAdvisorsExpanded.json">
381+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
382+
</None>
383+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestListDatabaseAdvisors.json">
384+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
385+
</None>
386+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestGetDatabaseAdvisor.json">
387+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
388+
</None>
389+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestUpdateDatabaseAdvisor.json">
390+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
391+
</None>
392+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestUpdateElasticPoolAdvisor.json">
393+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
394+
</None>
395+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AdvisorTests\TestUpdateServerAdvisor.json">
396+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
397+
</None>
354398
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.AuditingTests\TestAuditingDatabaseDisableEnableKeepProperties.json">
355399
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
356400
</None>
@@ -567,6 +611,33 @@
567611
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.IndexRecommendationTests\TestGetIndexRecommendation.json">
568612
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
569613
</None>
614+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestGetDatabaseRecommendedAction.json">
615+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
616+
</None>
617+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestGetElasticPoolRecommendedAction.json">
618+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
619+
</None>
620+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestGetServerRecommendedAction.json">
621+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
622+
</None>
623+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestListDatabaseRecommendedActions.json">
624+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
625+
</None>
626+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestListElasticPoolRecommendedActions.json">
627+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
628+
</None>
629+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestListServerRecommendedActions.json">
630+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
631+
</None>
632+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestUpdateDatabaseRecommendedAction.json">
633+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
634+
</None>
635+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestUpdateElasticPoolRecommendedAction.json">
636+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
637+
</None>
638+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedActionTests\TestUpdateServerRecommendedAction.json">
639+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
640+
</None>
570641
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\ListRecommendedElasticPools.json">
571642
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
572643
</None>
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
16+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
using Xunit.Abstractions;
20+
21+
namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
22+
{
23+
public class AdvisorTests : SqlTestsBase
24+
{
25+
public AdvisorTests(ITestOutputHelper output)
26+
{
27+
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
28+
}
29+
30+
#region Server Advisor Tests
31+
32+
[Fact]
33+
[Trait(Category.AcceptanceType, Category.CheckIn)]
34+
public void TestListServerAdvisors()
35+
{
36+
RunPowerShellTest("Test-ListServerAdvisors");
37+
}
38+
39+
[Fact]
40+
[Trait(Category.AcceptanceType, Category.CheckIn)]
41+
public void TestListServerAdvisorsExpanded()
42+
{
43+
RunPowerShellTest("Test-ListServerAdvisorsExpanded");
44+
}
45+
46+
[Fact]
47+
[Trait(Category.AcceptanceType, Category.CheckIn)]
48+
public void TestGetServerAdvisor()
49+
{
50+
RunPowerShellTest("Test-GetServerAdvisor");
51+
}
52+
53+
[Fact]
54+
[Trait(Category.AcceptanceType, Category.CheckIn)]
55+
public void TestUpdateServerAdvisor()
56+
{
57+
RunPowerShellTest("Test-UpdateServerAdvisor");
58+
}
59+
60+
#endregion
61+
62+
#region Database Advisor Tests
63+
64+
[Fact]
65+
[Trait(Category.AcceptanceType, Category.CheckIn)]
66+
public void TestListDatabaseAdvisors()
67+
{
68+
RunPowerShellTest("Test-ListDatabaseAdvisors");
69+
}
70+
71+
[Fact]
72+
[Trait(Category.AcceptanceType, Category.CheckIn)]
73+
public void TestListDatabaseAdvisorsExpanded()
74+
{
75+
RunPowerShellTest("Test-ListDatabaseAdvisorsExpanded");
76+
}
77+
78+
[Fact]
79+
[Trait(Category.AcceptanceType, Category.CheckIn)]
80+
public void TestGetDatabaseAdvisor()
81+
{
82+
RunPowerShellTest("Test-GetDatabaseAdvisor");
83+
}
84+
85+
[Fact]
86+
[Trait(Category.AcceptanceType, Category.CheckIn)]
87+
public void TestUpdateDatabaseAdvisor()
88+
{
89+
RunPowerShellTest("Test-UpdateDatabaseAdvisor");
90+
}
91+
92+
#endregion
93+
94+
#region Elastic Pool Advisor Tests
95+
96+
[Fact]
97+
[Trait(Category.AcceptanceType, Category.CheckIn)]
98+
public void TestListElasticPoolAdvisors()
99+
{
100+
RunPowerShellTest("Test-ListElasticPoolAdvisors");
101+
}
102+
103+
[Fact]
104+
[Trait(Category.AcceptanceType, Category.CheckIn)]
105+
public void TestListElasticPoolAdvisorsExpanded()
106+
{
107+
RunPowerShellTest("Test-ListElasticPoolAdvisorsExpanded");
108+
}
109+
110+
[Fact]
111+
[Trait(Category.AcceptanceType, Category.CheckIn)]
112+
public void TestGetElasticPoolAdvisor()
113+
{
114+
RunPowerShellTest("Test-GetElasticPoolAdvisor");
115+
}
116+
117+
[Fact]
118+
[Trait(Category.AcceptanceType, Category.CheckIn)]
119+
public void TestUpdateElasticPoolAdvisor()
120+
{
121+
RunPowerShellTest("Test-UpdateElasticPoolAdvisor");
122+
}
123+
124+
#endregion
125+
}
126+
}

0 commit comments

Comments
 (0)