Fabien-
I implemented exactly what you’re looking for by following the test fixture cookbook approach discussed in this blog article [1]. Using this, I can reference the node attributes within my ServerSpec tests.
From: Cassiano Leal
Reply-To: " "> " Date: Tuesday, May 12, 2015 at 7:03 PM To: Fabien Delpierre, " "> " Subject: [chef] Re: Using node attributes in Kitchen ServerSpec tests
The “weird pseudocodey language used by RSpec” is called Ruby, and it’s definitely not pseudo in any sense. :)
It’s true that RSpec implements a DSL on top of Ruby, very much like Chef itself. It’s still 100% Ruby in both cases though.
Now, about your specific problem, I don’t think there is a way to do what you want.
In any case, ask yourself if you really need to test that the packages are installed. If the package provides a service, you can make ServerSpec verify that the service is running (it’s got a resource for that), or that a certain port has a listening TCP socket
or something else. Think about the actual functionality you want to assert instead of the method used to put it there.
If you still see value in testing that specific packages were installed, then I guess you’ll have to be explicit in your tests as well as on the code.
--
Cassiano Leal On 12 May 2015 at 22:18:51, Fabien Delpierre ( "> ) wrote:
|
Archive powered by MHonArc 2.6.16.