Skip to content

Commit 554eb9a

Browse files
committed
Merge pull request #37 from Azure/dev
.
2 parents 8cda112 + c9ab5f7 commit 554eb9a

File tree

57 files changed

+18804
-62708
lines changed

Some content is hidden

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

57 files changed

+18804
-62708
lines changed

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Scripts/Common.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ Get test key name
2323
#>
2424
function Get-KeyVault([bool] $haspermission=$true)
2525
{
26-
if ($global:testEnv -eq 'BVT' -and $haspermission)
26+
if ($global:testVault -ne "" -and $haspermission)
27+
{
28+
return $global:testVault
29+
}
30+
elseif ($global:testEnv -eq 'BVT' -and $haspermission)
2731
{
2832
return 'powershellbvt'
2933
}

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Scripts/RunKeyVaultTests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
[Parameter(Mandatory=$false,Position=1)]
55
[ValidateSet('ControlPlane','DataPlane', 'All')]
66
[string]$TestMode = 'All',
7-
[Parameter(Mandatory=$false,Position=2, ParameterSetName="DPTests")]
8-
[ValidateSet('BVT','PROD')]
9-
[string]$TestEnvironment = 'PROD',
10-
[Parameter(Mandatory=$false,Position=2, ParameterSetName="CPTests")]
11-
[string]$Location = 'eastus2'
7+
[Parameter(Mandatory=$false,Position=2)]
8+
[string]$Location = 'eastus2',
9+
[Parameter(Mandatory=$false, Position=3)]
10+
[string]$Vault = ""
1211
)
1312

1413
$invocationPath = Split-Path $MyInvocation.MyCommand.Definition;
@@ -26,9 +25,10 @@ $global:passedCount = 0;
2625
$global:passedTests = @()
2726
$global:failedTests = @()
2827
$global:times = @{}
29-
$global:testEnv = $TestEnvironment.ToUpperInvariant()
28+
$global:testEnv = 'PROD';
3029
$global:testns = $TestRunNameSpace
3130
$global:location = $location
31+
$global:testVault = $Vault
3232

