dsccommunity / SqlServerDsc

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

SqlAG: Integration test is missing for this resource #732

Open johlju opened 7 years ago

johlju commented 7 years ago

Details of the scenario you tried and the problem that is occurring: We should add an integration test for this resource.

This has the same problem as integration tests as for xSQLServerSetup, please see issue #731.

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

johlju commented 6 years ago

Maybe we can leverage this to be able to at least get one node for Availability Group to be able to integration test some Availability Group resources. I have not read more about this. Just throwing this out there. 😄

New Availability Groups functionality includes clusterless support. https://docs.microsoft.com/en-us/sql/sql-server/what-s-new-in-sql-server-2017

randomnote1 commented 6 years ago

The challenge with this is this requires the use of certificates to build which the resource currently does not support. The easiest thing to do in the short term would be to install WSFC on the box and build a one-node Availability Group.

johlju commented 6 years ago

Ah I see. The integration test for xSQLServerAlwaysOnService currently installs a Active Directory-detached cluster, so maybe there is the option to add Availability Groups to this kind of cluster without AD? Or is it needed to use certificates then as well?

Installing an AD on the build worker could be tricky, but might be able to be done during the AppVeyor install stage where reboot is allowed, and as long as the build worker still auto logon using the correct credentials.

Example on reboot in the PSDscResource appveyor.yml. https://github.com/PowerShell/PSDscResources/blob/8ba8c5354e4a479bba118942b8cf6e4580af0b37/appveyor.yml#L6-L19

randomnote1 commented 6 years ago

You ask a good question! From my reading, I believe anything that is done outside the context of a domain is required to use certificates. That being said, if we're able to enable the AlwaysOn Service, I think we should be able to make it work.

johlju commented 6 years ago

The integration tests for xSQLServerAlwaysOnService do enable AlwaysOn Service, but the same integration test disables it again (to test so disable work). So this integration tests should make sure to run after the integration tests for xSQLServerAlwaysOnService, and start by re-enable the AlwaysOn service. The order integration tests are run is determine by the OrderNumber property (tests are run in ascending order) in the test configuration file.

https://github.com/PowerShell/xSQLServer/blob/1bbdecaf5f75245c2b16e698579b28bf90bcc240/Tests/Integration/MSFT_xSQLServerAlwaysOnService.config.ps1#L1-L3

Would be awesome to be able to create an integration test for this resource also, even if we can only test parts of it.

randomnote1 commented 6 years ago

Rather than having to re-enable the same components several times, can we build the integration tests in cascading order of dependency?

This will help AppVeyor complete the tasks in a reasonable amount of time and not go over the 60 minute limit.