-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlServerDsc: Speed up testing #979
Comments
The AppVeyor build worker only has 4GB of memory so maybe we should stop and instances after we tested finished. I'm only raising this here as a reminder if integration tests starting to go slower, we could try that as an option. Use the Service resource to stop instances, and use the same to start up the instances before next integration tests. I don't really know if this helps anything, just throwing it up here as a reminder. |
Yesterday, for the first time, I hit the 60 minute window for running tests in AppVeyor. It took longer than normal to download the SQL Server media, so the tests could not finish in time. |
Maybe if we ask AppVeyor kindly maybe we can get more run time. But that would only help this repository, not the forked repositories. For example if a contributor connect their AppVeyor account to their forked repository, to test a change before sending in a pull request, they would hit the 60 minute window and might not be able to test their change. |
There seems to be an issue with AppVeyor and SqlAG; the speed degrades farther and farther down in the test we go. See testing of https://ci.appveyor.com/project/johlju/sqlserverdsc/build/9.0.130.0#L1865 Please not that the same test (the whole test) take 18 seconds (25 seconds with code coverage) to complete locally on a Windows 10 (latest insider, PS Version 5.1.17063.1000).
|
Speed testRun times from test run #1460. Updated 2020-05-16 Individual unit and integration test run time in CI pipelineCommon test of DscResource.Tests are not listed here, since those needs to be run regardless, and not as easy to make changes to (they effect all resource modules). Unit
Integration
|
I gave it a try running unit tests in a Windows container on the build worker. My attempt failed, but maybe there is a solution to it, see the issue PowerShell/DscResource.Tests#204. |
Another option is to remove the integration tests from the repository and create a separate repository for the integration tests using DscConfigurations templates. |
I have update with the latest elapsed times using the new CI pipeline. |
Is this still actual? https://github.com/pester/Pester/issues/1318 What version of Powershell does the pipeline use? |
The problem is that certain tests are written to complex which results in extremely long run times. There are still some that need to be fixed but the worst has been resolved. It is fixed by not trying to reuse code in the tests but instead making context-blocks self-sustaining even if that means duplicating code. The pipeline is using Pester 4. All tests need to be refactored for Pester 5, so that is gonna take a while before latest Pester can be supported. The pipeline need to be modified as well to support code coverage in pester 5. |
The unit tests was also speed up by running the unit tests in PowerShell 7. But SqlSetup still takes 60 minutes to run (last time I verified, might be quicker today). It shouldn’t need to take that long to run. It’s like 40-50 minutes too long. :) Those tests still need to be refactored, I think I only refactored the tests for Get-TargetResource. I also refactored the code to make more units (functions) that could be to tested separately to increase the overall speed, when the mocking could be decreased. |
Details of the scenario you tried and the problem that is occurring:
We are getting close to the (AppVeyor) time limit of 60 minutes, currently around ~50 minutes. I suggest we look at steps to improve the code and the build worker.
The DSC configuration that is using the resource (as detailed as possible):
n/a
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev
The text was updated successfully, but these errors were encountered: