Skip to content

Commit

Permalink
(chocolatey#2787) Add tests for side-by-side deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Sep 14, 2022
1 parent c3de6e7 commit 48c90e0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/CodeMaid.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SteveCadwallader.CodeMaid.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<userSettings>
<SteveCadwallader.CodeMaid.Properties.Settings>
<setting name="Cleaning_UpdateFileHeader_HeaderUpdateMode" serializeAs="String">
<value>1</value>
</setting>
<setting name="Cleaning_UpdateFileHeaderCSharp" serializeAs="String">
<value>// Copyright © 2017 - 2022 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.</value>
</setting>
<setting name="Cleaning_AutoCleanupOnFileSave" serializeAs="String">
<value>True</value>
</setting>
<setting name="Cleaning_InsertEndOfFileTrailingNewLine" serializeAs="String">
<value>True</value>
</setting>
</SteveCadwallader.CodeMaid.Properties.Settings>
</userSettings>
</configuration>
16 changes: 16 additions & 0 deletions src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,22 @@ public void should_contain_a_warning_message_that_it_installed_successfully()
installedSuccessfully.ShouldBeTrue();
}

[Fact]
public void should_contain_a_warning_message_that_installing_package_with_multiple_versions_being_deprecated()
{
const string expected = "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0.";

foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null())
{
if (message.Contains(expected))
{
return;
}
}

Assert.Fail("No warning message about side by side deprecation outputted");
}

[Fact]
public void should_have_a_successful_package_result()
{
Expand Down
18 changes: 18 additions & 0 deletions tests/chocolatey-tests/choco-install.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,15 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
$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 "Side by side installations has been deprecated and will be removed in v2.0.0."
}

It "Outputs a warning message that installed side by side package is deprecated" {
$Output.Lines | Should -Contain "installpackage 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."
}

It "Outputs a message indicating that it installed the package successfully" {
$Output.Lines | Should -Contain "Chocolatey installed 1/1 packages."
}
Expand Down Expand Up @@ -599,6 +608,15 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
$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 "Side by side installations has been deprecated and will be removed in v2.0.0."
}

It "Outputs a warning message that installed side by side package is deprecated" {
$Output.Lines | Should -Contain "installpackage 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."
}

It "Outputs a message indicating that it installed the package successfully" {
$Output.Lines | Should -Contain "Chocolatey installed 1/1 packages."
}
Expand Down
5 changes: 5 additions & 0 deletions tests/chocolatey-tests/choco-list.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ Describe "choco <_>" -ForEach $Command -Tag Chocolatey, ListCommand, SearchComma
It "Shows version <_> of local package" -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" {
Expand Down

0 comments on commit 48c90e0

Please sign in to comment.