From 569b657c39a6c2f1a7fb7597302618d515b3048d Mon Sep 17 00:00:00 2001 From: Gijs Reijn Date: Fri, 15 Nov 2024 06:22:31 +0100 Subject: [PATCH] Removed unit test for prerelease version and VSCode temp folder (#129) --- .../Microsoft.Dotnet.Dsc/DotNetToolPackage.md | 17 +++++++++-------- .../Microsoft.DotNet.Dsc.psm1 | 1 + .../Microsoft.VSCode.Dsc.psm1 | 4 ++-- .../Microsoft.DotNet.Dsc.Tests.ps1 | 15 +-------------- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md b/resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md index a84bcc70..d9e5d5e5 100644 --- a/resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md +++ b/resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md @@ -19,14 +19,14 @@ The `DotNetToolPackage` DSC Resource allows you to install, update, and uninstal ## PARAMETERS -| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** | -| ------------------- | ------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | -| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A | -| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A | -| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A | -| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. | `$true`, `$false` | -| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have | -| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` | +| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** | +| ------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | +| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A | +| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A | +| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A | +| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. Note: If the prerelease version is lower than the current version, the highest version will be installed. | `$true`, `$false` | +| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have | +| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` | ## EXAMPLES @@ -59,4 +59,5 @@ Invoke-DscResource -ModuleName Microsoft.DotNet.Dsc -Name DotNetToolPackage -Met } # This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory. +# NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed. ``` diff --git a/resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1 b/resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1 index e79c6642..a99d9b6c 100644 --- a/resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1 +++ b/resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1 @@ -336,6 +336,7 @@ $DotNetCliPath = Get-DotNetPath } This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory. + NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed. #> [DSCResource()] class DotNetToolPackage { diff --git a/resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 b/resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 index 77a52b93..c05fe6da 100644 --- a/resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 +++ b/resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 @@ -95,8 +95,8 @@ function Invoke-VSCode { [string]$Command ) - $stdErrTempFile = "$env:TEMP\$((New-Guid).Guid)" - $stdOutTempFile = "$env:TEMP\$((New-Guid).Guid)" + $stdErrTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid + $stdOutTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid $invocationSuccess = $true $processParams = @{ diff --git a/tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1 b/tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1 index 620dea67..4b60c6c8 100644 --- a/tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1 +++ b/tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1 @@ -43,19 +43,6 @@ Describe 'DSC operation capabilities' { $finalState.Version | Should -Not -BeNullOrEmpty } - It 'Sets desired package with prerelease' -Skip:(!$IsWindows) { - $parameters = @{ - PackageId = 'dotnet-ef' - PreRelease = $true - } - - Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Set -Property $parameters - - $finalState = Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Get -Property $parameters - $finalState.PackageId | Should -Be $parameters.PackageId - $finalState.PreRelease | Should -BeTrue - } - It 'Sets desired package with version' -Skip:(!$IsWindows) { $parameters = @{ PackageId = 'dotnet-reportgenerator-globaltool' @@ -99,7 +86,7 @@ Describe 'DSC operation capabilities' { It 'Exports resources' -Skip:(!$IsWindows) { $obj = [DotNetToolPackage]::Export() - $obj.PackageId.Contains('dotnet-ef') | Should -Be $true + $obj.PackageId.Contains('gitversion.tool') | Should -Be $true $obj.PackageId.Contains('dotnet-reportgenerator-globaltool') | Should -Be $true }