So we have 2 mechanisms that we use to check whether or not we're on Windows.
Puppet::Util::Platform.windows?- defined in
platform.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 in
feature/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.