On Tue, 2008-08-26 at 00:28 -0700, Luke Kanies wrote:
> On Aug 25, 2008, at 2:43 PM, Brice Figureau wrote:
>
> >
> >
> > On Mon, August 25, 2008 16:46, Luke Kanies wrote:
> >>
> >> On Aug 25, 2008, at 6:24 AM, Brice Figureau wrote:
> >>
> >>> OK, I had a look to those.
> >>> I have some questions:
> >>> * should I implement both tests (ie in ral and Rspec)? or Rspec is
> >>> enough?
> >>
> >> As James says, only rspec -- we just haven't had a chance to migrate
> >> the old tests.
> >
> > I started writing a rspec test for the daemontools service, but
> > anyhow I
> > can't seem to be able to create temp dirs (or file) using
> > PuppetTest::tempfile.
> [...]
>
> Basically, anything in PuppetTest isn't really set up to work in RSpec.
>
> We don't yet have a generalized solution for handling temp files in
> RSpec, but you also shouldn't need a temp file unless you're writing
> an integration test, in my experience.
So you'll have to explain what is the difference between integration
tests and unit tests, I'm a little bit confused. Maybe I'm trying to
write an integration test in fact, without knowing it :-)
My idea was to test that:
1) the daemontools provider implements the right interface (ie it
respond_to the necessary methods)
2) the provider calls the right commands on start, stop, status
3) the provider creates/removes a symlink on enable/disable and
properly checks its existence on enabled?
I agree that for 1) and 2), I don't need temporary files/directory.
But for 3), I need to let the provider run in a controlled environment,
and later check it did its job, hence I need a few temporary
directories.
Note that I first wanted (and even tryed) to implement 3) by mocking
File and FileTest to check that File.symlink and FileTest.symlink? were
called with the proper arguments, but of course that doesn't work.
Oh, just had a look to some of the other spec and found that:
File.stubs(:exist?).returns(true)
File.expects(:unlink).with(@file)
I think that answers my question :-)
> >
> > Any idea?
> > (and sorry for sending so many (maybe dumb) questions on the list)
>
>
> First three are free, they're $2000USD after that. :)
Arghh :-)
Thanks for your answers.
--
Brice Figureau <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---