|
| 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