Issue #7197 has been updated by Matt Robinson.

I think this should happen ASAP so we don't end up with the crazy heisenbug 
that plagued the unit tests recently.

    1) Failure:
    test_snippet_classpathtest(TestSnippets)
    [./language/snippets.rb:208:in `snippet_classpathtest'
    ./language/snippets.rb:516:in `send'
    ./language/snippets.rb:516:in `test_snippet_classpathtest'
    ./language/snippets.rb:515:in `test_snippet_classpathtest'
    
/usr/lib/ruby/gems/1.8/gems/mocha-0.9.10/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:22:in
 `__send__'
    
/usr/lib/ruby/gems/1.8/gems/mocha-0.9.10/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:22:in
 `run']:
    <"/Stage[main]/Testing/Mytype[componentname]/File[/tmp/classtest]"> 
expected but was
    <"/Stage[main]/Mytype[componentname]/File[/tmp/classtest]">.

    I'm really not having any luck on this one.  The failure is ridiculously 
sporadic.  Sometimes I get it to fail on every run of the individual test 
dozens of times in a row, then it just stops failing.  I've run git bisect 
multiple times and gotten at least 5 different commits as a result.  For a 
little while it looked like it might be the version of Ruby that caused this 
problem, but I've gotten the failure under 1.8.5-1.8.7 at different times.  For 
a while I thought it was order dependent in that if I ran the full unit test 
suite it would fail because at first I couldn't get the individual test to 
fail, but then the individual test started failing.  I've also managed to get 
this failure in both 2.6.next and next branches.  I've also had other people 
try reproducing the failure.  Pieter wasn't able to, and Max was able to but 
only on a certain version of Ruby.
    The test is basically making a catalog out of the following file

    define mytype {
      file { "/tmp/classtest": ensure => file, mode => 755 }
    }
    class testing {
      mytype { "componentname": }
    }
    include testing

    Then asserting

    assert_equal( 
"/Stage[main]/Testing/Mytype[componentname]/File[/tmp/classtest]", file.path)

    The fact that the Testing class sometimes isn't showing up as the parent of 
Mytype is fairly disturbing, otherwise I'd be tempted to just delete this test. 
 If anyone has ideas let me know, otherwise I'll just be reading surrounding 
code and maybe try reimplementing the test as an rspec test.

We can also get rid of misleading comments in lib/puppet/type.rb


    # Look up our parent in the catalog, if we have one.
    def parent
      return nil unless catalog

      unless defined?(@parent)
        if parents = catalog.adjacent(self, :direction => :in)
          # We should never have more than one parent, so let's just ignore
          # it if we happen to.
          @parent = parents.shift
        else
          @parent = nil
        end
      end
      @parent
    end

----------------------------------------
Refactor #7197: Prevent a resource from having two parents
https://projects.puppetlabs.com/issues/7197

Author: Jesse Wolfe
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


The "containment graph" is actually a tree - each node (each resource) should 
have exactly one direct parent (container).
This is currently only enforced by convention, but it should be trivial to add 
a sanity check to the Catalog#add_edge to prevent anyone from adding a second 
parent to a resource.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to