Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6648

Puppet 4.6.x breaks catalog.apply in unit tests

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.6.0, PUP 4.6.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      I've seen this both with Puppet gems locally on OS X and on Travis CI testing my module.

    • Template:
    • Epic Link:
    • Team:
      Puppet Developer Experience

      Description

      I have the following automated test as part of my module:

      require 'spec_helper'
       
      provider_class = Puppet::Type.type(:avahi_host).provider(:augeas)
       
      describe provider_class do
       
        before :each do
          Puppet::Type.type(:avahi_host).stubs(:defaultprovider).returns described_class
          FileTest.stubs(:exist?).returns false
          FileTest.stubs(:exist?).with('/etc/avahi/hosts').returns true
        end
       
        context 'with empty file' do
          let(:tmptarget) { aug_fixture('empty') }
          let(:target) { tmptarget.path }
       
          it 'should create simple new entry' do
            apply!(Puppet::Type.type(:avahi_host).new(
              :name     => 'router.local',
              :ip       => '192.0.2.1',
              :target   => target,
              :provider => 'augeas',
            ))
       
            aug_open(target, 'Hosts.lns') do |aug|
              expect(aug.get("*[canonical = 'router.local']/ipaddr")).to eq('192.0.2.1')
            end
          end
        end
      end
      

      This works fine on any Puppet version I've tested with prior to 4.6.0 but with that or 4.6.1 I get the following error:

      Failures:
        1) Puppet::Type::Avahi_host::ProviderAugeas with empty file should create simple new entry
           Failure/Error: catalog.apply
           
           Errno::ENOTDIR:
             Not a directory @ dir_s_mkdir - /dev/null/state/transactionstore.yaml20160824-21390-1gzxywg.lock
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:182:in `mkdir'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:182:in `mkdir'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:175:in `locking'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:38:in `block in initialize'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:134:in `create_tmpname'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/file_system/uniquefile.rb:28:in `initialize'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/util.rb:453:in `new'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/util.rb:453:in `replace_file'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/util/yaml.rb:32:in `dump'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/transaction/persistence.rb:82:in `save'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/transaction.rb:148:in `block in evaluate'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/graph/relationship_graph.rb:147:in `call'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/graph/relationship_graph.rb:147:in `traverse'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/transaction.rb:154:in `evaluate'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/resource/catalog.rb:222:in `block in apply'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/util/log.rb:159:in `with_destination'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/transaction/report.rb:137:in `as_logging_destination'
           # /home/travis/.rvm/gems/ruby-2.1.6/gems/puppet-4.6.1/lib/puppet/resource/catalog.rb:221:in `apply'
           # ./spec/fixtures/modules/augeasproviders_core/spec/lib/augeas_spec/fixtures.rb:21:in `apply'
           # ./spec/fixtures/modules/augeasproviders_core/spec/lib/augeas_spec/fixtures.rb:26:in `apply!'
           # ./spec/unit/provider/avahi_host/augeas_spec.rb:18:in `block (3 levels) in <top (required)>'
      

      It looks like some path has been constructed using `/dev/null` as a base. If I use 4.5.3 then this error disappears.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bodgit Matt Dainty
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Zendesk Support