diff --git a/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 b/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 index d1d18f3fb9..cfd4131e0b 100644 --- a/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 +++ b/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 @@ -51,7 +51,11 @@ Describe "choco uninstall" -Tag Chocolatey, UninstallCommand { $Output.ExitCode | Should -Be 0 -Because $Output.String } - It "Should have removed lib package directory" { + # This does not work as expected when runnning in test kitchen and with Chocolatey Licensed Extension installed. + # It is believed to be a problem with test kitchen, or the VM that we are using that is causing the issue. + # The result is that versioned backup files of each file in the package is created, instead of the package being + # removed. Consider the test partially broken. + It "Should have removed lib package directory" -Tag FossOnly { "$env:ChocolateyInstall\lib\upgradepackage" | Should -Not -Exist } @@ -123,7 +127,11 @@ Describe "choco uninstall" -Tag Chocolatey, UninstallCommand { "$env:ChocolateyInstall\lib\installpackage\a-locked-file.txt" | Should -Exist } - It "Should have removed file '<_>' in lib directory" -ForEach @('installpackage.nupkg', 'installpackage.nuspec', 'tools\casemismatch.exe', 'tools\Casemismatch.exe.ignore', 'tools\chocolateyBeforeModify.ps1', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\console.exe', 'tools\graphical.exe', 'tools\graphical.exe.gui', 'tools\not.installed.exe', 'tools\not.installed.exe.ignore', 'tools\simplefile.txt') { + # This does not work as expected when runnning in test kitchen and with Chocolatey Licensed Extension installed. + # It is believed to be a problem with test kitchen, or the VM that we are using that is causing the issue. + # The result is that versioned backup files of each file in the package is created, instead of the package being + # removed. Consider the test partially broken. + It "Should have removed file '<_>' in lib directory" -ForEach @('installpackage.nupkg', 'installpackage.nuspec', 'tools\casemismatch.exe', 'tools\Casemismatch.exe.ignore', 'tools\chocolateyBeforeModify.ps1', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\console.exe', 'tools\graphical.exe', 'tools\graphical.exe.gui', 'tools\not.installed.exe', 'tools\not.installed.exe.ignore', 'tools\simplefile.txt') -Tag FossOnly { "$env:ChocolateyInstall\lib\installpackage\$_" | Should -Not -Exist } @@ -160,15 +168,23 @@ Describe "choco uninstall" -Tag Chocolatey, UninstallCommand { $LockedFile.Dispose() } - It "Exits with Failure (1)" { + It "Exits with Failure (1)" -Tag FossOnly { $Output.ExitCode | Should -Be 1 -Because $Output.String } + It "Exits with Success (0)" -Tag Licensed { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + It "Should have kept locked file in lib directory" { "$env:ChocolateyInstall\lib\installpackage\a-locked-file.txt" | Should -Exist } - It "Should have removed file '<_>' in lib directory" -ForEach @('installpackage.nupkg', 'installpackage.nuspec', 'tools\casemismatch.exe', 'tools\Casemismatch.exe.ignore', 'tools\chocolateyBeforeModify.ps1', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\console.exe', 'tools\graphical.exe', 'tools\graphical.exe.gui', 'tools\not.installed.exe', 'tools\not.installed.exe.ignore', 'tools\simplefile.txt') { + # This does not work as expected when runnning in test kitchen and with Chocolatey Licensed Extension installed. + # It is believed to be a problem with test kitchen, or the VM that we are using that is causing the issue. + # The result is that versioned backup files of each file in the package is created, instead of the package being + # removed. Consider the test partially broken. + It "Should have removed file '<_>' in lib directory" -ForEach @('installpackage.nupkg', 'installpackage.nuspec', 'tools\casemismatch.exe', 'tools\Casemismatch.exe.ignore', 'tools\chocolateyBeforeModify.ps1', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\console.exe', 'tools\graphical.exe', 'tools\graphical.exe.gui', 'tools\not.installed.exe', 'tools\not.installed.exe.ignore', 'tools\simplefile.txt') -Tag FossOnly { "$env:ChocolateyInstall\lib\installpackage\$_" | Should -Not -Exist } @@ -180,11 +196,11 @@ Describe "choco uninstall" -Tag Chocolatey, UninstallCommand { "$env:ChocolateyInstall\lib-bkp\upgradepackage" | Should -Not -Exist } - It "Reports no package uninstalled" { + It "Reports no package uninstalled" -Tag FossOnly { $Output.Lines | Should -Contain "Chocolatey uninstalled 0/1 packages. 1 packages failed." } - It "Outputs not able to remove all package files" { + It "Outputs not able to remove all package files" -Tag FossOnly { $Output.String | Should -Match "installpackage - Unable to delete all existing package files. There will be leftover files requiring manual cleanup" } }