Testing collections of vurtual defined resources
As promised, I'm starting to blog the test scripts I write. I'll tag all of these with test.
Anyway, so I'm trying to verify that #787 is fixed, so I used this code:
define yay {
notify { "Testing $name": }
}
@yay { one: }
@yay { two: }
@yay { three: }
class outer {
realize(Yay["one"])
class inner {
realize(Yay["two"])
}
include inner
}
include outer
The point was to try to find a circumstance in which the defined resource got evaluated (i.e., turned into builtin resources) before it was marked non-virtual by the realize function. I tried a few iterations of this, and I consistently got:
notice: Testing one notice: Testing two
Meaning that it was working fine. So I closed the ticket.
Wed, 21 Nov 2007 | Tags: puppet, virtual, test, definitions, collections
Testing tags and virtual resources
In talking with Chris MacLeod about documenting exported and collected resources, he had questions about tags. I was pretty sure I'd set the query language up to compare both tag attributes and the tags on the instance (which are different), but I wanted to test.
So I used this code:
class testing {
@notify { "this is a test": }
}
include testing
Notify <| tag == testing |>
Unfortunately, this produced no output, meaning that it was not matching against tags acquired from enclosing classes (because the notify is in the testing class, it should be tagged with testing). If I use normal attributes, it works fine:
class testing {
@notify { "this is a test": tag => testing }
}
include testing
Notify <| tag == testing |>
Produces:
notice: this is a test
Disappointing, because it means that tags aren't working as I expected. Drat, found a bug, and it's unlikely to make it into this release.