diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-07-22 12:29:54 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-26 14:28:31 -0700 |
| commit | 95837e6d3e74648617c308aedc52192bb13fde5a (patch) | |
| tree | fd61767c9b3232ae36a98d5d6d8c9046c0801efe /spec/unit | |
| parent | b13427b56d8529731d0334d420b24a592ecb43ea (diff) | |
| download | puppet-95837e6d3e74648617c308aedc52192bb13fde5a.tar.gz puppet-95837e6d3e74648617c308aedc52192bb13fde5a.tar.xz puppet-95837e6d3e74648617c308aedc52192bb13fde5a.zip | |
Update certificate spec tests for Windows
Disable CA related spec tests on Windows, since that functionality is not supported.
Some cert spec tests are still marked as fails_on_windows because
settings attempts to create and apply a catalog corresponding to
ssl/cert related directories. This fails because on Windows
Puppet.features.root? always returns true (which is a separate bug),
and as a result attempts to set the owner and group, which fails because
the provider is not implemented yet on Windows.
Also many of these tests were using Tempfile.new and trying to
system("rm -rf ...") later. I changed these to use
PuppetSpec::Files.tmpdir instead, which automatically cleans up
temporary directories after the tests have run.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/indirector/certificate_request/ca_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/ssl/host_spec.rb | 11 | ||||
| -rwxr-xr-x | spec/unit/sslcertificates/ca_spec.rb | 16 |
3 files changed, 17 insertions, 12 deletions
diff --git a/spec/unit/indirector/certificate_request/ca_spec.rb b/spec/unit/indirector/certificate_request/ca_spec.rb index fb758b59e..36628df9d 100755 --- a/spec/unit/indirector/certificate_request/ca_spec.rb +++ b/spec/unit/indirector/certificate_request/ca_spec.rb @@ -10,7 +10,7 @@ require 'puppet/sslcertificates' require 'puppet/sslcertificates/ca' require 'puppet/indirector/certificate_request/ca' -describe Puppet::SSL::CertificateRequest::Ca, :fails_on_windows => true do +describe Puppet::SSL::CertificateRequest::Ca, :unless => Puppet.features.microsoft_windows? do include PuppetSpec::Files before :each do diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index f00451619..226acdecd 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -5,9 +5,18 @@ require 'puppet/ssl/host' require 'puppet/sslcertificates' require 'puppet/sslcertificates/ca' +# REMIND: Fails on windows because there is no user provider yet describe Puppet::SSL::Host, :fails_on_windows => true do + include PuppetSpec::Files + before do Puppet::SSL::Host.indirection.terminus_class = :file + + # Get a safe temporary file + dir = tmpdir("ssl_host_testing") + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir + @host = Puppet::SSL::Host.new("myname") end @@ -701,7 +710,7 @@ describe Puppet::SSL::Host, :fails_on_windows => true do end end - describe "when handling PSON" do + describe "when handling PSON", :unless => Puppet.features.microsoft_windows? do include PuppetSpec::Files before do diff --git a/spec/unit/sslcertificates/ca_spec.rb b/spec/unit/sslcertificates/ca_spec.rb index 2ff4036dd..7a687b825 100755 --- a/spec/unit/sslcertificates/ca_spec.rb +++ b/spec/unit/sslcertificates/ca_spec.rb @@ -5,27 +5,23 @@ require 'puppet' require 'puppet/sslcertificates' require 'puppet/sslcertificates/ca' -describe Puppet::SSLCertificates::CA, :fails_on_windows => true do +describe Puppet::SSLCertificates::CA, :unless => Puppet.features.microsoft_windows? do + include PuppetSpec::Files + before :all do @hosts = %w{host.domain.com Other.Testing.Com} end before :each do Puppet::Util::SUIDManager.stubs(:asuser).yields - file = Tempfile.new("ca_testing") - @dir = file.path - file.delete + dir = tmpdir("ca_testing") - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir @ca = Puppet::SSLCertificates::CA.new end - after :each do - system("rm -rf #{@dir}") - end - describe 'when cleaning' do it 'should remove associated files' do dirs = [:csrdir, :signeddir, :publickeydir, :privatekeydir, :certdir] |
