Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
* Starting blob event trigger fails with 'Resource cannot be updated during provisioning' - now waits for provisioning to complete before retrying #484, #474, #463
* Fixed REST API calls failing with 401 Unauthorized due to Az.Accounts 5.x returning SecureString from Get-AzAccessToken
* Fixed DryRun not loading deployment state from storage for hash comparison #476
* Fixed DryRun not loading deployment state from storage for hash comparison #475
* README.md updated and new Structured Documentation created

## [1.14.0] - 2025-10-24
Expand Down
54 changes: 54 additions & 0 deletions test/Publish-AdfV2FromJson-DryRun.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
BeforeDiscovery {
$ModuleRootPath = $PSScriptRoot | Split-Path -Parent
$moduleManifestName = 'azure.datafactory.tools.psd1'
$moduleManifestPath = Join-Path -Path $ModuleRootPath -ChildPath $moduleManifestName

Import-Module -Name $moduleManifestPath -Force -Verbose:$false
$m = Get-Module -Name 'azure.datafactory.tools'
$script:verStr = $m.Version.ToString(2) + "." + $m.Version.Build.ToString("000")
}

InModuleScope azure.datafactory.tools {
$testHelperPath = $PSScriptRoot | Join-Path -ChildPath 'TestHelper'
Import-Module -Name $testHelperPath -Force

$m = Get-Module -Name 'azure.datafactory.tools'
$script:verStr = $m.Version.ToString(2) + "." + $m.Version.Build.ToString("000")

$script:RootFolder = Join-Path $PSScriptRoot 'adf2'
$script:ResourceGroupName = 'rg-test'
$script:DataFactoryName = 'adf-test'
$script:Location = 'West Europe'

Describe 'Publish-AdfV2FromJson DryRun incremental deployment' -Tag 'Unit' {
BeforeEach {
Mock Get-StateFromStorage {
[AdfDeploymentState]::new($script:verStr)
}

Mock Set-StateToStorage {
}
}

It 'should still load deployment state from storage when DryRun is enabled' {
$opt = New-AdfPublishOption
$opt.IncrementalDeployment = $true
$opt.IncrementalDeploymentStorageUri = 'https://example.blob.core.windows.net/adftools/folder'
$opt.StopStartTriggers = $false
$opt.DeleteNotInSource = $false

{
Publish-AdfV2FromJson `
-RootFolder $script:RootFolder `
-ResourceGroupName $script:ResourceGroupName `
-DataFactoryName $script:DataFactoryName `
-Location $script:Location `
-Option $opt `
-DryRun
} | Should -Not -Throw

Should -Invoke -CommandName Get-StateFromStorage -Times 1 -Exactly
Should -Invoke -CommandName Set-StateToStorage -Times 0 -Exactly
}
}
}
Loading