Hi again,

The issue you are seeing is connected to the test not having facts 
available to properly populate the hierarchy used by data-in-modules in the 
NTP module.

I've added

  let :facts do
    {
      os: {
        name: 'Debian',
        family: 'Debian',
        release: { major: 'stretch/sid', full: 'stretch/sid' }
      }
    }
  end

to the outer-most describe, and with that the test passed. Before you say 
it, yes the error messaging around this is atrocious and needs improvement. 
I've created https://tickets.puppetlabs.com/browse/PUP-6856 to track this.


Thanks for reporting this!
David


On Tuesday, November 1, 2016 at 10:12:21 AM UTC, David Schmitt wrote:
>
> Hi Steve,
>
> I can reproduce this locally, and it looks like some kind of setup issue 
> around how (rspec-)puppet is loading lookup data.
>
> I'll look into it, and keep you posted.
>
> Regards, David
>
> On Monday, October 31, 2016 at 2:39:54 AM UTC, Stephen Nesbitt wrote:
>>
>> All:
>>
>> I'm struggling to unit test a very simple profile with a dependency on 
>> the ntp 5.0.0 module - the ntp version implementing module data. The 
>> problem is that none of the default values for ntp are visible/available to 
>> the unit test as indicated by the failure:
>>   1) profile::ntp::client with default values for all parameters 
>> profile::ntp::client should 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 Function Call, Class[Ntp]:
>>          expects a value for parameter 'autoupdate'
>>          expects a value for parameter 'broadcastclient'
>>          expects a value for parameter 'config'
>>          ...
>>
>>
>> The profile::ntp::client class is very simple:
>>
>> class profile::ntp::client {
>>  include ::ntp
>> }
>>
>> My spec helper is:
>>
>> require 'puppetlabs_spec_helper/module_spec_helper'
>>
>> RSpec.configure do |c|
>>  c.after(:suite) do
>>  RSpec::Puppet::Coverage.report!(95)
>>  end
>> end
>>
>> My .fixtures.yml
>>
>>
>> fixtures:
>>  forge_modules:
>>  ntp: 'puppetlabs/ntp'
>>  stdlib: 'puppetlabs/stdlib'
>>  symlinks:
>>  profile: "#{source_dir}/../profile"
>>
>>
>> My unit test:
>>
>> require 'spec_helper'
>>
>> describe 'profile::ntp::client' do
>>   context 'with default values for all parameters' do
>>     describe 'profile::ntp::client' do
>>       it { is_expected.to compile.with_all_deps }
>>       # it { is_expected.to contain_class('profile::ntp::client') }
>>       # it { is_expected.to contain_class('::ntp') }
>>
>>       end
>>   end
>> end
>>
>>
>> Puppet version is 4.7.0. Host OS is ubuntu 16.04
>>
>>
>> Any help in resolving this would be much appreciated.
>>
>>
>> -steve
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a708176a-e8e2-45c3-90ae-7e3148ffa1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to