dsccommunity / FailoverClusterDsc

This module contains DSC resources for deployment and configuration of Windows Server Failover Cluster.
MIT License
60 stars 54 forks source link

xCluster: Fix cluster creation on Server 2012 #189

Closed codykonior closed 6 years ago

codykonior commented 6 years ago

Pull Request (PR) description

xCluster\Set-TargetResource builds a hashtable for splatting against New-Cluster. It now checks if Force is an accepted parameter on that command before adding it to the hashtable.

I added a stub of the Server 2012 version of New-Cluster named New-Cluster_NoForce which does not have the Force switch defined.

There is one applicable test, "Should call New-Cluster cmdlet". I've copied this into another block, "Should call New-Cluster cmdlet without -Force if it is not supported". This block swaps the New-Cluster stub for the New-Cluster_NoForce stub by using Set-Alias.

The test confirms that, when the Server 2012 version of New-Cluster is in place the -Force option will not be passed along.

I've tested:

It seems that the stub file had incorrect line endings which changed when I edited it. But you can view in VS Code etc that it's only one stub function added.

This Pull Request (PR) fixes the following issues

Task list


This change is Reviewable

msftclas commented 6 years ago

CLA assistant check
All CLA requirements met.

codecov-io commented 6 years ago

Codecov Report

Merging #189 into dev will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##            dev   #189   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files         8      8           
  Lines       486    487    +1     
===================================
+ Hits        486    487    +1
codykonior commented 6 years ago

I've generated the stub for Server 2012 and then modified each test file to run twice - once against the 2012 stub and once against 2016. Getting the quorum tests to pass on 2012 required some additional fixes to the xClusterQuorum resource to use 2012 compatible aliases.

In the tests there's a new global:moduleVersion. This is because having all of the tests inside the InModuleScope block hides that variable and it is not possible to access it in any other way. That variable is needed within the tests to:

codykonior commented 6 years ago

Style changes submitted.