Skip to content

stdlib::deferrable_epp fails in spec test for windows nodes #1455

@garrettrowell

Description

@garrettrowell

Describe the Bug

When unit testing the following class:

class deferred_test {
  $response = { 'response_string' => Deferred('deferred_test::api')}

  $response_result = stdlib::deferrable_epp('deferred_test/api_response.epp', $response)

  echo { 'API debug':
    message => $response_result,
  }
}

The following test fails only for windows targets:

# frozen_string_literal: true

require 'spec_helper'

describe 'deferred_test' do
  on_supported_os.each do |os, os_facts|
    context "on #{os}" do
      let(:node) { "#{os_facts[:os]['name'].downcase}-#{os_facts[:os]['release']['major'].delete('.')}.corp.com" }
      let(:facts) { os_facts }

      it { is_expected.to compile.with_all_deps }
      it { is_expected.to contain_echo('API debug').with_message("the response was '{\"response\":\"i did a thing\"}'\n") }
    end
  end
end

It's worth mentioning that the manifest behaves as expected during an agent run.

Expected Behavior

Unit tests to work against windows nodes

Steps to Reproduce

Steps to reproduce the behavior:

  1. git clone [email protected]:garrettrowell/deferred_test.git
  2. cd deferred_test
  3. pdk test unit -v

Environment

  • stdlib version: 9.7.0
  • PDK version: 3.4.0
  • rspec-puppet version: 5.0.0
  • Test ran on Mac

Additional Context

I've put together a sample module to demonstrate this behavior: https://github.com/garrettrowell/deferred_test

I'm not sure if this is an issue with stdlib, rspec, or the file puppet function.

Output from pdk test unit -v

pdk (INFO): Using Ruby 3.2.5
pdk (INFO): Using Puppet 8.10.0
[✔] Preparing to run the unit tests.
/opt/puppetlabs/pdk/private/ruby/3.2.5/bin/ruby -I/Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-core-3.13.5/lib:/Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-support-3.13.4/lib /Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-core-3.13.5/exe/rspec --pattern spec/\{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit\}/\*\*/\*_spec.rb --format documentation
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"CentOS", "os.release.full"=>"/^9/", "os.hardware"=>"x86_64"}, using v4.9.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"OracleLinux", "os.release.full"=>"/^7/", "os.hardware"=>"x86_64"}, using v4.2.2 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"Scientific", "os.release.full"=>"/^7/", "os.hardware"=>"x86_64"}, using v4.2.2 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"Rocky", "os.release.full"=>"/^8/", "os.hardware"=>"x86_64"}, using v4.9.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"AlmaLinux", "os.release.full"=>"/^8/", "os.hardware"=>"x86_64"}, using v4.9.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"Ubuntu", "os.release.full"=>"/^18\\.04/", "os.hardware"=>"x86_64"}, using v4.5.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"windows", "os.release.full"=>"\"2019\"", "os.hardware"=>"x86_64"}, using v4.7.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"windows", "os.release.full"=>"\"2022\"", "os.hardware"=>"x86_64"}, using v4.7.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"windows", "os.release.full"=>"\"10\"", "os.hardware"=>"x86_64"}, using v4.7.0 instead
No facts were found in the FacterDB for Facter v4.10.0 on {"os.name"=>"windows", "os.release.full"=>"\"11\"", "os.hardware"=>"x86_64"}, using v4.7.0 instead
Run options: exclude {:bolt=>true}

deferred_test
  on centos-9-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on oraclelinux-7-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on redhat-8-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on redhat-9-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on scientific-7-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on rocky-8-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on almalinux-8-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on debian-11-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on debian-12-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on ubuntu-18.04-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on ubuntu-20.04-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on ubuntu-22.04-x86_64
    is expected to compile into a catalogue without dependency cycles
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
  on windows-2019-x86_64
    is expected to compile into a catalogue without dependency cycles (FAILED - 1)
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n" (FAILED - 2)
  on windows-2022-x86_64
    is expected to compile into a catalogue without dependency cycles (FAILED - 3)
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n" (FAILED - 4)
  on windows-10-x86_64
    is expected to compile into a catalogue without dependency cycles (FAILED - 5)
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n" (FAILED - 6)
  on windows-11-x86_64
    is expected to compile into a catalogue without dependency cycles (FAILED - 7)
    is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n" (FAILED - 8)

Code coverage
  must cover at least 0% of resources


Coverage Report:

Total resources:   1
Touched resources: 1
Resource coverage: 100.00%

Failures:

  1) deferred_test on windows-2019-x86_64 is expected to compile into a catalogue without dependency cycles
     Failure/Error: it { is_expected.to compile.with_all_deps }
       error during compilation: Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-2019.corp.com
     # ./spec/classes/deferred_test_spec.rb:11:in `block (4 levels) in <top (required)>'

  2) deferred_test on windows-2019-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
     Failure/Error: it { is_expected.to contain_echo('API debug').with_message("the response was '{\"response\":\"i did a thing\"}'\n") }

     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-2019.corp.com
     # /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
     # ./spec/classes/deferred_test_spec.rb:12:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Puppet::ParseError:
     #   Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp
     #   /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'

  3) deferred_test on windows-2022-x86_64 is expected to compile into a catalogue without dependency cycles
     Failure/Error: it { is_expected.to compile.with_all_deps }
       error during compilation: Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-2022.corp.com
     # ./spec/classes/deferred_test_spec.rb:11:in `block (4 levels) in <top (required)>'

  4) deferred_test on windows-2022-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
     Failure/Error: it { is_expected.to contain_echo('API debug').with_message("the response was '{\"response\":\"i did a thing\"}'\n") }

     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-2022.corp.com
     # /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
     # ./spec/classes/deferred_test_spec.rb:12:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Puppet::ParseError:
     #   Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp
     #   /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'

  5) deferred_test on windows-10-x86_64 is expected to compile into a catalogue without dependency cycles
     Failure/Error: it { is_expected.to compile.with_all_deps }
       error during compilation: Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-10.corp.com
     # ./spec/classes/deferred_test_spec.rb:11:in `block (4 levels) in <top (required)>'

  6) deferred_test on windows-10-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
     Failure/Error: it { is_expected.to contain_echo('API debug').with_message("the response was '{\"response\":\"i did a thing\"}'\n") }

     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-10.corp.com
     # /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
     # ./spec/classes/deferred_test_spec.rb:12:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Puppet::ParseError:
     #   Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp
     #   /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'

  7) deferred_test on windows-11-x86_64 is expected to compile into a catalogue without dependency cycles
     Failure/Error: it { is_expected.to compile.with_all_deps }
       error during compilation: Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-11.corp.com
     # ./spec/classes/deferred_test_spec.rb:11:in `block (4 levels) in <top (required)>'

  8) deferred_test on windows-11-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
     Failure/Error: it { is_expected.to contain_echo('API debug').with_message("the response was '{\"response\":\"i did a thing\"}'\n") }

     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Method call, Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp (file: /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/stdlib/functions/deferrable_epp.pp, line: 12, column: 32) on node windows-11.corp.com
     # /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
     # ./spec/classes/deferred_test_spec.rb:12:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Puppet::ParseError:
     #   Could not find any files from /Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp
     #   /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'

Finished in 4.95 seconds (files took 1 minute 3.07 seconds to load)
33 examples, 8 failures

Failed examples:

rspec './spec/classes/deferred_test_spec.rb[1:13:1]' # deferred_test on windows-2019-x86_64 is expected to compile into a catalogue without dependency cycles
rspec './spec/classes/deferred_test_spec.rb[1:13:2]' # deferred_test on windows-2019-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
rspec './spec/classes/deferred_test_spec.rb[1:14:1]' # deferred_test on windows-2022-x86_64 is expected to compile into a catalogue without dependency cycles
rspec './spec/classes/deferred_test_spec.rb[1:14:2]' # deferred_test on windows-2022-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
rspec './spec/classes/deferred_test_spec.rb[1:15:1]' # deferred_test on windows-10-x86_64 is expected to compile into a catalogue without dependency cycles
rspec './spec/classes/deferred_test_spec.rb[1:15:2]' # deferred_test on windows-10-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"
rspec './spec/classes/deferred_test_spec.rb[1:16:1]' # deferred_test on windows-11-x86_64 is expected to compile into a catalogue without dependency cycles
rspec './spec/classes/deferred_test_spec.rb[1:16:2]' # deferred_test on windows-11-x86_64 is expected to contain Echo[API debug] with message => "the response was '{\"response\":\"i did a thing\"}'\n"

/opt/puppetlabs/pdk/private/ruby/3.2.5/bin/ruby -I/Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-core-3.13.5/lib:/Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-support-3.13.4/lib /Users/garrett.rowell/.pdk/cache/ruby/3.2.0/gems/rspec-core-3.13.5/exe/rspec --pattern spec/\{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit\}/\*\*/\*_spec.rb --format documentation failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions