Skip to content

Commit

Permalink
(chocolatey#886) Update packages.config install logging
Browse files Browse the repository at this point in the history
Update the debug logging when a packages.config file is being used to
output the start and end of the configuration on independent lines. This
allows us to update the test to get these start and end points and not
play guessing games with how long we think the output should be.
Updating this test allows Chocolatey Licensed Extension to be included
and the tests still pass.
  • Loading branch information
corbob committed Sep 29, 2022
1 parent 44c5283 commit 34fed22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ private IEnumerable<ChocolateyConfiguration> get_packages_from_config(string pac

this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(packageConfig.PackageNames));
packageConfigs.Add(packageConfig);
this.Log().Debug(() => "Package Configuration: {0}".format_with(packageConfig.ToString()));
this.Log().Debug(() => "Package Configuration Start:{0}{1}{0}Package Configuration End".format_with(System.Environment.NewLine, packageConfig.ToString()));
}
}

Expand Down
8 changes: 5 additions & 3 deletions tests/chocolatey-tests/commands/choco-install.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
$Output = Invoke-Choco install $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config --confirm --verbose --debug

# This is based on two observations: The addition explicitly outputs that it's the Package Configuration.
# The configuration output is also about 80 lines.
$StartofPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration: CommandName='install'|")
$PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..($StartofPackageConfiguration+80)] -join [Environment]::NewLine
# The configuration output is about 80 lines.
$StartOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration Start:")
$EndOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration End")

$PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..$EndOfPackageConfiguration] -join [Environment]::NewLine
}

# We are explicitly passing in a bad username and password here.
Expand Down

0 comments on commit 34fed22

Please sign in to comment.