So we have 2 mechanisms that we use to check whether or not we're on Windows.
Puppet::Util::Platform.windows?
- defined inplatform.rb
- Has no dependencies on any other code, and should never be stubbed / mocked in a test. You'll see this described a bit more at https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/platform.rb#L4-L11 (Original commit from Patrick is at https://github.com/puppetlabs/puppet/commit/ea740f652fb5252569d4adaefd486aa9daf44b63#diff-043b51d1cd12f524007e614baff1119a)Puppet.features.microsoft_windows?
- defined infeature/base.rb
. Generally requires that Puppet itself be initialized, including its feature management code. Set in Puppet by trying to load win32 gems, and stubbed in tests where behavior is normally gated on the check.
In this particular instance, I think we'd prefer to use Puppet::Util::Platform.windows?
as I wouldn't expect any cross-platform stubbing to occur in tests.