gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
171 stars 42 forks source link

Remove running hqrmtest from task 'test' (and instead run it indvidually) #389

Open johlju opened 2 years ago

johlju commented 2 years ago

Problem description

When running the build script to test a specific test the hqrmtest are also run which takes time in the development process.

.\build.ps1 -Tasks test -PesterPath .\tests\Unit\Public\Get-BuildVersion.tests.ps1 -CodeCoverageThreshold 1

Verbose logs

Pester v5.3.3

Starting discovery in 1 files.
Discovery found 12 tests in 34ms.
Starting code coverage.
Code Coverage preparation finished after 2165 ms.
Running tests.

Running tests from 'C:\source\Sampler\tests\Unit\Public\Get-BuildVersion.tests.ps1'
Describing Get-BuildVersion
...
===============================================================================
                        INVOKE HQRM TESTS
Making sure the Module meets some quality standard (help, tests)
-------------------------------------------------------------------------------
...
Done /test/hqrmtest/Invoke_HQRM_Tests_Stop_On_Fail/Fail_Build_If_HQRM_Tests_Failed 00:00:00.0999452
Done /test/hqrmtest/Invoke_HQRM_Tests_Stop_On_Fail 00:00:17.0173025
Done /test/hqrmtest 00:00:17.0180906
Done /test 00:00:29.6944551

How to reproduce

Running this will run the hqrmtest:

.\build.ps1 -Tasks test -PesterPath .\tests\Unit\Public\Get-BuildVersion.tests.ps1 -CodeCoverageThreshold 1

Expected behavior

Not to run the task hqrmtest

Current behavior

Runs the task hqrmtest.

Suggested solution

Remove this line from the meta build task test:

https://github.com/gaelcolas/Sampler/blob/bc25ba558383d3ddba7ded9a2e51233f2bc9d4e7/build.yaml#L139

Add a new job to the Azure Pipeline stage Test:

Example: https://github.com/dsccommunity/DscResource.Common/blob/c816a0951588a7d01481613bfab85fa7600aa830/azure-pipelines.yml#L52-L78

Optionally: Create a new informational meta task that can be run for the meta build task test that suggests that the user also runs the HQRM tests before PR by running .\build.ps1 -Tasks hqrmtest.

Operating system the target node is running

n/a

PowerShell version and build the target node is running

n/a

Module version used

main branch
johlju commented 2 years ago

This has correlation with issue #387.