Uploaded image for project: 'Puppet Development Kit (moved to puppet.atlassian.net)'
  1. Puppet Development Kit (moved to puppet.atlassian.net)
  2. PDK-1760

Puppet versions bundled with PDK 2.3.0 fail basic module unit tests for Windows

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • None
    • None
    • None
    • Customer Feedback
    • 47102
    • 1
    • Needs Assessment
    • Production

    Description

      PDK 2.3.0 comes bundled with Puppet versions 6.25.0 and 7.12.0 which are affected by Puppet bug PUP-11319. This bug causes basic is_expected.to compile unit tests to fail when classes are evaluated in the context of a Windows operating system.

      The --puppet-version flag cannot be used to select 7.12.1, 6.25.1, or any newer Puppet release where this issue was fixed. The flag can be used to select an older version, but airgapped installations will not be able to access Rubygems in order to download a version not bundled with PDK.

      This issue breaks CD4PE test pipelines upon upgrade to CD4PE 4.11 and newer.

      Reproduction Case

      • Install PDK 2.3.0 on a Linux or macOS workstation.
      • Use pdk new module to create a new module. Ensure "Windows" is selected under operating system support.
      • Use pdk new class to create a new class and associated testing code.
      • Edit the generated class and add a resource that uses a provider. Such as the example from PUP-11319:

        service { 'test':
          ensure  => 'running',
          enable  => true,
        }
      

      • Run pdk test unit.

      Outcome

      The is_expected.to compile spec test fails with an "uninitialized constant Puppet::Util::Windows" error:

      $ pdk --version
      2.3.0
       
      $ pdk test unit
      pdk (INFO): Using Ruby 2.7.3
      pdk (INFO): Using Puppet 7.12.0
      [✔] Preparing to run the unit tests.
      /opt/puppetlabs/pdk/private/ruby/2.7.3/bin/ruby -I/opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-core-3.10.1/lib:/opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-support-3.10.3/lib /opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit\}/\*\*/\*_spec.rb --format progress
      No facts were found in the FacterDB for Facter v4.2.4 on {:operatingsystem=>"windows", :operatingsystemrelease=>"\"2019\"", :hardwaremodel=>"x86_64"}, using v3.14.1 instead
      No facts were found in the FacterDB for Facter v4.2.4 on {:operatingsystem=>"windows", :operatingsystemrelease=>"\"10\"", :hardwaremodel=>"x86_64"}, using v3.14.1 instead
      Run options: exclude {:bolt=>true}
      FF
       
      Failures:
       
        1) win_spec_example on windows-10-x86_64 is expected to compile into a catalogue without dependency cycles
           Failure/Error: it { is_expected.to compile }
       
           NameError:
             uninitialized constant Puppet::Util::Windows
           # ./spec/classes/win_spec_example_spec.rb:10:in `block (4 levels) in <top (required)>'
       
        2) win_spec_example on windows-2019-x86_64 is expected to compile into a catalogue without dependency cycles
           Failure/Error: it { is_expected.to compile }
       
           NameError:
        1 Add class and spec test generated by pdk new class
             uninitialized constant Puppet::Util::Windows
           # ./spec/classes/win_spec_example_spec.rb:10:in `block (4 levels) in <top (required)>'
       
      Finished in 2.06 seconds (files took 8.44 seconds to load)
      2 examples, 2 failures
       
      Failed examples:
       
      rspec './spec/classes/win_spec_example_spec.rb[1:1:1]' # win_spec_example on windows-10-x86_64 is expected to compile into a catalogue without dependency cycles
      rspec './spec/classes/win_spec_example_spec.rb[1:2:1]' # win_spec_example on windows-2019-x86_64 is expected to compile into a catalogue without dependency cycles
       
      /opt/puppetlabs/pdk/private/ruby/2.7.3/bin/ruby -I/opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-core-3.10.1/lib:/opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-support-3.10.3/lib /opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit\}/\*\*/\*_spec.rb --format progress failed
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chuck Charlie Sharpsteen
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support