Skip to content

Commit

Permalink
Clean up tests and extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alerickson committed Oct 28, 2024
1 parent 5047249 commit 46bbabe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
3 changes: 0 additions & 3 deletions src/code/InstallHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,6 @@ private bool TryInstallToTempPath(
try
{
var pathToFile = Path.Combine(tempInstallPath, $"{pkgName}.{normalizedPkgVersion}.zip");
_cmdletPassedIn.WriteVerbose($"pathToFile IS: {pathToFile}.");

using var fs = File.Create(pathToFile);
responseStream.Seek(0, System.IO.SeekOrigin.Begin);
responseStream.CopyTo(fs);
Expand All @@ -984,7 +982,6 @@ private bool TryInstallToTempPath(
var tempDirNameVersion = Path.Combine(tempInstallPath, pkgName.ToLower(), pkgVersion);

Directory.CreateDirectory(tempDirNameVersion);

if (!TryExtractToDirectory(pathToFile, tempDirNameVersion, out error))
{
return false;
Expand Down
16 changes: 1 addition & 15 deletions test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,7 @@ Describe 'Test Install-PSResource for local repositories' -tags 'CI' {
$pkg.Version | Should -Be "1.0.0"

Install-PSResource -Name $testModuleClobber2 -Repository $localRepo -TrustRepository -NoClobber -ErrorVariable ev -ErrorAction SilentlyContinue -verbose
$pkg = Get-InstalledPSResource $testModuleClobber2 -ErrorAction SilentlyContinue

if (!$pkg) {
# Get the first available module named 'clobbertestmodule1' and its exported commands
$module2 = (Get-Module -ListAvailable $testModuleClobber2)[0]
$module2Idx = $module[0]
# Iterate through each exported command in the module
foreach ($command in $module2Idx.ExportedCommands.Values) {
# Output the command's name and details
Write-Verbose -Verbose "Command Name: $($command.Name)"
Write-Verbose -Verbose "Command Type: $($command.CommandType)"
Write-Verbose -Verbose "----------------------------------"
}
}

$pkg = Get-InstalledPSResource $testModuleClobber2 -ErrorAction SilentlyContinue}
$pkg | Should -BeNullOrEmpty
$ev.Count | Should -Be 1
$ev[0] | Should -Be "'testModuleClobber2' package could not be installed with error: The following commands are already available on this system: 'Test-Cmdlet1, Test-Cmdlet1'. This module 'testModuleClobber2' may override the existing commands. If you still want to install this module 'testModuleClobber2', remove the -NoClobber parameter."
Expand Down

0 comments on commit 46bbabe

Please sign in to comment.