On Aug 7, 2009, at 5:46 PM, Markus wrote:
>
>>> But I'm semi-stuck.
>
>>> However, that's where I'm stuck. My understanding of the system
>>> isn't
>>> yet to a point where I can craft a test that would increase my
>>> confidence beyond this point, or that would convince anyone who
>>> isn't
>>> convinced by the above.
>
>> I cannot reproduce this behaviour. I wrote the following integration
>> tests, which all pass:
> [...]
>> klass = @parser.newclass("Foo", :line => 50, :doc => "stuff")
> [...]
>> If someone can send me test Puppet code that doesn't work, I'll write
>> an integration test that finds the problem.
>
> I don't think this is testing the point where the problem was (I'm not
> saying I did much better). @parser.newclass is going to stick the
> result in @loaded_code with:
>
> @loaded_code.add_hostclass(name, ast(AST::HostClass, args))
>
> and @loaded_code filters all access through munge_name:
>
> def munge_name(name)
> name.to_s.downcase
> end
>
> which means the tests work. But they don't really prove anything
> vis-a-vis the reported behaviour.
>
> The problem (I think) comes when trying to load the code via
> Puppet::Parser::Parser#import(file) which previously got a downcased
> string and now gets the raw string passed in by the user (this is what
> my patch to Puppet::Parser::Parser#find_or_load() was designed to
> address--it stuck downcases in the location most closely analogous to
> where they had been in Puppet::Parser::Parser#fqfind()).
>
> Where I'm stuck is how to test this. I suppose the right way would be
> to make files and put them in the path, etc. but I'm not up to speed
> enough to do this efficiently (e.g. I've got no clue how best to do
> that
> in a test other than just ham handed hacking with File.open(...,'w')
> {|
> f| f.print...} goo).
See any of the file integration tests. And yes, you're pretty much
doing a File.open.
>
> I'm also not sure if the user wasn't relying on an accidental
> behaviour.
> Is file loading supposed to be case insensitive? Or...? How is it
> supposed to resolve cases where there are multiple files that match
> (on
> case sensitive file systems)? Hamming distance? Dice?
I actually don't know. Was the previous code globbing or something?
>
> If you think I'm barking up the wrong tree here, feel free to
> enlighten
> me.
Well, I guess I'd test that behaviour (autoloading capitalized files)
on 0.24.8 and master, and see if you get the same results. :/
--
All power corrupts, but we need the electricity.
-- Unknown
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---