dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
360 stars 224 forks source link

SqlSetup: The main unit test for this resource is starting to grow out of proportion #533

Open johlju opened 7 years ago

johlju commented 7 years ago

Details of the scenario you tried and the problem that is occurring: I think we need to look at this unit test. Is starting to be so large and complex it is very hard to do make changes to it, and also it becomes hard to review the changes. Currently the test is around 4500 rows and still increasing.

I think we need to look at creating more helper functions for the logic in the resource, so those helper function can be tested individually making the necessary mocks in the main xSQLServerSetup.Tests more easy to handle, hopefully overall shrink the code needed.

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

ChrisLGardner commented 7 years ago

I've noticed that as well when doing my changes.

I'm thinking we need to do some mocking of Get-TargetResource when we're testing Set and Test. We should also mock the other helper functions we have in the resource, which should help tidy things up a bit.

johlju commented 7 years ago

Yes I agree!

johlju commented 7 years ago

@ChrisLGardner It was very very hard to review the test in your PR, not any fault of yours, but because of this issue. I think I need to focus on this issue.