Hi,
I'm struggling with a test failure when running in my latest pull
request (thanks to Jeff for finding it):
https://github.com/puppetlabs/puppet/pull/113/files#r126166
The spec in question is:
it "should allow to reset localhost" do
previous_host = Puppet::SSL::Host.localhost
Puppet::SSL::Host.reset
Puppet::SSL::Host.localhost.should_not == previous_host
end
The test passes fine when I run only the host_spec.rb test.
With trial and error I was able to find that running:
spec/unit/indirector/certificate_request/ca_spec.rb
spec/unit/ssl/host_spec.rb
in the same rspec batch produces the failure:
1) Puppet::SSL::Host should allow to reset localhost
Failure/Error: previous_host = Puppet::SSL::Host.localhost
Puppet::Error:
Cannot save maynard.lan; parent
directory
/var/folders/hq/hhqxfhws68bc_s23f2ktyx0m0000gp/T/ssl_host_testing20110914-2703-fzokxv-0/ssl/private_keys
does not exist
# ./lib/puppet/indirector/ssl_file.rb:95:in `save'
# ./lib/puppet/indirector/key/file.rb:34:in `save'
# ./lib/puppet/indirector/indirection.rb:265:in `save'
# ./lib/puppet/ssl/host.rb:147:in `generate_key'
# ./lib/puppet/ssl/host.rb:176:in `certificate'
# ./lib/puppet/ssl/host.rb:32:in `localhost'
# ./spec/unit/ssl/host_spec.rb:69
My troubleshooting so far indicates that the problem comes from this
snippet in the ca_spec.rb:
before :each do
Puppet[:ssldir] = tmpdir('ssl')
Puppet::SSL::Host.ca_location = :local
Puppet[:localcacert] = Puppet[:cacert]
Puppet::SSLCertificates::CA.new.mkrootcert
@ca = Puppet::SSL::CertificateAuthority.new
end
And more precisely from the
Puppet::SSL::CertificateAuthority.new
line which in turn does a:
Puppet.settings.use :main, :ssl
This of course does a lot of thing, including creating the various
vardir, confidr and ssldir directories.
Unfortunately, this apparently dirties the settings in an unrecoverable
way if you need to further create files in ssldir. I don't exactly
understand why, and that's why I need someone else's help.
Note, I'm able to fix the problem by rewriting my spec to:
it "should allow to reset localhost" do
Puppet.settings.use :main
previous_host = Puppet::SSL::Host.localhost
Puppet::SSL::Host.reset
Puppet::SSL::Host.localhost.should_not == previous_host
end
because this forces the creation of all missing vardir and ssldir.
Of cource one solution could be to fully stub what happens in
Puppet::SSL::Host.localhost, but I thought doing the real thing was a
guarantee of testing something sensible.
Anyway, any input is welcome!
Thanks,
--
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.