dsccommunity / dsccommunity/ComputerManagementDsc

xComputer Unit Tests fail If Run on Domain Joined Machine

Open
#147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
PowerShell
Stars
338
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring:
When executing the unit tests for xComputer they fail:

    Context MSFT_xComputer\Get-TargetResource
VERBOSE: Getting computer state for 'GR059600'.
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_ComputerSystem'.
VERBOSE: Operation 'Enumerate CimInstances' complete.
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_ComputerSystem'.
VERBOSE: Operation 'Enumerate CimInstances' complete.
      [-] should not throw 132ms
        Expected: the expression not to throw an exception. Message was {Exception calling "FindOne" with "0" argument(s
): "The specified domain either does not exist or could not be contacted.
        "}
            from C:\Users\si557856\Source\github\xComputerManagement\Modules\xComputerManagement\DSCResources\MSFT_xComp
uter\MSFT_xComputer.psm1:110 char:28
            +         CurrentOU        = Get-ComputerOU
            +                            ~~~~~~~~~~~~~~
        451:                     } | Should -Not -Throw
        at Invoke-Assertion, C:\Program Files\WindowsPowerShell\Modules\Pester\4.1.1\Functions\Assertions\Should.ps1: li
ne 209
        at <ScriptBlock>, C:\Users\si557856\Source\github\xComputerManagement\Tests\Unit\MSFT_xComputer.Tests.ps1: line

The DSC configuration that is using the resource (as detailed as possible):
N/A

Version of the Operating System and PowerShell the DSC Target Node is running:
Windows 10 AD domain joined

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Tests/Unit/MSFT_xComputer.Tests.ps1 and the Get-TargetResource path in Modules/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.psm1 at line 110. Run the failing test on a Windows 10 domain-joined machine and inspect the Get-ComputerOU call and its FindOne exception. Done means the affected unit test no longer throws in that environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.