Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

PSResourceRepository: Integration test with `-Default` parameter fails

オープン
#401 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
powershell
領域
ci-cd, testing-qa

調査の方向性

失敗しているテストは tests/Integration/Classes/PSResourceRepository.integration.tests.ps1 の 105 行目と 122 行目付近にあります。まず PowerShellGet 2.2.5 と PackageManagement 1.4.8.1 を使った builder のセットアップを確認し、その後、影響を受ける Windows runner で PSResourceRepository 統合テストを実行します。-Default パラメーターを指定した構成が例外をスローせずにパスすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

help wanted tests
Problem description

When the PSGallery is not present on the builders, adding it fails with the error "Value may not be null". This has been independently tested and the same configuration works, so it seems it is something isolated to the builders. When PowerShellGet 2.2.5 is loaded the error occurs. Removing PSGet 2.2.5 and importing 1.0.0.1 fixes the issue.

Example pipeline failure here:
https://dev.azure.com/dsccommunity/ComputerManagementDsc/_build/results?buildId=6992&view=logs&j=bb95b0b0-86ad-5f35-08c1-35aecf9ab8ed

This is obv low priority since the configuration does work, just not on the builders. It just means we're missing some integration test coverage.

Verbose logs
2022-11-29T16:07:11.9222411Z     Context When using configuration PSResourceRepository_Create_Default_Config
2022-11-29T16:07:12.1209743Z VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = 
2022-11-29T16:07:12.1211373Z SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = 
2022-11-29T16:07:12.1214705Z root/Microsoft/Windows/DesiredStateConfiguration'.
2022-11-29T16:07:12.1416230Z VERBOSE: An LCM method call arrived from computer WIN-STA3E7J6311 with user sid 
2022-11-29T16:07:12.1417625Z S-1-5-21-2690698897-1208728301-426778522-500.
2022-11-29T16:07:12.1418446Z VERBOSE: [WIN-STA3E7J6311]: LCM:  [ Start  Set      ]
2022-11-29T16:07:12.2081315Z VERBOSE: [WIN-STA3E7J6311]: LCM:  [ Start  Resource ]  [[PSResourceRepository]Integration_Test]
2022-11-29T16:07:12.2092695Z VERBOSE: [WIN-STA3E7J6311]: LCM:  [ Start  Test     ]  [[PSResourceRepository]Integration_Test]
2022-11-29T16:07:12.2682693Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Determining the current
2022-11-29T16:07:12.2684735Z  state for resource 'PSResourceRepository' using the key property '{"Name":"PSGallery"}'. (RB0002)
2022-11-29T16:07:12.2859345Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Getting the current 
2022-11-29T16:07:12.2867808Z state for resource 'PSResourceRepository' using the key property '{"Name":"PSGallery"}'. (RB0001)
2022-11-29T16:07:12.2869032Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Return the current 
2022-11-29T16:07:12.2869684Z state of the repository 'PSGallery'.
2022-11-29T16:07:12.2975439Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Suppressed Warning No 
2022-11-29T16:07:12.2978248Z repository with the name 'PSGallery' was found.
2022-11-29T16:07:12.3032636Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] The repository 
2022-11-29T16:07:12.3033830Z 'PSGallery' was not found.
2022-11-29T16:07:12.3694423Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.3704967Z 'InstallationPolicy') for property 'InstallationPolicy' does not match. Current state is '' and desired state is 
2022-11-29T16:07:12.3706137Z 'Untrusted'. (DRC0021)
2022-11-29T16:07:12.3707099Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.3708247Z 'Ensure') for property 'Ensure' does not match. Current state is 'Absent' and desired state is 'Present'. (DRC0021)
2022-11-29T16:07:12.3803132Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] MATCH: Value (type 
2022-11-29T16:07:12.3820979Z 'InstallationPolicy') for property 'InstallationPolicy' does match. Current state is 'Untrusted' and desired state is 
2022-11-29T16:07:12.3822314Z 'Untrusted'. (DRC0020)
2022-11-29T16:07:12.3826531Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.3827840Z 'Ensure') for property 'Ensure' does not match. Current state is 'Absent' and desired state is 'Present'. (DRC0021)
2022-11-29T16:07:12.3829167Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] The current state is 
2022-11-29T16:07:12.3829818Z not the desired state. (RB0004)
2022-11-29T16:07:12.3830777Z VERBOSE: [WIN-STA3E7J6311]: LCM:  [ End    Test     ]  [[PSResourceRepository]Integration_Test]  in 0.1870 seconds.
2022-11-29T16:07:12.3831835Z VERBOSE: [WIN-STA3E7J6311]: LCM:  [ Start  Set      ]  [[PSResourceRepository]Integration_Test]
2022-11-29T16:07:12.4529767Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Setting the desired 
2022-11-29T16:07:12.4531366Z state for resource 'PSResourceRepository' using the key property '{"Name":"PSGallery"}'. (RB0003)
2022-11-29T16:07:12.4770031Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Getting the current 
2022-11-29T16:07:12.4771678Z state for resource 'PSResourceRepository' using the key property '{"Name":"PSGallery"}'. (RB0001)
2022-11-29T16:07:12.4780630Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Return the current 
2022-11-29T16:07:12.4781509Z state of the repository 'PSGallery'.
2022-11-29T16:07:12.4891548Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Suppressed Warning No 
2022-11-29T16:07:12.4894092Z repository with the name 'PSGallery' was found.
2022-11-29T16:07:12.4949762Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] The repository 
2022-11-29T16:07:12.4951517Z 'PSGallery' was not found.
2022-11-29T16:07:12.5300935Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.5302357Z 'InstallationPolicy') for property 'InstallationPolicy' does not match. Current state is '' and desired state is 
2022-11-29T16:07:12.5304750Z 'Untrusted'. (DRC0021)
2022-11-29T16:07:12.5315508Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.5318677Z 'Ensure') for property 'Ensure' does not match. Current state is 'Absent' and desired state is 'Present'. (DRC0021)
2022-11-29T16:07:12.5506527Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] MATCH: Value (type 
2022-11-29T16:07:12.5507516Z 'InstallationPolicy') for property 'InstallationPolicy' does match. Current state is 'Untrusted' and desired state is 
2022-11-29T16:07:12.5508245Z 'Untrusted'. (DRC0020)
2022-11-29T16:07:12.5539901Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] NOTMATCH: Value (type 
2022-11-29T16:07:12.5541256Z 'Ensure') for property 'Ensure' does not match. Current state is 'Absent' and desired state is 'Present'. (DRC0021)
2022-11-29T16:07:12.5557261Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] The property 'Ensure' 
2022-11-29T16:07:12.5558000Z will be set to 'Present'. (RB0006)
2022-11-29T16:07:12.5575267Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Registering default 
2022-11-29T16:07:12.5578038Z repository 'PSGallery' with -Default parameter.
2022-11-29T16:07:13.7582672Z VERBOSE: [WIN-STA3E7J6311]:                            [[PSResourceRepository]Integration_Test] Repository details, 
2022-11-29T16:07:13.7583704Z Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
2022-11-29T16:07:15.0794188Z       [-] Should compile and apply the MOF without throwing 3.11s
2022-11-29T16:07:15.1245751Z         Expected no exception to be thrown, but an exception "Value cannot be null." was thrown from D:\a\1\s\tests\Integration\Classes\PSResourceRepository.integration.tests.ps1:122 char:21
2022-11-29T16:07:15.1258227Z             + ...               Start-DscConfiguration @startDscConfigurationParameters
2022-11-29T16:07:15.1270121Z             +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
2022-11-29T16:07:15.1281625Z         123:                 } | Should -Not -Throw
2022-11-29T16:07:15.1293625Z         at <ScriptBlock>, D:\a\1\s\tests\Integration\Classes\PSResourceRepository.integration.tests.ps1: line 105
DSC configuration
$ConfigurationData = @{
    AllNodes    = , @{
        NodeName        = 'localhost'
        CertificateFile = $Null
    }
    NonNodeData = @{
         PSResourceRepository_Create_Default_Config = @{
             Name    = 'PSGallery'
             Ensure  = 'Present'
             Default = $true
         }
    }
}

configuration PSResourceRepository_Create_Default_Config
{
    Import-DscResource -ModuleName 'ComputerManagementDsc'

    node $AllNodes.NodeName
    {
        PSResourceRepository 'Integration_Test'
        {
            Name    = $ConfigurationData.NonNodeData.PSResourceRepository_Create_Default_Config.Name
            Ensure  = $ConfigurationData.NonNodeData.PSResourceRepository_Create_Default_Config.Ensure
            Default = $ConfigurationData.NonNodeData.PSResourceRepository_Create_Default_Config.Default
        }
    }
}
Suggested solution

Check the build process for the builders themselves.

Operating system the target node is running
The issue occurs on both Windows 2019 and 2022 runners
PowerShell version and build the target node is running
PS C:\Windows\system32> Get-Module packagemanagement

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.8.1    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...

PS C:\Windows\system32> Get-Module powershellget

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.2.5      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
ComputerManagementDsc version
Unreleased 8.6.0
主要言語
PowerShell
スター
338
フォーク
80
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dsccommunity/ComputerManagementDsc のほかの issue

dsccommunity/ComputerManagementDsc の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。