Skip to content

Commit 9dcd58d

Browse files
author
John Paul Kee
committed
Update permissive record matcher, fix recording of TestGetManagedDatabaseGeoBackup.json, ignore api versions for Microsoft.Sql, and bump Microsoft.Azure.Management.Sql version to 1.33.0-preview
1 parent f0c250f commit 9dcd58d

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/Sql/Sql.Test/ScenarioTests/SqlTestsBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ protected void RunPowerShellTest(params string[] scripts)
6969
{"Microsoft.Features", null},
7070
{"Microsoft.Authorization", null},
7171
{"Microsoft.Network", null},
72-
{"Microsoft.KeyVault", null}
73-
72+
{"Microsoft.KeyVault", null},
73+
{"Microsoft.Sql", null }
7474
};
7575
var providersToIgnore = new Dictionary<string, string>
7676
{

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ManagedDatabaseCrudScenarioTests/TestGetManagedDatabaseGeoBackup.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Entries": [
33
{
4-
"RequestUri": "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases/sourcedb?api-version=2017-10-01-preview",
4+
"RequestUri": "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases/sourcedb?api-version=2017-10-01-preview",
55
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYThjOWE5MjQtMDZjMC00YmRlLTk3ODgtZTdiMTM3MDk2OWUxL3Jlc291cmNlR3JvdXBzL3Jlc3RvcmUtcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvbWFuYWdlZEluc3RhbmNlcy90ZXN0YnJpbnN0YW5jZS9yZWNvdmVyYWJsZURhdGFiYXNlcy9zb3VyY2VkYj9hcGktdmVyc2lvbj0yMDE3LTEwLTAxLXByZXZpZXc=",
66
"RequestMethod": "GET",
77
"RequestBody": "",
@@ -60,11 +60,11 @@
6060
"-1"
6161
]
6262
},
63-
"ResponseBody": "{\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.0539401Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases/sourcedb\",\r\n \"name\": \"sourcedb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n}",
63+
"ResponseBody": "{\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.0539401Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases/sourcedb\",\r\n \"name\": \"sourcedb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n}",
6464
"StatusCode": 200
6565
},
6666
{
67-
"RequestUri": "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases?api-version=2017-10-01-preview",
67+
"RequestUri": "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases?api-version=2017-10-01-preview",
6868
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYThjOWE5MjQtMDZjMC00YmRlLTk3ODgtZTdiMTM3MDk2OWUxL3Jlc291cmNlR3JvdXBzL3Jlc3RvcmUtcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvbWFuYWdlZEluc3RhbmNlcy90ZXN0YnJpbnN0YW5jZS9yZWNvdmVyYWJsZURhdGFiYXNlcz9hcGktdmVyc2lvbj0yMDE3LTEwLTAxLXByZXZpZXc=",
6969
"RequestMethod": "GET",
7070
"RequestBody": "",
@@ -123,7 +123,7 @@
123123
"-1"
124124
]
125125
},
126-
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases/testrecovered1\",\r\n \"name\": \"testrecovered1\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases/sourcedb\",\r\n \"name\": \"sourcedb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/georestore-rg/providers/Microsoft.Sql/managedInstances/testinstance/recoverableDatabases/testbrdb\",\r\n \"name\": \"testbrdb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n }\r\n ]\r\n}",
126+
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases/testrecovered1\",\r\n \"name\": \"testrecovered1\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases/sourcedb\",\r\n \"name\": \"sourcedb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-20T22:16:05.4133047Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/testbrinstance/recoverableDatabases/testbrdb\",\r\n \"name\": \"testbrdb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n }\r\n ]\r\n}",
127127
"StatusCode": 200
128128
}
129129
],

src/Sql/Sql.Test/Sql.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<PsModuleName>Sql</PsModuleName>
@@ -19,7 +19,7 @@
1919
<PackageReference Include="Microsoft.Azure.KeyVault.WebKey" Version="3.0.1" />
2020
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
2121
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />
22-
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.31.0-preview" />
22+
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.33.0-preview" />
2323
</ItemGroup>
2424

2525
<ItemGroup>

src/Sql/Sql/Sql.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<PsModuleName>Sql</PsModuleName>
@@ -21,10 +21,10 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.31.0-preview" />
24+
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.33.0-preview" />
2525
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
2626
</ItemGroup>
27-
27+
2828
<ItemGroup>
2929
<ProjectReference Include="..\Sql.LegacySdk\Sql.LegacySdk.csproj" />
3030
</ItemGroup>

tools/ScenarioTest.ResourceManager/PermissiveRecordMatcherWithApiExclusion.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
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-
// ----------------------------------------------------------------------------------
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+
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Test.HttpRecorder;
1616
using System;
@@ -21,7 +21,7 @@
2121

2222
namespace Microsoft.WindowsAzure.Commands.ScenarioTest
2323
{
24-
// Excludes api version when matching mocked records.
24+
// Excludes api version when matching mocked records.
2525
// If alternate api version is provided, uses that to match records else removes the api-version matching.
2626
public class PermissiveRecordMatcherWithApiExclusion : IRecordMatcher
2727
{
@@ -47,7 +47,7 @@ public PermissiveRecordMatcherWithApiExclusion(
4747

4848
public virtual string GetMatchingKey(System.Net.Http.HttpRequestMessage request)
4949
{
50-
var path = request.RequestUri.PathAndQuery;
50+
var path = Uri.UnescapeDataString(request.RequestUri.PathAndQuery);
5151
if (path.Contains("?&"))
5252
{
5353
path = path.Replace("?&", "?");
@@ -81,7 +81,7 @@ public virtual string GetMatchingKey(System.Net.Http.HttpRequestMessage request)
8181
public virtual string GetMatchingKey(RecordEntry recordEntry)
8282
{
8383
var encodedPath = recordEntry.EncodedRequestUri;
84-
var path = recordEntry.RequestUri;
84+
var path = Uri.UnescapeDataString(recordEntry.RequestUri);
8585
var changed = false;
8686
if (path.Contains("?&"))
8787
{

0 commit comments

Comments
 (0)