Skip to content

Commit

Permalink
(maint) Mark tests broken in test kitchen as foss only
Browse files Browse the repository at this point in the history
There are a few E2E tests that we run through test kitchen
that are failing when running on a licensed extension, however
these have not been reproducible outside of test kitchen as of
this date.

As such we mark these tests as only available for Open Source where
they run as expected. Further investigations may be needed to figure
out the root cause of the issue.
  • Loading branch information
AdmiringWorm committed May 2, 2023
1 parent efa2623 commit 7cf83cc
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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"
}
}
Expand Down

0 comments on commit 7cf83cc

Please sign in to comment.