From 8c1e1b0c958aa33bb40131c9b466b5fde4c6c89c Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Wed, 21 Sep 2022 09:15:36 -0700 Subject: [PATCH 1/6] (#2787) Restore Chocolatey snapshot before sxs The info tests enable a proxy that prevents the side by side tests from actually working correctly. This restores the Snapshot so we have a fresh Chocolatey installation to test against. --- tests/chocolatey-tests/choco-info.Tests.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/chocolatey-tests/choco-info.Tests.ps1 b/tests/chocolatey-tests/choco-info.Tests.ps1 index 81038b7432..1356d18aa9 100644 --- a/tests/chocolatey-tests/choco-info.Tests.ps1 +++ b/tests/chocolatey-tests/choco-info.Tests.ps1 @@ -145,6 +145,7 @@ Describe "choco info" -Tag Chocolatey, InfoCommand { Context "Listing package information about local side by side installed package" { BeforeAll { + Restore-ChocolateyInstallSnapshot $null = Invoke-Choco install 'isdependency' --confirm --sxs $Output = Invoke-Choco info 'isdependency' --local-only From 37c942c93c2691bb75087bbc7b7b1bc021f4895e Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Mon, 26 Sep 2022 06:56:00 -0700 Subject: [PATCH 2/6] (#798) Add tests for pinning package on install Add tests that we are pinning packages when during upgrade and install when done with the `--pin` parameter. --- .../chocolatey-tests/choco-install.Tests.ps1 | 31 +++++++++++++++++++ .../chocolatey-tests/choco-upgrade.Tests.ps1 | 27 ++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/tests/chocolatey-tests/choco-install.Tests.ps1 b/tests/chocolatey-tests/choco-install.Tests.ps1 index 2a810317b5..5039cbe3d1 100644 --- a/tests/chocolatey-tests/choco-install.Tests.ps1 +++ b/tests/chocolatey-tests/choco-install.Tests.ps1 @@ -1393,6 +1393,37 @@ Describe "choco install" -Tag Chocolatey, InstallCommand { } } + Context "Install '' package with () specified" -ForEach @( + @{ Command = '--pin' ; Package = 'installpackage' ; Contains = $true } + @{ Command = '' ; Package = 'installpackage' ; Contains = $false } + @{ Command = '' ; Package = 'packages.config' ; Contains = $true } + ) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + if ($Package -eq 'packages.config') { + @" + + + + +"@ | Set-Content $PWD/packages.config + } + + $null = Invoke-Choco install $Package $Command --confirm + $Output = Invoke-Choco pin list + } + + It "Output should include pinned package" { + if ($Contains) { + $Output.String | Should -Match "installpackage|1.0.0" + } + else { + $Output.String | Should -Not -Match "installpackage|1.0.0" + } + } + } + Context "Installing package that extracts local zip archive while disabling logging" { BeforeAll { Restore-ChocolateyInstallSnapshot diff --git a/tests/chocolatey-tests/choco-upgrade.Tests.ps1 b/tests/chocolatey-tests/choco-upgrade.Tests.ps1 index 25b8d785fc..593c1fdee2 100644 --- a/tests/chocolatey-tests/choco-upgrade.Tests.ps1 +++ b/tests/chocolatey-tests/choco-upgrade.Tests.ps1 @@ -120,6 +120,33 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand { } } + Context "Upgrade package with () specified" -ForEach @( + @{ Command = '--pin' ; Contains = $true } + @{ Command = '' ; Contains = $false } + ) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Package = 'upgradepackage' + $null = Invoke-Choco install $Package --version 1.0.0 --confirm + $null = Invoke-Choco upgrade $Package $Command --confirm + $Output = Invoke-Choco pin list + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Output should include pinned package" { + if ($Contains) { + $Output.String | Should -Match "$Package|1.1.0" + } + else { + $Output.String | Should -Not -Match "$Package|1.1.0" + } + } + } + Context "Upgrading packages while remembering arguments with only one package using arguments" -Tag Internal { BeforeAll { Restore-ChocolateyInstallSnapshot From d1614372166215c608273d5f89a064af48069647 Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Wed, 21 Sep 2022 09:17:17 -0700 Subject: [PATCH 3/6] (maint) Minor formatting change --- tests/chocolatey-tests/choco-install.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/chocolatey-tests/choco-install.Tests.ps1 b/tests/chocolatey-tests/choco-install.Tests.ps1 index 5039cbe3d1..e817259ceb 100644 --- a/tests/chocolatey-tests/choco-install.Tests.ps1 +++ b/tests/chocolatey-tests/choco-install.Tests.ps1 @@ -1282,7 +1282,7 @@ Describe "choco install" -Tag Chocolatey, InstallCommand { } # Issue: https://github.com/chocolatey/chocolatey-licensed-issues/issues/284 - Context "Installing a Package with Embedded Zip Archive and specifying destination " -Foreach @( + Context "Installing a Package with Embedded Zip Archive and specifying destination " -ForEach @( @{ Name = 'Root of UNC share' ; Path = '\\localhost\c$\' } @{ Name = 'UNC share path' ; Path = '\\localhost\c$\temp\' } @{ Name = 'Root of drive with trailing slash' ; Path = 'C:\' } From 93503843d37e741451d1a6e90c6653349ad87ae7 Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Wed, 21 Sep 2022 09:26:15 -0700 Subject: [PATCH 4/6] (#1185) Add tests for hook scripts Add tests that hook scripts execute in scenarios where they're expected to run. --- .../services/PowershellService.cs | 3 + tests/chocolatey-tests/Hooks.Tests.ps1 | 93 +++++++++++++++++++ tests/chocolatey-tests/chocolatey.Tests.ps1 | 8 +- 3 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 tests/chocolatey-tests/Hooks.Tests.ps1 diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index e57e66b98e..0eff99c008 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -91,6 +91,9 @@ private IEnumerable get_hook_scripts(ChocolateyConfiguration configurati // If skipping hook scripts, return an empty list if (configuration.SkipHookScripts) return hookScriptPaths; + // If hooks directory doesn't exist, return an empty list to prevent directory not exist warnings + if (!_fileSystem.directory_exists(ApplicationParameters.HooksLocation)) return hookScriptPaths; + string filenameBase; if (isPreHook) diff --git a/tests/chocolatey-tests/Hooks.Tests.ps1 b/tests/chocolatey-tests/Hooks.Tests.ps1 new file mode 100644 index 0000000000..2087bdbe5b --- /dev/null +++ b/tests/chocolatey-tests/Hooks.Tests.ps1 @@ -0,0 +1,93 @@ +Import-Module helpers/common-helpers + +Describe "hooks tests" -Tag Chocolatey, Hooks { + BeforeDiscovery { + $Flags = @( + @{ Flag = '' ; RunsHooks = $true ; Command = 'install' } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' } + + @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' } + + @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' } + + ) + } + BeforeAll { + Initialize-ChocolateyTestInstall + # Add the hooks package to the test install so that it is available in each snapshot. + $null = Invoke-Choco install scriptpackage.hook --version 1.0.0 + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context ' hooks with flag: ' -ForEach $Flags { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $Package = 'upgradepackage' + + if ($Command -ne 'install') { + $ver = if ($Command -eq 'upgrade') { + '1.0.0' + } + else { + '1.1.0' + } + $null = Invoke-Choco install $Package --version $ver --no-progress + } + + $Output = Invoke-Choco $Command $Package $Flag --no-progress + } + + # Uninstall/Upgrade exit -1: https://github.com/chocolatey/choco/issues/2822 + It "Exits with Success (0,-1)" { + $Output.ExitCode | Should -BeIn @(0, -1) -Because $Output.String + } + + It "Should execute hooks ()" { + $Version = '1.1.0' + + $Messages = @( + if ($Command -eq 'uninstall') { + "pre-uninstall-all.ps1 hook ran for $Package $Version" + "post-uninstall-all.ps1 hook ran for $Package $Version" + "pre-uninstall-$Package.ps1 hook ran for $Package $Version" + "post-uninstall-$Package.ps1 hook ran for $Package $Version" + "pre-beforemodify-all.ps1 hook ran for $Package $Version" + "post-beforemodify-all.ps1 hook ran for $Package $Version" + "pre-beforemodify-$Package.ps1 hook ran for $Package $Version" + "post-beforemodify-$Package.ps1 hook ran for $Package $Version" + } + else { + "pre-install-all.ps1 hook ran for $Package $Version" + "post-install-all.ps1 hook ran for $Package $Version" + "pre-install-$Package.ps1 hook ran for $Package $Version" + "post-install-$Package.ps1 hook ran for $Package $Version" + } + + if ($Command -eq 'upgrade') { + "pre-beforemodify-all.ps1 hook ran for $Package 1.0.0" + "pre-beforemodify-$Package.ps1 hook ran for $Package 1.0.0" + } + ) + + foreach ($msg in $Messages) { + if ($RunsHooks) { + $Output.Lines | Should -Contain $msg -Because $Output.String + } + else { + $Output.Lines | Should -Not -Contain $msg -Because $Output.String + } + } + + $Output.Lines | Should -Not -Contain "pre-$Command-doesnotexist.ps1 hook ran for $Package $Version" -Because $Output.String + } + } +} diff --git a/tests/chocolatey-tests/chocolatey.Tests.ps1 b/tests/chocolatey-tests/chocolatey.Tests.ps1 index b89d2d0ccb..de3a47c88a 100644 --- a/tests/chocolatey-tests/chocolatey.Tests.ps1 +++ b/tests/chocolatey-tests/chocolatey.Tests.ps1 @@ -139,13 +139,7 @@ Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolat # This is FossOnly for now as there are some undetermined errors here that do not seem to present inside of Chocolatey. https://gitlab.com/chocolatey/build-automation/chocolatey-test-kitchen/-/issues/39 It "Should be able to run the script in AllSigned mode" -Skip:($_ -notin $PowerShellFiles) -Tag FossOnly { - # The chocolateyScriptRunner expects some passed in values and results in two errors if they're not there. This accounts for that. - $expectedErrors = if ($FileUnderTest.Name -eq 'chocolateyScriptRunner.ps1') { - 2 - } - else { - 0 - } + $expectedErrors = 0 $command = "Import-Module $FileUnderTest -ErrorAction SilentlyContinue; exit `$error.count" & powershell.exe -noprofile -ExecutionPolicy AllSigned -command $command 2>$null $LastExitCode | Should -BeExactly $expectedErrors From 8cb1f2375f542311d264b4da68dcf90153be0a96 Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Fri, 23 Sep 2022 10:57:34 -0700 Subject: [PATCH 5/6] (maint) Pester test directory structure shuffle Move the command tests into a new commands directory, with features in a new features directory. This should make it easier and clearer which tests are specific to what aspects of Chocolatey. --- .../{ => commands}/choco-apikey.Tests.ps1 | 0 .../{ => commands}/choco-config.Tests.ps1 | 0 .../{ => commands}/choco-deprecated.Tests.ps1 | 0 .../{ => commands}/choco-export.Tests.ps1 | 0 .../{ => commands}/choco-feature.Tests.ps1 | 0 .../{ => commands}/choco-help.Tests.ps1 | 0 .../{ => commands}/choco-info.Tests.ps1 | 0 .../{ => commands}/choco-install.Tests.ps1 | 0 .../{ => commands}/choco-list.Tests.ps1 | 0 .../{ => commands}/choco-new.Tests.ps1 | 0 .../{ => commands}/choco-outdated.Tests.ps1 | 0 .../{ => commands}/choco-pack.Tests.ps1 | 0 .../{ => commands}/choco-pin.Tests.ps1 | 0 .../{ => commands}/choco-push.Tests.ps1 | 0 .../{ => commands}/choco-removed.Tests.ps1 | 0 .../{ => commands}/choco-source.Tests.ps1 | 0 .../{ => commands}/choco-template.Tests.ps1 | 0 .../{ => commands}/choco-uninstall.Tests.ps1 | 0 .../{ => commands}/choco-upgrade.Tests.ps1 | 0 .../{ => commands}/choco-version.Tests.ps1 | 0 .../basic-dependencies/basic-dependencies.nuspec | 0 .../{ => commands}/testnuspecs/basic/basic.nuspec | 0 .../testnuspecs/basic/tools/purpose.txt | 0 .../{ => commands}/testnuspecs/cdata/cdata.nuspec | 0 .../testnuspecs/description-long.nuspec | 0 .../empty-requireLicenseAcceptance.nuspec | 0 .../{ => commands}/testnuspecs/empty.nuspec | 0 .../testnuspecs/forward-slash/forward-slash.nuspec | 0 .../testnuspecs/forward-slash/tools/purpose.txt | 0 .../{ => commands}/testnuspecs/full/full.nuspec | 0 .../testnuspecs/full/tools/purpose.txt | 0 .../testnuspecs/invalid-bugtrackerurl.nuspec | 0 .../testnuspecs/invalid-character-and.nuspec | 0 .../testnuspecs/invalid-character-lesser.nuspec | 0 .../testnuspecs/invalid-docsurl.nuspec | 0 .../testnuspecs/invalid-iconurl.nuspec | 0 .../{ => commands}/testnuspecs/invalid-id.nuspec | 0 .../testnuspecs/invalid-licenseUrl.nuspec | 0 .../testnuspecs/invalid-mailinglisturl.nuspec | 0 .../testnuspecs/invalid-no-content.nuspec | 0 .../testnuspecs/invalid-projectsourceurl.nuspec | 0 .../testnuspecs/invalid-projecturl.nuspec | 0 .../invalid-requireLicenseAcceptance.nuspec | 0 .../testnuspecs/invalid-version.nuspec | 0 .../{ => commands}/testnuspecs/missing.nuspec | 0 .../{ => commands}/testnuspecs/required.nuspec | 0 .../{ => commands}/testpackages/.gitignore | 0 .../1.0.0/chocolatey-dummy-package.nuspec | 0 .../installpackage/1.0.0/installpackage.nuspec | 0 .../1.0.0/tools/Casemismatch.exe.ignore | 0 .../installpackage/1.0.0/tools/casemismatch.exe | 0 .../1.0.0/tools/chocolateyBeforeModify.ps1 | 0 .../1.0.0/tools/chocolateyinstall.ps1 | 0 .../1.0.0/tools/chocolateyuninstall.ps1 | 0 .../installpackage/1.0.0/tools/console.exe | 0 .../installpackage/1.0.0/tools/graphical.exe | 0 .../installpackage/1.0.0/tools/graphical.exe.gui | 0 .../installpackage/1.0.0/tools/not.installed.exe | 0 .../1.0.0/tools/not.installed.exe.ignore | 0 .../1.0.0/too-long-description.nuspec | 0 .../too-long-title/1.0.0/too-long-title.nuspec | 0 .../tools/chocolateyinstall.ps1 | 0 .../tools/zip-log-disable-test.zip | Bin .../zip-log-disable-test.nuspec | 0 .../chocolatey-tests/{ => features}/Hooks.Tests.ps1 | 0 .../{ => features}/PythonSource.Tests.ps1 | 0 66 files changed, 0 insertions(+), 0 deletions(-) rename tests/chocolatey-tests/{ => commands}/choco-apikey.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-config.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-deprecated.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-export.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-feature.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-help.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-info.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-install.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-list.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-new.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-outdated.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-pack.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-pin.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-push.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-removed.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-source.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-template.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-uninstall.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-upgrade.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/choco-version.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/basic-dependencies/basic-dependencies.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/basic/basic.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/basic/tools/purpose.txt (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/cdata/cdata.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/description-long.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/empty-requireLicenseAcceptance.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/empty.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/forward-slash/forward-slash.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/forward-slash/tools/purpose.txt (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/full/full.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/full/tools/purpose.txt (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-bugtrackerurl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-character-and.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-character-lesser.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-docsurl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-iconurl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-id.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-licenseUrl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-mailinglisturl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-no-content.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-projectsourceurl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-projecturl.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-requireLicenseAcceptance.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/invalid-version.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/missing.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testnuspecs/required.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/.gitignore (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/installpackage.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/casemismatch.exe (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/console.exe (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/graphical.exe (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/graphical.exe.gui (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/not.installed.exe (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/too-long-description/1.0.0/too-long-description.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/too-long-title/1.0.0/too-long-title.nuspec (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip (100%) rename tests/chocolatey-tests/{ => commands}/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec (100%) rename tests/chocolatey-tests/{ => features}/Hooks.Tests.ps1 (100%) rename tests/chocolatey-tests/{ => features}/PythonSource.Tests.ps1 (100%) diff --git a/tests/chocolatey-tests/choco-apikey.Tests.ps1 b/tests/chocolatey-tests/commands/choco-apikey.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-apikey.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-apikey.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-config.Tests.ps1 b/tests/chocolatey-tests/commands/choco-config.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-config.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-config.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-deprecated.Tests.ps1 b/tests/chocolatey-tests/commands/choco-deprecated.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-deprecated.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-deprecated.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-export.Tests.ps1 b/tests/chocolatey-tests/commands/choco-export.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-export.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-export.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-feature.Tests.ps1 b/tests/chocolatey-tests/commands/choco-feature.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-feature.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-feature.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-help.Tests.ps1 b/tests/chocolatey-tests/commands/choco-help.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-help.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-help.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-info.Tests.ps1 b/tests/chocolatey-tests/commands/choco-info.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-info.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-info.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-install.Tests.ps1 b/tests/chocolatey-tests/commands/choco-install.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-install.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-install.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-list.Tests.ps1 b/tests/chocolatey-tests/commands/choco-list.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-list.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-list.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-new.Tests.ps1 b/tests/chocolatey-tests/commands/choco-new.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-new.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-new.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-outdated.Tests.ps1 b/tests/chocolatey-tests/commands/choco-outdated.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-outdated.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-outdated.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-pack.Tests.ps1 b/tests/chocolatey-tests/commands/choco-pack.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-pack.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-pack.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-pin.Tests.ps1 b/tests/chocolatey-tests/commands/choco-pin.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-pin.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-pin.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-push.Tests.ps1 b/tests/chocolatey-tests/commands/choco-push.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-push.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-push.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-removed.Tests.ps1 b/tests/chocolatey-tests/commands/choco-removed.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-removed.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-removed.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-source.Tests.ps1 b/tests/chocolatey-tests/commands/choco-source.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-source.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-source.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-template.Tests.ps1 b/tests/chocolatey-tests/commands/choco-template.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-template.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-template.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-uninstall.Tests.ps1 b/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-uninstall.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-upgrade.Tests.ps1 b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-upgrade.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 diff --git a/tests/chocolatey-tests/choco-version.Tests.ps1 b/tests/chocolatey-tests/commands/choco-version.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/choco-version.Tests.ps1 rename to tests/chocolatey-tests/commands/choco-version.Tests.ps1 diff --git a/tests/chocolatey-tests/testnuspecs/basic-dependencies/basic-dependencies.nuspec b/tests/chocolatey-tests/commands/testnuspecs/basic-dependencies/basic-dependencies.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/basic-dependencies/basic-dependencies.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/basic-dependencies/basic-dependencies.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/basic/basic.nuspec b/tests/chocolatey-tests/commands/testnuspecs/basic/basic.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/basic/basic.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/basic/basic.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/basic/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/basic/tools/purpose.txt similarity index 100% rename from tests/chocolatey-tests/testnuspecs/basic/tools/purpose.txt rename to tests/chocolatey-tests/commands/testnuspecs/basic/tools/purpose.txt diff --git a/tests/chocolatey-tests/testnuspecs/cdata/cdata.nuspec b/tests/chocolatey-tests/commands/testnuspecs/cdata/cdata.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/cdata/cdata.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/cdata/cdata.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/description-long.nuspec b/tests/chocolatey-tests/commands/testnuspecs/description-long.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/description-long.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/description-long.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/empty-requireLicenseAcceptance.nuspec b/tests/chocolatey-tests/commands/testnuspecs/empty-requireLicenseAcceptance.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/empty-requireLicenseAcceptance.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/empty-requireLicenseAcceptance.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/empty.nuspec b/tests/chocolatey-tests/commands/testnuspecs/empty.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/empty.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/empty.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/forward-slash/forward-slash.nuspec b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/forward-slash.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/forward-slash/forward-slash.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/forward-slash/forward-slash.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/forward-slash/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/tools/purpose.txt similarity index 100% rename from tests/chocolatey-tests/testnuspecs/forward-slash/tools/purpose.txt rename to tests/chocolatey-tests/commands/testnuspecs/forward-slash/tools/purpose.txt diff --git a/tests/chocolatey-tests/testnuspecs/full/full.nuspec b/tests/chocolatey-tests/commands/testnuspecs/full/full.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/full/full.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/full/full.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/full/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/full/tools/purpose.txt similarity index 100% rename from tests/chocolatey-tests/testnuspecs/full/tools/purpose.txt rename to tests/chocolatey-tests/commands/testnuspecs/full/tools/purpose.txt diff --git a/tests/chocolatey-tests/testnuspecs/invalid-bugtrackerurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-bugtrackerurl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-bugtrackerurl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-bugtrackerurl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-character-and.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-and.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-character-and.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-character-and.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-character-lesser.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-lesser.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-character-lesser.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-character-lesser.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-docsurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-docsurl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-docsurl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-docsurl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-iconurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-iconurl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-iconurl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-iconurl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-id.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-id.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-id.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-id.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-licenseUrl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-licenseUrl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-licenseUrl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-licenseUrl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-mailinglisturl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-mailinglisturl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-mailinglisturl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-mailinglisturl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-no-content.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-no-content.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-no-content.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-no-content.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-projectsourceurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-projectsourceurl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-projectsourceurl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-projectsourceurl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-projecturl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-projecturl.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-projecturl.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-projecturl.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-requireLicenseAcceptance.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-requireLicenseAcceptance.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-requireLicenseAcceptance.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-requireLicenseAcceptance.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/invalid-version.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-version.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/invalid-version.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/invalid-version.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/missing.nuspec b/tests/chocolatey-tests/commands/testnuspecs/missing.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/missing.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/missing.nuspec diff --git a/tests/chocolatey-tests/testnuspecs/required.nuspec b/tests/chocolatey-tests/commands/testnuspecs/required.nuspec similarity index 100% rename from tests/chocolatey-tests/testnuspecs/required.nuspec rename to tests/chocolatey-tests/commands/testnuspecs/required.nuspec diff --git a/tests/chocolatey-tests/testpackages/.gitignore b/tests/chocolatey-tests/commands/testpackages/.gitignore similarity index 100% rename from tests/chocolatey-tests/testpackages/.gitignore rename to tests/chocolatey-tests/commands/testpackages/.gitignore diff --git a/tests/chocolatey-tests/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec b/tests/chocolatey-tests/commands/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec similarity index 100% rename from tests/chocolatey-tests/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec rename to tests/chocolatey-tests/commands/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/installpackage.nuspec b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/installpackage.nuspec similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/installpackage.nuspec rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/installpackage.nuspec diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/casemismatch.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/casemismatch.exe similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/casemismatch.exe rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/casemismatch.exe diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/console.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/console.exe similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/console.exe rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/console.exe diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/graphical.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/graphical.exe rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/graphical.exe.gui b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe.gui similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/graphical.exe.gui rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe.gui diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/not.installed.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/not.installed.exe rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe diff --git a/tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore similarity index 100% rename from tests/chocolatey-tests/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore rename to tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore diff --git a/tests/chocolatey-tests/testpackages/too-long-description/1.0.0/too-long-description.nuspec b/tests/chocolatey-tests/commands/testpackages/too-long-description/1.0.0/too-long-description.nuspec similarity index 100% rename from tests/chocolatey-tests/testpackages/too-long-description/1.0.0/too-long-description.nuspec rename to tests/chocolatey-tests/commands/testpackages/too-long-description/1.0.0/too-long-description.nuspec diff --git a/tests/chocolatey-tests/testpackages/too-long-title/1.0.0/too-long-title.nuspec b/tests/chocolatey-tests/commands/testpackages/too-long-title/1.0.0/too-long-title.nuspec similarity index 100% rename from tests/chocolatey-tests/testpackages/too-long-title/1.0.0/too-long-title.nuspec rename to tests/chocolatey-tests/commands/testpackages/too-long-title/1.0.0/too-long-title.nuspec diff --git a/tests/chocolatey-tests/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 similarity index 100% rename from tests/chocolatey-tests/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 rename to tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 diff --git a/tests/chocolatey-tests/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip similarity index 100% rename from tests/chocolatey-tests/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip rename to tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip diff --git a/tests/chocolatey-tests/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec similarity index 100% rename from tests/chocolatey-tests/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec rename to tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec diff --git a/tests/chocolatey-tests/Hooks.Tests.ps1 b/tests/chocolatey-tests/features/Hooks.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/Hooks.Tests.ps1 rename to tests/chocolatey-tests/features/Hooks.Tests.ps1 diff --git a/tests/chocolatey-tests/PythonSource.Tests.ps1 b/tests/chocolatey-tests/features/PythonSource.Tests.ps1 similarity index 100% rename from tests/chocolatey-tests/PythonSource.Tests.ps1 rename to tests/chocolatey-tests/features/PythonSource.Tests.ps1 From 794bf67b80bd1edbc0fbcc80c840cdc3b516dc5b Mon Sep 17 00:00:00 2001 From: Cory Knox Date: Mon, 26 Sep 2022 06:53:34 -0700 Subject: [PATCH 6/6] (#1185) Be explicit with expected exit codes With the upgrade package used in the tests, it currently exits with -1 even though it is successful. Instead of blindly accepting 0 and -1 for all the tests, be explicit about which one we expect so we can catch changes to this exit code. --- .../chocolatey-tests/features/Hooks.Tests.ps1 | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/chocolatey-tests/features/Hooks.Tests.ps1 b/tests/chocolatey-tests/features/Hooks.Tests.ps1 index 2087bdbe5b..74d7ce5292 100644 --- a/tests/chocolatey-tests/features/Hooks.Tests.ps1 +++ b/tests/chocolatey-tests/features/Hooks.Tests.ps1 @@ -1,19 +1,19 @@ Import-Module helpers/common-helpers -Describe "hooks tests" -Tag Chocolatey, Hooks { +Describe "choco hooks tests" -Tag Chocolatey, HooksFeature { BeforeDiscovery { $Flags = @( - @{ Flag = '' ; RunsHooks = $true ; Command = 'install' } - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' } - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' } + @{ Flag = '' ; RunsHooks = $true ; Command = 'install' ; ExitCode = 0 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } - @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' } - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' } - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' } + @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' ; ExitCode = 0 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } - @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' } - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' } - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' } + @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' ; ExitCode = -1 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = -1 } ) } @@ -47,8 +47,8 @@ Describe "hooks tests" -Tag Chocolatey, Hooks { } # Uninstall/Upgrade exit -1: https://github.com/chocolatey/choco/issues/2822 - It "Exits with Success (0,-1)" { - $Output.ExitCode | Should -BeIn @(0, -1) -Because $Output.String + It "Exits with expected value ()" { + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String } It "Should execute hooks ()" {