Skip to content

Commit d30f70c

Browse files
msJinLeiHarveyLink
andauthored
Fix MySql test cases failure (#11536)
* Resolve Conflict * Update MySql Test * Fix merge issue: restore SubnetId Change * Fix Get-AzMySqlServer test jsonfile input & output issue * Fix test case failure 1. Add SubsriptionId to serveral cmdlets 2. Remove piping in the test cases of AzMySqlConnectionString for the test framework limitation. * Change module initial version. Co-authored-by: Harvey Chen <[email protected]>
1 parent 1890589 commit d30f70c

File tree

50 files changed

+4543
-2663
lines changed

Some content is hidden

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

50 files changed

+4543
-2663
lines changed

src/MySql/custom/Get-AzMySqlConnectionString.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ function Get-AzMySqlConnectionString {
2828
[System.String]
2929
${ResourceGroupName},
3030

31+
[Parameter(ParameterSetName='Get', HelpMessage='The subscription ID that identifies an Azure subscription.')]
32+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
33+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
34+
[System.String]
35+
${SubscriptionId},
36+
3137
[Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline, HelpMessage = 'The source server object to create replica from.')]
3238
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
3339
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServer]

src/MySql/custom/New-AzMySqlServerReplica.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function New-AzMySqlServerReplica {
2929
[System.String]
3030
${ResourceGroupName},
3131

32+
[Parameter(HelpMessage='The subscription ID that identifies an Azure subscription.')]
33+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
34+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
35+
[System.String]
36+
${SubscriptionId},
37+
3238
[Parameter(Mandatory, ValueFromPipeline, HelpMessage = 'The source server object to create replica from.')]
3339
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
3440
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServer]

src/MySql/custom/Restore-AzMySqlServer_GeoRestore.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function Restore-AzMySqlServer_GeoRestore {
2929
[System.String]
3030
${ResourceGroupName},
3131

32+
[Parameter(HelpMessage='The subscription ID that identifies an Azure subscription.')]
33+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
34+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
35+
[System.String]
36+
${SubscriptionId},
37+
3238
[Parameter(Mandatory, ValueFromPipeline, HelpMessage = 'The source server object to restore from.')]
3339
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
3440
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServer]

