Skip to content

Commit

Permalink
(chocolatey#2788) Remove tests for sxs installations
Browse files Browse the repository at this point in the history
The support for side by side installations are partially
taken out of the codebase, and any tests that tests these
are now failing.
  • Loading branch information
AdmiringWorm committed Jan 13, 2023
1 parent 9f1188f commit 8fa1263
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 242 deletions.
111 changes: 1 addition & 110 deletions tests/chocolatey-tests/commands/choco-install.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Import-Module helpers/common-helpers
Import-Module helpers/common-helpers

# https://github.com/chocolatey/choco/blob/master/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs

Expand Down Expand Up @@ -662,115 +662,6 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
}
}

Context "Installing a side-by-side Package" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$Output = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversions
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed a package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Outputs a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it installed the package successfully" {
$Output.Lines | Should -Contain "Chocolatey installed 1/1 packages."
}
}

Context "Switching a normal Package to a side-by-side Package" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$null = Invoke-Choco install $PackageUnderTest --confirm

$Output = Invoke-Choco install $PackageUnderTest --confirm --force --allowmultipleversions
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed the package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist
}

It "Removed the previous version of the package from the lib directory" -Tag ExpectBroken {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Outputs a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it installed the package successfully" {
$Output.Lines | Should -Contain "Chocolatey installed 1/1 packages."
}
}

Context "Switching a side-by-side Package to a normal Package" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$null = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversion

$Output = Invoke-Choco install $PackageUnderTest --confirm --force
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed the package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Does not output a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Not -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Does not output a warning message that installed side by side package is deprecated" {
$Output.Lines | Should -Not -Contain "installpackage has been installed as a side by side installation." -Because $Output.String
$Output.Lines | Should -Not -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it installed the package successfully" {
$Output.Lines | Should -Contain "Chocolatey installed 1/1 packages."
}
}

Context "Installing a Package with dependencies (Happy Path)" {
BeforeAll {
Restore-ChocolateyInstallSnapshot
Expand Down
23 changes: 0 additions & 23 deletions tests/chocolatey-tests/commands/choco-list.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,6 @@ Describe "choco <_>" -ForEach $Command -Tag Chocolatey, ListCommand, SearchComma
}
}

# Issue: https://github.com/chocolatey/choco/issues/1843
Context "List installed package with exact and side-by-side loading" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta-233")) {
BeforeAll {
$null = Invoke-Choco install isdependency --version 2.0.0 --confirm
$null = Invoke-Choco install isdependency --version 1.1.0 --allow-multiple-versions --confirm

$Output = Invoke-Choco $_ isdependency --AllVersions --exact --local-only
}

It "Exits with Success (0)" -Tag ExpectBroken {
$Output.ExitCode | Should -Be 0
}

It "Shows version <_> of local package" -Tag ExpectBroken -ForEach @("2.0.0"; "1.1.0") {
$Output.Lines | Should -Contain "isdependency $_"
}

It "Outputs a warning message that installed side by side package is deprecated" {
$Output.Lines | Should -Contain "isdependency has been installed as a side by side installation."
$Output.Lines | Should -Contain "Side by side installations are deprecated and is pending removal in v2.0.0."
}
}

Context "Searching packages with Verbose" {
BeforeAll {
$Output = Invoke-Choco $_ --Verbose
Expand Down
109 changes: 0 additions & 109 deletions tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,115 +12,6 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand {
Remove-ChocolateyTestInstall
}

Context "Upgrading a side-by-side Package (non-existing)" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$Output = Invoke-Choco upgrade $PackageUnderTest --confirm --allowmultipleversions
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed a package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Outputs a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it upgraded the package successfully" {
$Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String
}
}

Context "Switching a normal Package to a side-by-side Package" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$null = Invoke-Choco install $PackageUnderTest --confirm

$Output = Invoke-Choco upgrade $PackageUnderTest --confirm --force --allowmultipleversions
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed the package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist
}

It "Removed the previous version of the package from the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Outputs a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it upgraded the package successfully" {
$Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String
}
}

Context "Switching a side-by-side Package to a normal Package" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$PackageUnderTest = "installpackage"

$null = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversion

$Output = Invoke-Choco upgrade $PackageUnderTest --confirm --force
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Installed the package to the lib directory" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist
}

It "Installs the expected version of the package" {
"$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist
[xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec"
$XML.package.metadata.version | Should -Be "1.0.0"
}

It "Does not output a warning message about side by side installs are deprecated" {
$Output.Lines | Should -Not -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String
}

It "Does not output a warning message that installed side by side package is deprecated" {
$Output.Lines | Should -Not -Contain "installpackage has been installed as a side by side installation." -Because $Output.String
$Output.Lines | Should -Not -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String
}

It "Outputs a message indicating that it upgraded the package successfully" {
$Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String
}
}

Context "Upgrade package with (<Command>) specified" -ForEach @(
@{ Command = '--pin' ; Contains = $true }
@{ Command = '' ; Contains = $false }
Expand Down

0 comments on commit 8fa1263

Please sign in to comment.