Closed Rob-S closed 4 years ago
The HQRM tests are failing with the error below for all the examples for every resource, saying Use Import-DSCResource to import the resource.
However, the examples do import the resources using the module name: Import-DscResource -ModuleName ComputerManagementDsc
. Has something gone awry with the tests?
Context ScheduledTask\1-ScheduledTask_CreateScheduledTaskOnce_Config.ps1
[-] Should compile MOFs for example correctly 86ms
Expected no exception to be thrown, but an exception "At D:\a\1\s\source\Examples\Resources\ScheduledTask\1-ScheduledTask_CreateScheduledTaskOnce_Config.ps1:35 char:9
+ ScheduledTask ScheduledTaskOnceAdd
+ ~~~~~~~~~~~~~
Undefined DSC resource 'ScheduledTask'. Use Import-DSCResource to import the resource." was thrown from D:\a\1\s\source\Examples\Resources\ScheduledTask\1-ScheduledTask_CreateScheduledTaskOnce_Config.ps1:35 char:9
+ ScheduledTask ScheduledTaskOnceAdd
+ ~~~~~~~~~~~~~.
141: } | Should -Not -Throw
at <ScriptBlock>, D:\a\1\s\output\RequiredModules\DscResource.Test\0.13.0\Tests\QA\ExampleFiles.common.Tests.ps1: line 27
Hi @Rob-S - this is due to a change to recent ModuleBuilder change. I've got a PR #334 open that will resolve it. Once that is trough the build should work properly again.
You should be able to rebase and resolve conflicts and tests should pass.
I had resolved the conflict in the CHANGELOG.md file. Does anything else need done on this?
Hi @Rob-S - sorry, this is on me. I'll review this weekend (this week is a bit crazy with MS Build and so none of my evenings are free).
I did try adding a unit test (I took a look at the integration tests, but I'm not really familiar with how those work yet). In the pipeline run, it looks like it's not even trying to run the tests, saying "Cannot bind argument to parameter 'Path' because it is null." although I do see a "Project Path" parameter is set.
Hi @Rob-S - the build failure is caused by a recent release of Module Builder. I've fixed the issue in this PR https://github.com/dsccommunity/ComputerManagementDsc/pull/334 - if you rebase onto master again the build should pass - then we can take a look at the integration tests.
Hi @Rob-S - Sorry, correction, the issue you're seeing is because of the Pester v5.x release. I'm going to pin this module to remain on Pester 4.10.1.
Once this PR https://github.com/dsccommunity/ComputerManagementDsc/pull/337 is through you can rebase and the tests will hopefully pass.
@Rob-S - can you try rebasing your branch onto master again to see if that fixes the build?
Hi @Rob-S - looks like the tests are failing. I think this may be because:https://dev.azure.com/dsccommunity/ComputerManagementDsc/_build/results?buildId=2305&view=logs&j=158455ef-2db5-56fd-6022-83ded799e050&t=b737ddad-5217-50db-260a-b6e0dd548ea1&l=933
@PlagueHO Yes, I had fixed the tests around the same time you entered that comment.
I think what we need is a unit test that tests when
MultipleInstances
is set toStopExisting
. I could be wrong, but I didn't see one. Is it easy to add that?
No. It's easy to add it for the other values, but not for StopExisting, since the Enum does not support that. See the comments for my commits when I attempted to do that. The issue is that you have to go to the SettingsSet level and if you try to mock that function it fails miserably elsewhere -- the "real" SettingsSet functions must be used.
Pull Request (PR) description
Add 'StopExisting' to valid values for ScheduledTask MultipleInstances parameter - fixes Issue #333
This Pull Request (PR) fixes the following issues
Fixes Issue #333
Task list
This change is