-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix /OutputPath conflict in DeployReport, DriftReport, and Script actions in SqlAzureDacpacDeploymentV1 #21982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c3ad347
Fix /OutputPath conflict when passed in additional arguments
v-dko 0698a7e
Added feature flag
v-dko 920df4e
Merge branch 'master' of https://github.com/microsoft/azure-pipelines…
v-dko 5e861e5
Merge branch 'master' into users/v-dko1/sqldacpacdeploymentdriftissuefix
v-dko e4196f6
modified changes and included l0 test cases
v-dko 6a6432a
Merge branch 'users/v-dko1/sqldacpacdeploymentdriftissuefix' of https…
v-dko 2d1eb6f
modified changes as per suggestions
v-dko fc26e43
modified regex conditions
v-dko 998e321
Merge branch 'master' into users/v-dko1/sqldacpacdeploymentdriftissuefix
v-dko ed88695
Merge branch 'master' into users/v-dko1/sqldacpacdeploymentdriftissuefix
v-dko e2d7d07
Merge branch 'master' into users/v-dko1/sqldacpacdeploymentdriftissuefix
v-dko 752b10f
Merge branch 'master' into users/v-dko1/sqldacpacdeploymentdriftissuefix
v-dko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
Tasks/SqlAzureDacpacDeploymentV1/Tests/L0GetEffectiveOutputPath.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| [CmdletBinding()] | ||
| param() | ||
|
|
||
| . $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1 | ||
| . $PSScriptRoot\MockVariable.ps1 | ||
|
|
||
| $ENV:SYSTEM_DEFAULTWORKINGDIRECTORY = "C:\DefaultWorkingDirectory" | ||
|
|
||
| Register-Mock Get-VstsPipelineFeature { return $true } | ||
| . $PSScriptRoot\..\SqlAzureActions.ps1 | ||
|
|
||
| $defaultPath = "C:\DefaultWorkingDirectory\GeneratedOutputFiles\TestDatabase_DriftReport.xml" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $false | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/SomeOtherArg /OutputPath:"C:\Custom\out.xml"' | ||
| Assert-AreEqual $defaultPath $result.EffectiveOutputPath "Feature flag off: EffectiveOutputPath should be default" | ||
| Assert-AreEqual $defaultPath $result.ResolvedFilePath "Feature flag off: ResolvedFilePath should be default" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/SomeOtherArg /AnotherArg:value' | ||
| Assert-AreEqual $defaultPath $result.EffectiveOutputPath "No /OutputPath: EffectiveOutputPath should be default" | ||
| Assert-AreEqual $defaultPath $result.ResolvedFilePath "No /OutputPath: ResolvedFilePath should be default" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/OutputPath:C:\Custom\out.xml' | ||
| Assert-AreEqual $null $result.EffectiveOutputPath "Colon unquoted: EffectiveOutputPath should be null" | ||
| Assert-AreEqual 'C:\Custom\out.xml' $result.ResolvedFilePath "Colon unquoted: ResolvedFilePath should be user path" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/OutputPath:"C:\My Custom Path\out.xml"' | ||
| Assert-AreEqual $null $result.EffectiveOutputPath "Colon quoted: EffectiveOutputPath should be null" | ||
| Assert-AreEqual 'C:\My Custom Path\out.xml' $result.ResolvedFilePath "Colon quoted: ResolvedFilePath should be user path with spaces" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/OutputPath=C:\Custom\out.xml' | ||
| Assert-AreEqual $defaultPath $result.EffectiveOutputPath "Equals syntax: EffectiveOutputPath should be default (not detected)" | ||
| Assert-AreEqual $defaultPath $result.ResolvedFilePath "Equals syntax: ResolvedFilePath should be default (not detected)" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/outputpath:"C:\My Path\out.xml"' | ||
| Assert-AreEqual $null $result.EffectiveOutputPath "Case insensitive: EffectiveOutputPath should be null" | ||
| Assert-AreEqual 'C:\My Path\out.xml' $result.ResolvedFilePath "Case insensitive: ResolvedFilePath should be user path" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| Assert-Throws { | ||
| Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/OutputPath:""' | ||
| } -MessagePattern "*User-provided /OutputPath is empty or invalid*" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '' | ||
| Assert-AreEqual $defaultPath $result.EffectiveOutputPath "Empty args: EffectiveOutputPath should be default" | ||
| Assert-AreEqual $defaultPath $result.ResolvedFilePath "Empty args: ResolvedFilePath should be default" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments $null | ||
| Assert-AreEqual $defaultPath $result.EffectiveOutputPath "Null args: EffectiveOutputPath should be default" | ||
| Assert-AreEqual $defaultPath $result.ResolvedFilePath "Null args: ResolvedFilePath should be default" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/TargetTimeout:120 /OutputPath:"D:\Reports\deploy.xml" /Verbose' | ||
| Assert-AreEqual $null $result.EffectiveOutputPath "Mixed args: EffectiveOutputPath should be null" | ||
| Assert-AreEqual 'D:\Reports\deploy.xml' $result.ResolvedFilePath "Mixed args: ResolvedFilePath should be user path" | ||
|
|
||
| $featureFlags.enableUserOutputPath = $true | ||
| $result = Get-EffectiveOutputPath -defaultOutputPath $defaultPath -additionalArguments '/OutputPath : "C:\Spaced\out.xml"' | ||
| Assert-AreEqual $null $result.EffectiveOutputPath "Spaces around colon: EffectiveOutputPath should be null" | ||
| Assert-AreEqual 'C:\Spaced\out.xml' $result.ResolvedFilePath "Spaces around colon: ResolvedFilePath should be user path" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.