Skip to content

Commit 1d4e2d9

Browse files
author
Maddie Clayton
authored
Merge pull request Azure#8998 from jaredmoo/sqlSloCapabilities
Use capabilities API to return additional details from Get-AzSqlServerServiceObjective
2 parents 8736650 + 3af4dd8 commit 1d4e2d9

File tree

9 files changed

+1947
-119
lines changed

9 files changed

+1947
-119
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
using Xunit.Abstractions;
19+
20+
namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
21+
{
22+
public class ServiceObjectiveTests : SqlTestsBase
23+
{
24+
public ServiceObjectiveTests(ITestOutputHelper output) : base(output)
25+
{
26+
}
27+
28+
[Fact]
29+
[Trait(Category.AcceptanceType, Category.CheckIn)]
30+
public void TestGetServerServiceObjective()
31+
{
32+
RunPowerShellTest("Test-GetServerServiceObjective");
33+
}
34+
}
35+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<#
16+
.SYNOPSIS
17+
Tests getting a server's service objectives
18+
.DESCRIPTION
19+
SmokeTest
20+
#>
21+
function Test-GetServerServiceObjective
22+
{
23+
# Setup
24+
$rg = Create-ResourceGroupForTest
25+
$rg | Out-String | Write-Output
26+
27+
$server = Create-ServerForTest $rg
28+
$server | Out-String | Write-Output
29+
30+
$requestedSlo = "GP_Gen5_2"
31+
32+
try
33+
{
34+
# Get with positional parameters
35+
$o = Get-AzSqlServerServiceObjective $rg.ResourceGroupName $server.ServerName
36+
Assert-AreNotEqual 0 $o.Length "Expected more than 0 service objectives"
37+
38+
$o = Get-AzSqlServerServiceObjective $rg.ResourceGroupName $server.ServerName $requestedSlo
39+
Assert-AreEqual 1 $o.Length "Could not find exactly 1 service objective for $requestedSlo"
40+
41+
# Get with named parameters
42+
$o = Get-AzSqlServerServiceObjective -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName
43+
Assert-AreNotEqual 0 $o.Length "Expected more than 0 service objectives"
44+
45+
$o = Get-AzSqlServerServiceObjective -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -ServiceObjectiveName $requestedSlo
46+
Assert-AreEqual 1 $o.Length "Could not find exactly 1 service objective for $requestedSlo"
47+
}
48+
finally
49+
{
50+
Remove-ResourceGroupForTest $rg
51+
}
52+
}

0 commit comments

Comments
 (0)