Skip to content

Commit 2bf7ee2

Browse files
andreasjordanclaude
andcommitted
Rename-DbaDatabase - Build expected file paths without validating drives of the test client
(do Rename-DbaDatabase) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0473789 commit 2bf7ee2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/Rename-DbaDatabase.Tests.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,14 @@ Describe $CommandName -Tag IntegrationTests {
240240
$dataExtension = [System.IO.Path]::GetExtension($previewDataFile.FileName)
241241
$logExtension = [System.IO.Path]::GetExtension($previewLogFile.FileName)
242242

243-
$fileOverrideResults.FNN[$previewDataFile.FileName] | Should -Be (Join-Path -Path $dataDirectory -ChildPath "dbatoolsci_filemove_data_override$dataExtension")
244-
$fileOverrideResults.FNN[$previewLogFile.FileName] | Should -Be (Join-Path -Path $logDirectory -ChildPath "dbatoolsci_filemove_log_override$logExtension")
245-
$fileDefaultResults.FNN[$previewDataFile.FileName] | Should -Be (Join-Path -Path $dataDirectory -ChildPath "dbatoolsci_filemove_ROWS$dataExtension")
246-
$fileDefaultResults.FNN[$previewLogFile.FileName] | Should -Be (Join-Path -Path $logDirectory -ChildPath "dbatoolsci_filemove_journal$logExtension")
243+
# Combine instead of Join-Path: these are paths of the instance, and Windows PowerShell
244+
# validates the drive of Join-Path against the drives of the machine running the test,
245+
# which does not have to own a drive the remote instance keeps its files on. Combine is
246+
# also what the command itself builds the new path with.
247+
$fileOverrideResults.FNN[$previewDataFile.FileName] | Should -Be ([System.IO.Path]::Combine($dataDirectory, "dbatoolsci_filemove_data_override$dataExtension"))
248+
$fileOverrideResults.FNN[$previewLogFile.FileName] | Should -Be ([System.IO.Path]::Combine($logDirectory, "dbatoolsci_filemove_log_override$logExtension"))
249+
$fileDefaultResults.FNN[$previewDataFile.FileName] | Should -Be ([System.IO.Path]::Combine($dataDirectory, "dbatoolsci_filemove_ROWS$dataExtension"))
250+
$fileDefaultResults.FNN[$previewLogFile.FileName] | Should -Be ([System.IO.Path]::Combine($logDirectory, "dbatoolsci_filemove_journal$logExtension"))
247251
}
248252
}
249253

0 commit comments

Comments
 (0)