bastelfreak
04/28/2025, 12:38 PMYury Bushmelev
05/08/2025, 5:40 AMkernel
fact value to make my Linux-confined fact unit test to work on MacOS.Yury Bushmelev
05/08/2025, 5:42 AMFacter.clear
in before :each
hook, which looks legit but I should recheck the sources/documentation regarding this š¤Yury Bushmelev
05/08/2025, 5:44 AMWouter Mellema
05/21/2025, 9:23 AMpuppet-nvm
running with litmus and docker instead of beaker. After quite a few hours of trial and error, the tests finally run. However, i'm hit with the following error across all tests:
nvm class running puppet code Command ". /etc/profile.d/nvm.sh && nvm ls" stdout
On host `localhost:52343'
Failure/Error: its(:stdout) { should match /0.10.36/ }
ArgumentError:
wrong number of arguments (given 1, expected 2)
Wouter Mellema
05/21/2025, 9:24 AMdescribe command('. /etc/profile.d/nvm.sh && nvm ls') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match /0.10.36/ }
end
kenyon
05/21/2025, 6:25 PMWouter Mellema
05/23/2025, 1:57 PMdescribe command
syntax and the its
syntax SHOULD be valid serverspec as described at the litmus docs. It works for things like describe file
, but not for command
. That's the issue I want to fix :)Yury Bushmelev
05/23/2025, 2:21 PMcommand('source /etc/profile.d/nvm.sh && nvm ls')
.. I saw some problems with .
few times in other context.. wouldnāt be surprised if it causes some issuesYury Bushmelev
05/23/2025, 2:22 PMcommand()
doesnāt use shellWouter Mellema
05/23/2025, 4:55 PMsource
, nothing changes unfortunately. It seems that, somehow, the syntax of the test itself is wrong. There are some tests specified that run as a user, with a specific shell, but those also fail with the same error. Example included underneath
describe command('su - foo -c "source /home/foo/.nvm/nvm.sh && nvm --version" -s /bin/bash') do
Wouter Mellema
05/23/2025, 4:58 PMls /
, it breaks the same way
5) nvm::npm define install local package Command "ls /" exit_status
On host `localhost:52507'
Failure/Error: its(:exit_status) { <http://is_expected.to|is_expected.to> eq 0 }
ArgumentError:
wrong number of arguments (given 1, expected 2)
# /home/wmellema/.pdk/cache/ruby/3.2.0/gems/bolt-4.0.0/lib/bolt_spec/run.rb:52:in `run_command'
# /home/wmellema/.pdk/cache/ruby/3.2.0/gems/serverspec-2.43.0/lib/serverspec/type/command.rb:28:in `command_result'
# /home/wmellema/.pdk/cache/ruby/3.2.0/gems/serverspec-2.43.0/lib/serverspec/type/command.rb:18:in `exit_status'
# ./spec/acceptance/02_nvm_npm_spec.rb:42:in `block (4 levels) in <top (required)>'
Jacob McGee
06/03/2025, 5:06 PMyachub
06/06/2025, 7:41 PMlet(:params) { {'password' =>sensitive('secret') } }
as described at https://www.rubydoc.info/gems/rspec-puppet, but it seems like pdk test unit
is still attempting to open eyaml keys, which don't exist in CI. Related, I know onceover has the ability to use a separate hiera.yaml
file where the suggestion is to remove the eyaml config options, but not sure if pdk/rspec-puppet supports anything like that.jesse
06/13/2025, 5:10 AMGarrett Rowell
07/15/2025, 7:41 PMit { <http://is_expected.to|is_expected.to> compile.with_all_deps }
test is failing only for windows nodes, rhel/debian/etc work just fine. of note iām running the tests on a mac. In my manifest I have the following:
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,
}
}
Iāve narrowed it down to https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/functions/deferrable_epp.pp#L12 specifically the .file
call in stdlib::deferrable_epp. The error Iām getting is:
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 <http://windows-2022.corp.com|windows-2022.corp.com>
The code in question works as expected when ran against a windows node, just trying to get the tests working as wellbastelfreak
07/15/2025, 7:42 PMGarrett Rowell
07/15/2025, 7:43 PM# frozen_string_literal: true
require 'spec_helper'
describe 'deferred_test' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
it { <http://is_expected.to|is_expected.to> compile.with_all_deps }
end
end
end
bastelfreak
07/15/2025, 8:02 PM/Users/garrett.rowell/workspace/puppet/deferred_test/spec/fixtures/modules/deferred_test/templates/api_response.epp
the correct path?Garrett Rowell
07/15/2025, 8:05 PMredhat-7-x86_64
it seems to find the template just finebastelfreak
07/15/2025, 8:06 PMbastelfreak
07/15/2025, 8:06 PMGarrett Rowell
07/15/2025, 8:08 PMbastelfreak
07/15/2025, 8:09 PMGarrett Rowell
07/15/2025, 8:13 PMfile
function. since if i change:
Deferred(
'inline_epp',
[find_template($template).file, $variables],
)
to:
Deferred(
'inline_epp',
[find_template($template), $variables],
)
my test spits out the correct path, it just wonāt render the template which is to be expectedGarrett Rowell
07/15/2025, 9:07 PMCVQuesty
08/04/2025, 3:33 PMnatemccurdy
08/04/2025, 9:55 PMKeith Ward
08/12/2025, 6:37 PMTino Müller
09/08/2025, 7:40 AM