3333
function Run-TestProtected
3434
{

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

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -240,103 +240,94 @@
240240
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
241241
</None>
242242
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingBasicRuleLifecycle.json">
243-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
244-
</None>
245-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingLevelChanges.json">
246-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
243+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
247244
</None>
248245
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingNumberRuleLifecycle.json">
249-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
246+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
250247
</None>
251248
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingPolicyEnablementToggling.json">
252-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
249+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
253250
</None>
254251
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingPrivilegedLoginsChanges.json">
255-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
252+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
256253
</None>
257254
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingRuleCreationFailures.json">
258-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
255+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
259256
</None>
260257
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingTextRuleLifecycle.json">
261-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
262-
</None>
263-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseDirectAccess.json">
264-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
258+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
265259
</None>
266260
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseDisableEnableKeepProperties.json">
267-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
261+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
268262
</None>
269263
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseRetentionKeepProperties.json">
270-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
264+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
271265
</None>
272266
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseStorageKeyRotation.json">
273-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
267+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
274268
</None>
275269
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyKeepPreviousStorage.json">
276-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
270+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
277271
</None>
278272
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithEventTypes.json">
279-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
273+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
280274
</None>
281275
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithEventTypeShortcuts.json">
282-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
276+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
283277
</None>
284278
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithRetention.json">
285-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
279+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
286280
</None>
287281
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithStorage.json">
288-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
282+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
289283
</None>
290284
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDisableDatabaseAuditing.json">
291-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
285+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
292286
</None>
293287
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDisableServerAuditing.json">
294-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
288+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
295289
</None>
296290
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestFailedDatabaseUpdatePolicyWithNoStorage.json">
297-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
291+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
298292
</None>
299293
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestFailedServerUpdatePolicyWithNoStorage.json">
300-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
294+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
301295
</None>
302296
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestFailedUseServerDefault.json">
303-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
297+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
304298
</None>
305299
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestFailWithBadDatabaseIndentity.json">
306-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
300+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
307301
</None>
308302
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestFailWithBadServerIndentity.json">
309-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
310-
</None>
311-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerDirectAccess.json">
312-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
303+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
313304
</None>
314305
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerDisableEnableKeepProperties.json">
315-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
306+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
316307
</None>
317308
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerRetentionKeepProperties.json">
318-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
309+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
319310
</None>
320311
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerStorageKeyRotation.json">
321-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
312+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
322313
</None>
323314
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerUpdatePolicyKeepPreviousStorage.json">
324-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
315+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
325316
</None>
326317
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerUpdatePolicyWithEventTypes.json">
327-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
318+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
328319
</None>
329320
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerUpdatePolicyWithEventTypeShortcuts.json">
330-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
321+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
331322
</None>
332323
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerUpdatePolicyWithRetention.json">
333-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
324+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
334325
</None>
335326
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestServerUpdatePolicyWithStorage.json">
336-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
327+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
337328
</None>
338329
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestUseServerDefault.json">
339-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
330+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
340331
</None>
341332
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResume.json">
342333
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -428,6 +419,9 @@
428419
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerUpgradeTests\TestServerUpgradeNegative.json">
429420
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
430421
</None>
422+
<None Include="Templates\sql-ddm-test-env-setup.json">
423+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
424+
</None>
431425
<None Include="Templates\sql-audit-test-env-setup.json">
432426
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
433427
</None>

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/Common.ps1

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,19 @@ function Get-SqlAuditingTestEnvironmentParameters ($testSuffix)
2727

2828
<#
2929
.SYNOPSIS
30-
Gets the values of the parameters used at the data masking tests
30+
Gets the values of the parameters used by the data masking tests
3131
#>
3232
function Get-SqlDataMaskingTestEnvironmentParameters ($testSuffix)
3333
{
3434
return @{ rgname = "sql-dm-cmdlet-test-rg" +$testSuffix;
3535
serverName = "sql-dm-cmdlet-server" +$testSuffix;
36-
databaseName = "sql-dm-cmdlet-db" + $testSuffix
37-
}
38-
}
39-
40-
<#
41-
.SYNOPSIS
42-
Gets the values of the parameters used in the s
43-
#>
44-
function Get-SqlDataMaskingTestEnvironmentParameters ($testSuffix)
45-
{
46-
return @{ rgname = "sql-dm-cmdlet-test-rg" +$testSuffix;
47-
serverName = "sql-dm-cmdlet-server" +$testSuffix;
48-
databaseName = "sql-dm-cmdlet-db" + $testSuffix
36+
databaseName = "sql-dm-cmdlet-db" + $testSuffix;
37+
userName = "testuser";
38+
pwd = "testp@ssMakingIt1007Longer";
39+
table1="table1";
40+
column1 = "column1";
41+
table2="table2";
42+
column2 = "column2"
4943
}
5044
}
5145

@@ -76,7 +70,37 @@ Creates the test environment needed to perform the Sql data masking tests
7670
function Create-DataMaskingTestEnvironment ($testSuffix)
7771
{
7872
$params = Get-SqlDataMaskingTestEnvironmentParameters $testSuffix
79-
New-AzureResourceGroup -Name $params.rgname -Location "West US" -TemplateFile ".\Templates\sql-audit-test-env-setup.json" -serverName $params.serverName -databaseName $params.databaseName -EnvLocation "West US" -Force
73+
New-AzureResourceGroup -Name $params.rgname -Location "West US" -TemplateFile ".\Templates\sql-ddm-test-env-setup.json" -serverName $params.serverName -databaseName $params.databaseName -EnvLocation "West US" -administratorLogin $params.userName -Force
74+
$fullServerName = $params.serverName + ".database.windows.net"
75+
$uid = $params.userName
76+
$pwd = $params.pwd
77+
$databaseName=$params.databaseName
78+
$connectionString = "Server=$fullServerName;uid=$uid; pwd=$pwd;Database=$databaseName;Integrated Security=False;"
79+
$connection = New-Object System.Data.SqlClient.SqlConnection
80+
$connection.ConnectionString = $connectionString
81+
try
82+
{
83+
$connection.Open()
84+
$table1 = $params.table1
85+
$column1 = $params.column1
86+
$query = "CREATE TABLE $table1 ($column1 NVARCHAR(20)NOT NULL);"
87+
$command = $connection.CreateCommand()
88+
$command.CommandText = $query
89+
$command.ExecuteReader()
90+
$table2 = $params.table2
91+
$column2 = $params.column2
92+
$query = "CREATE TABLE $table2 ($column2 NVARCHAR(20)NOT NULL);"
93+
$command = $connection.CreateCommand()
94+
$command.CommandText = $query
95+
$command.ExecuteReader()
96+
}
97+
catch
98+
{
99+
}
100+
finally
101+
{
102+
$connection.Close()
103+
}
80104
return $params
81105
}
82106

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ public void TestDatabaseDataMaskingPolicyEnablementToggling()
2727
RunPowerShellTest("Test-DatabaseDataMaskingPolicyEnablementToggling");
2828
}
2929

30-
[Fact]
31-
[Trait(Category.RunType, Category.LiveOnly)]
32-
public void TestDatabaseDataMaskingLevelChanges()
33-
{
34-
RunPowerShellTest("Test-DatabaseDataMaskingLevelChanges");
35-
}
36-
3730
[Fact]
3831
[Trait(Category.RunType, Category.LiveOnly)]
3932
public void TestDatabaseDataMaskingPrivilegedLoginsChanges()

0 commit comments

Comments
 (0)