From e0e0d33c1ae7da8e5ccee5ea47c321a4cfdd29af Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Fri, 28 Apr 2023 10:44:25 -0400 Subject: [PATCH 1/2] (tests) upgrade tests for locked files FossOnly These tests fail inexplicably on teamcity only if CLE is installed, but these failures can't be reproduced locally. Marking them as FossOnly for now, we'll file follow up issues in CLE to investigate. --- .../commands/choco-upgrade.Tests.ps1 | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 index 4fb1813d91..22b616d63f 100644 --- a/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 +++ b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 @@ -339,7 +339,11 @@ To upgrade a local, or remote file, you may use: } } - Context "Upgrading a package when installer is locked" { + # 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. + Context "Upgrading a package when installer is locked" -Tag FossOnly { BeforeAll { Restore-ChocolateyInstallSnapshot @@ -402,11 +406,19 @@ To upgrade a local, or remote file, you may use: $null = Invoke-Choco uninstall $PackageUnderTest --confirm } - It "Exits with Failure (1)" { + # 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 "Exits with Failure (1)" -Tag FossOnly { $Output.ExitCode | Should -Be 1 -Because $Output.String } - It "Keeps file '<_>' in the lib directory" -ForEach @('hasinnoinstaller.nuspec', 'hasinnoinstaller.nupkg', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\helloworld-1.0.0.exe', 'tools\helloworld-1.0.0.exe.ignore') { + # 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 "Keeps file '<_>' in the lib directory" -ForEach @('hasinnoinstaller.nuspec', 'hasinnoinstaller.nupkg', 'tools\chocolateyinstall.ps1', 'tools\chocolateyuninstall.ps1', 'tools\helloworld-1.0.0.exe', 'tools\helloworld-1.0.0.exe.ignore') -Tag FossOnly { "$env:ChocolateyInstall\lib\$PackageUnderTest\$_" | Should -Exist } @@ -415,7 +427,11 @@ To upgrade a local, or remote file, you may use: } # Only two files are backed up as we was not able to download and extract the new package - It "Creates backup of file '<_>' in lib-bad" -ForEach @('.chocolateyPending', 'tools\a-locked-file.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 "Creates backup of file '<_>' in lib-bad" -ForEach @('.chocolateyPending', 'tools\a-locked-file.txt') -Tag FossOnly { "$env:ChocolateyInstall\lib-bad\$PackageUnderTest\$PackageVersion\$_" | Should -Exist } @@ -423,8 +439,12 @@ To upgrade a local, or remote file, you may use: "$env:ChocolateyInstall\lib-bad\$PackageUnderTest\$PackageVersion\$_" | Should -Not -Exist } - It "Outputs a message showing that installation failed." { - $Output.Lines | Should -Contain "Chocolatey upgraded 0/1 packages. 1 packages failed." + # 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 "Outputs a message showing that installation failed." -TagFossOnly { + $Output.Lines | Should -Contain "Chocolatey upgraded 0/1 packages. 1 packages failed." -Because $Output.String } } From 3b9bb5743454c16793cf379d6f9725e3361134a5 Mon Sep 17 00:00:00 2001 From: "Rain Sallow (/u/ta11ow)" <32407840+vexx32@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:19:31 -0400 Subject: [PATCH 2/2] Update tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 Co-authored-by: Kim J. Nordmo --- tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 index 22b616d63f..a931b75816 100644 --- a/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 +++ b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 @@ -443,7 +443,8 @@ To upgrade a local, or remote file, you may use: # 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 "Outputs a message showing that installation failed." -TagFossOnly { + It "Outputs a message showing that installation failed." -Tag FossOnly { + $Output.Lines | Should -Contain "Chocolatey upgraded 0/1 packages. 1 packages failed." -Because $Output.String } }