src/MySql/custom/Restore-AzMySqlServer_PointInTimeRestore.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function Restore-AzMySqlServer_PointInTimeRestore {
2929
[System.String]
3030
${ResourceGroupName},
3131

32+
[Parameter(HelpMessage='The subscription ID that identifies an Azure subscription.')]
33+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
34+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
35+
[System.String]
36+
${SubscriptionId},
37+
3238
[Parameter(Mandatory, HelpMessage = 'The location the resource resides in.')]
3339
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
3440
[System.DateTime]

src/MySql/docs/Get-AzMySqlConnectionString.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Get the connection string according to client connection provider.
1515
### Get (Default)
1616
```
1717
Get-AzMySqlConnectionString -Client <String> -Name <String> -ResourceGroupName <String>
18-
[-DefaultProfile <PSObject>] [<CommonParameters>]
18+
[-SubscriptionId <String>] [-DefaultProfile <PSObject>] [<CommonParameters>]
1919
```
2020

2121
### GetViaIdentity
@@ -130,6 +130,22 @@ Accept wildcard characters: False
130130
Dynamic: False
131131
```
132132
133+
### -SubscriptionId
134+
The subscription ID that identifies an Azure subscription.
135+
136+
```yaml
137+
Type: System.String
138+
Parameter Sets: Get
139+
Aliases:
140+
141+
Required: False
142+
Position: Named
143+
Default value: (Get-AzContext).Subscription.Id
144+
Accept pipeline input: False
145+
Accept wildcard characters: False
146+
Dynamic: False
147+
```
148+
133149
### CommonParameters
134150
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
135151

src/MySql/docs/New-AzMySqlServerReplica.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Creates a new replica from an existing database.
1414

1515
```
1616
New-AzMySqlServerReplica -Name <String> -ResourceGroupName <String> -InputObject <IServer>
17-
[-Location <String>] [-Sku <String>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf]
18-
[<CommonParameters>]
17+
[-SubscriptionId <String>] [-Location <String>] [-Sku <String>] [-DefaultProfile <PSObject>] [-AsJob]
18+
[-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
1919
```
2020

2121
## DESCRIPTION
@@ -166,6 +166,22 @@ Accept wildcard characters: False
166166
Dynamic: False
167167
```
168168
169+
### -SubscriptionId
170+
The subscription ID that identifies an Azure subscription.
171+
172+
```yaml
173+
Type: System.String
174+
Parameter Sets: (All)
175+
Aliases:
176+
177+
Required: False
178+
Position: Named
179+
Default value: (Get-AzContext).Subscription.Id
180+
Accept pipeline input: False
181+
Accept wildcard characters: False
182+
Dynamic: False
183+
```
184+
169185
### -Confirm
170186
Prompts you for confirmation before running the cmdlet.
171187

src/MySql/docs/New-AzMySqlVirtualNetworkRule.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Creates or updates an existing virtual network rule.
1414

1515
```
1616
New-AzMySqlVirtualNetworkRule -Name <String> -ResourceGroupName <String> -ServerName <String>
17-
-VirtualNetworkSubnetId <String> [-SubscriptionId <String>] [-IgnoreMissingVnetServiceEndpoint]
17+
-SubnetId <String> [-SubscriptionId <String>] [-IgnoreMissingVnetServiceEndpoint]
1818
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
1919
```
2020

@@ -166,33 +166,33 @@ Accept wildcard characters: False
166166
Dynamic: False
167167
```
168168
169-
### -SubscriptionId
170-
The ID of the target subscription.
169+
### -SubnetId
170+
The ARM resource id of the virtual network subnet.
171171
172172
```yaml
173173
Type: System.String
174174
Parameter Sets: (All)
175175
Aliases:
176176

177-
Required: False
177+
Required: True
178178
Position: Named
179-
Default value: (Get-AzContext).Subscription.Id
179+
Default value: None
180180
Accept pipeline input: False
181181
Accept wildcard characters: False
182182
Dynamic: False
183183
```
184184
185-
### -VirtualNetworkSubnetId
186-
The ARM resource id of the virtual network subnet.
185+
### -SubscriptionId
186+
The ID of the target subscription.
187187
188188
```yaml
189189
Type: System.String
190190
Parameter Sets: (All)
191191
Aliases:
192192

193-
Required: True
193+
Required: False
194194
Position: Named
195-
Default value: None
195+
Default value: (Get-AzContext).Subscription.Id
196196
Accept pipeline input: False
197197
Accept wildcard characters: False
198198
Dynamic: False

src/MySql/docs/Restore-AzMySqlServer.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ Restore a server from an existing backup
1515
### GeoRestore (Default)
1616
```
1717
Restore-AzMySqlServer -Name <String> -ResourceGroupName <String> -InputObject <IServer> -UseGeoRestore
18-
[-Location <String>] [-Sku <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait]
19-
[-Confirm] [-WhatIf] [<CommonParameters>]
18+
[-SubscriptionId <String>] [-Location <String>] [-Sku <String>] [-Tag <Hashtable>]
19+
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
2020
```
2121

2222
### PointInTimeRestore
2323
```
2424
Restore-AzMySqlServer -Name <String> -ResourceGroupName <String> -InputObject <IServer>
25-
-RestorePointInTime <DateTime> -UsePointInTimeRestore [-Location <String>] [-Sku <String>] [-Tag <Hashtable>]
26-
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
25+
-RestorePointInTime <DateTime> -UsePointInTimeRestore [-SubscriptionId <String>] [-Location <String>]
26+
[-Sku <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf]
27+
[<CommonParameters>]
2728
```
2829

2930
## DESCRIPTION
@@ -202,6 +203,22 @@ Accept wildcard characters: False
202203
Dynamic: False
203204
```
204205
206+
### -SubscriptionId
207+
The subscription ID that identifies an Azure subscription.
208+
209+
```yaml
210+
Type: System.String
211+
Parameter Sets: (All)
212+
Aliases:
213+
214+
Required: False
215+
Position: Named
216+
Default value: (Get-AzContext).Subscription.Id
217+
Accept pipeline input: False
218+
Accept wildcard characters: False
219+
Dynamic: False
220+
```
221+
205222
### -Tag
206223
Application-specific metadata in the form of key-value pairs.
207224

src/MySql/docs/Update-AzMySqlVirtualNetworkRule.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Creates or updates an existing virtual network rule.
1515
### UpdateExpanded (Default)
1616
```
1717
Update-AzMySqlVirtualNetworkRule -Name <String> -ResourceGroupName <String> -ServerName <String>
18-
-VirtualNetworkSubnetId <String> [-SubscriptionId <String>] [-IgnoreMissingVnetServiceEndpoint]
18+
-SubnetId <String> [-SubscriptionId <String>] [-IgnoreMissingVnetServiceEndpoint]
1919
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
2020
```
2121

2222
### UpdateViaIdentityExpanded
2323
```
24-
Update-AzMySqlVirtualNetworkRule -InputObject <IMySqlIdentity> -VirtualNetworkSubnetId <String>
24+
Update-AzMySqlVirtualNetworkRule -InputObject <IMySqlIdentity> -SubnetId <String>
2525
[-IgnoreMissingVnetServiceEndpoint] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-PassThru] [-Confirm]
2626
[-WhatIf] [<CommonParameters>]
2727
```
@@ -204,33 +204,33 @@ Accept wildcard characters: False
204204
Dynamic: False
205205
```
206206
207-
### -SubscriptionId
208-
The ID of the target subscription.
207+
### -SubnetId
208+
The ARM resource id of the virtual network subnet.
209209
210210
```yaml
211211
Type: System.String
212-
Parameter Sets: UpdateExpanded
212+
Parameter Sets: (All)
213213
Aliases:
214214

215-
Required: False
215+
Required: True
216216
Position: Named
217-
Default value: (Get-AzContext).Subscription.Id
217+
Default value: None
218218
Accept pipeline input: False
219219
Accept wildcard characters: False
220220
Dynamic: False
221221
```
222222
223-
### -VirtualNetworkSubnetId
224-
The ARM resource id of the virtual network subnet.
223+
### -SubscriptionId
224+
The ID of the target subscription.
225225
226226
```yaml
227227
Type: System.String
228-
Parameter Sets: (All)
228+
Parameter Sets: UpdateExpanded
229229
Aliases:
230230

231-
Required: True
231+
Required: False
232232
Position: Named
233-
Default value: None
233+
Default value: (Get-AzContext).Subscription.Id
234234
Accept pipeline input: False
235235
Accept wildcard characters: False
236236
Dynamic: False

src/MySql/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require:
5151
- $(this-folder)/../readme.azure.noprofile.md
5252
input-file:
5353
- $(repo)/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json
54-
module-version: 0.0.1
54+
module-version: 0.1.0
5555
title: MySQL
5656
subject-prefix: 'MySQL'
5757

@@ -90,7 +90,7 @@ directive:
9090
hide: true
9191
- where:
9292
parameter-name: VirtualNetworkSubnetId
93-
subject: VirtualNetwork
93+
subject: VirtualNetworkRule
9494
set:
9595
parameter-name: SubnetId
9696
- where:

src/MySql/test/Get-AzMySqlConfiguration.Recording.json

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

src/MySql/test/Get-AzMySqlConfiguration.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Describe 'Get-AzMySqlConfiguration' {
1919

2020
It 'Get' {
2121
$config = Get-AzMySqlConfiguration -Name time_zone -ResourceGroupName $env.resourceGroup -ServerName $env.serverName
22-
$config.Count | Should -Be 1
22+
$config.Name | Should -Be time_zone
2323
}
2424

2525
It 'GetViaIdentity' {
2626
$ID = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)/providers/Microsoft.DBforMySQL/servers/$($env.serverName)/configurations/server_id"
2727
$config = Get-AzMySqlConfiguration -InputObject $ID
28-
$config.Count | Should -Be 1
28+
$config.Name | Should -Be server_id
2929
}
3030
}

0 commit comments

Comments
 (0)