Closed shaun-rutherford closed 3 years ago
@DavidS Same here, still an issue
2020-09-14 21:16:04.250127 | centos-8 | # ./.bundled_gems/gems/puppet_litmus-0.18.4/lib/puppet_litmus/puppet_helpers.rb:365:in `report_puppet_apply_error'
2020-09-14 21:16:04.250161 | centos-8 | # ./.bundled_gems/gems/puppet_litmus-0.18.4/lib/puppet_litmus/puppet_helpers.rb:100:in `block in apply_manifest'
2020-09-14 21:16:04.250194 | centos-8 | # ./.bundled_gems/gems/honeycomb-beeline-2.2.0/lib/honeycomb/client.rb:68:in `start_span'
2020-09-14 21:16:04.250228 | centos-8 | # ./.bundled_gems/gems/puppet_litmus-0.18.4/lib/puppet_litmus/puppet_helpers.rb:41:in `apply_manifest'
2020-09-14 21:16:04.250262 | centos-8 | # ./spec/acceptance/keystone_federation_identity_provider_spec.rb:78:in `block (3 levels) in <top (required)>'
2020-09-14 21:16:04.250310 | centos-8 |
2020-09-14 21:16:04.250383 | centos-8 | 2) keystone server running with Apache/WSGI with resources #keystone_domain_config with a multiple configurations Command "puppet resource keystone_domain_config" exit_status
2020-09-14 21:16:04.250406 | centos-8 | On host `localhost'
2020-09-14 21:16:04.250427 | centos-8 | Failure/Error: its(:exit_status) { should eq 0 }
2020-09-14 21:16:04.250448 | centos-8 | ArgumentError:
2020-09-14 21:16:04.250490 | centos-8 | wrong number of arguments (given 1, expected 2)
2020-09-14 21:16:04.250514 | centos-8 |
2020-09-14 21:16:04.250536 | centos-8 | # ./.bundled_gems/gems/bolt-2.27.0/lib/bolt_spec/run.rb:52:in `run_command'
2020-09-14 21:16:04.250557 | centos-8 | # ./.bundled_gems/gems/serverspec-2.41.5/lib/serverspec/type/command.rb:23:in `command_result'
2020-09-14 21:16:04.250579 | centos-8 | # ./.bundled_gems/gems/serverspec-2.41.5/lib/serverspec/type/command.rb:18:in `exit_status'
2020-09-14 21:16:04.250600 | centos-8 | # ./spec/acceptance/keystone_wsgi_apache_spec.rb:298:in `block (5 levels) in <top (required)>'
describe command('puppet resource keystone_domain_config') do
its(:exit_status) { should eq 0 }
end
Workaround for now.
it 'should list puppet resources' do
command('puppet resource keystone_domain_config') do |r|
expect(r.exit_code).to eq 0
end
end
I haven't been able to reproduce that with a current set of gems:
diff --git a/spec/acceptance/motd_spec.rb b/spec/acceptance/motd_spec.rb
index 9a05a8f..0d6189c 100644
--- a/spec/acceptance/motd_spec.rb
+++ b/spec/acceptance/motd_spec.rb
@@ -72,6 +72,12 @@ def test_motd(pp, expected_contain, filename)
end
describe 'Message of the day' do
+ describe command('/bin/true') do
+ its(:exit_status) { is_expected.to eq(0) }
+ end
+ describe command('/bin/false') do
+ its(:exit_status) { is_expected.to eq(1) }
+ end
context 'when static message from content' do
it do
test_motd(pp_static_content, "Hello world!\n", motd_file)
david@zion:~/git/puppetlabs-motd (main)$ bundle exec rake litmus:acceptance:localhost:2222
/home/david/gems/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156: warning: Using the last argument as keyword parameters is deprecated
/usr/bin/ruby2.7 -I/home/david/gems/ruby/2.7.0/gems/rspec-core-3.10.1/lib:/home/david/gems/ruby/2.7.0/gems/rspec-support-3.10.1/lib /home/david/gems/ruby/2.7.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/acceptance/\*\*\{,/\*/\*\*\}/\*_spec.rb
/home/david/gems/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156: warning: Using the last argument as keyword parameters is deprecated
/home/david/gems/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156: warning: Using the last argument as keyword parameters is deprecated
Message of the day
Command "/bin/true"
exit_status
is expected to eq 0
Command "/bin/false"
exit_status
is expected to eq 1
when static message from content
is expected to contain "Hello world!\n"
david@zion:~/git/puppetlabs-motd (main)$ bundle list
Gems included by the bundle:
* CFPropertyList (2.3.6)
* activesupport (6.1.1)
* addressable (2.7.0)
* ansi (1.5.0)
* ast (2.4.1)
* awesome_print (1.8.0)
* aws-eventstream (1.1.0)
* aws-partitions (1.416.0)
* aws-sdk-core (3.111.1)
* aws-sdk-ec2 (1.220.0)
* aws-sigv4 (1.2.2)
* bcrypt_pbkdf (1.1.0)
* bindata (2.4.8)
* bolt (2.42.0)
* builder (3.2.4)
* codecov (0.2.15)
* coderay (1.1.3)
* colored2 (3.1.2)
* concurrent-ruby (1.1.7)
* connection_pool (2.2.3)
* cri (2.15.11)
* deep_merge (1.2.1)
* dependency_checker (0.2.0)
* diff-lcs (1.4.4)
* docile (1.3.5)
* docker-api (2.0.0)
* domain_name (0.5.20190701)
* ed25519 (1.2.4)
* erubi (1.10.0)
* excon (0.78.1)
* facter (4.0.49)
* facterdb (1.6.0)
* faraday (0.17.3)
* faraday-http-cache (2.2.0)
* faraday_middleware (0.14.0)
* fast_gettext (1.1.2)
* ffi (1.13.1)
* ffi-compiler (1.0.1)
* gettext (3.2.9)
* gettext-setup (0.34)
* github_changelog_generator (1.15.2)
* gssapi (1.3.1)
* gyoku (1.3.1)
* hiera (3.6.0)
* hiera-eyaml (3.2.0)
* highline (1.6.21)
* hirb (0.7.3)
* hocon (1.3.1)
* honeycomb-beeline (2.4.0)
* http (4.4.1)
* http-accept (1.7.0)
* http-cookie (1.0.3)
* http-form_data (2.3.0)
* http-parser (1.2.3)
* httpclient (2.8.3)
* i18n (1.8.7)
* jgrep (1.5.4)
* jmespath (1.4.0)
* json (2.2.0)
* json-schema (2.8.1)
* jwt (2.2.2)
* libhoney (1.18.0)
* little-plugger (1.1.4)
* locale (2.1.3)
* log4r (1.1.10)
* logging (2.3.0)
* metaclass (0.0.4)
* metadata-json-lint (3.0.0)
* method_source (0.8.2)
* mime-types (3.3.1)
* mime-types-data (3.2020.1104)
* minitar (0.9)
* minitest (5.14.3)
* mocha (1.1.0)
* molinillo (0.7.0)
* multi_json (1.15.0)
* multipart-post (2.1.1)
* net-http-persistent (4.0.1)
* net-scp (1.2.1)
* net-ssh (6.1.0)
* net-ssh-krb (0.5.1)
* net-telnet (0.1.1)
* netrc (0.11.0)
* nori (2.6.0)
* octokit (4.20.0)
* optimist (3.0.1)
* orchestrator_client (0.5.1)
* parallel (1.20.1)
* parallel_tests (3.4.0)
* parser (3.0.0.0)
* pathspec (0.2.1)
* pluginator (1.5.0)
* pry (0.10.4)
* public_suffix (4.0.6)
* puppet (7.1.0)
* puppet-blacksmith (6.1.0)
* puppet-debugger (1.0.0)
* puppet-lint (2.4.2)
* puppet-module-posix-default-r2.7 (1.0.1)
* puppet-module-posix-dev-r2.7 (1.0.1)
* puppet-module-posix-system-r2.7 (1.0.1)
* puppet-modulebuilder (0.2.1)
* puppet-resource_api (1.8.13)
* puppet-strings (2.4.0 496ec8e)
* puppet-syntax (3.1.0)
* puppet_forge (2.3.4)
* puppet_litmus (0.21.0 081baf9)
* puppetfile-resolver (0.5.0)
* puppetlabs_spec_helper (2.15.0)
* r10k (3.7.0)
* rainbow (2.2.2)
* rake (12.3.3)
* rb-readline (0.5.5)
* regexp_parser (2.0.3)
* rest-client (2.1.0)
* retriable (3.1.2)
* retryable (3.0.5)
* rexml (3.2.4)
* rgen (0.8.2)
* rspec (3.10.0)
* rspec-core (3.10.1)
* rspec-expectations (3.10.1)
* rspec-its (1.3.0)
* rspec-mocks (3.10.1)
* rspec-puppet (2.8.0)
* rspec-puppet-facts (2.0.1)
* rspec-support (3.10.1)
* rspec_honeycomb_formatter (0.2.1)
* rspec_junit_formatter (0.4.1)
* rubocop (1.6.1)
* rubocop-ast (1.4.0)
* rubocop-performance (1.9.1)
* rubocop-rspec (2.0.1)
* ruby-progressbar (1.11.0)
* ruby_smb (1.1.0)
* rubyntlm (0.6.2)
* rubyzip (2.3.0)
* sawyer (0.8.2)
* scanf (1.0.0)
* semantic_puppet (1.0.3)
* serverspec (2.41.5)
* sfl (2.3)
* simplecov (0.18.5)
* simplecov-console (0.4.2)
* simplecov-html (0.12.3)
* slop (3.6.0)
* spdx-licenses (1.2.0)
* specinfra (2.82.2)
* strings (0.1.8)
* strings-ansi (0.2.0)
* table_print (1.5.7)
* terminal-table (1.8.0)
* text (1.3.1)
* thor (1.0.1)
* tty-cursor (0.7.1)
* tty-pager (0.13.0)
* tty-screen (0.8.1)
* tty-spinner (0.9.3)
* tzinfo (2.0.4)
* unf (0.1.4)
* unf_ext (0.0.7.7)
* unicode-display_width (1.7.0)
* unicode_utils (1.4.0)
* windows_error (0.1.2)
* winrm (2.3.5)
* winrm-fs (1.3.5)
* yard (0.9.26)
* zeitwerk (2.4.2)
Use `bundle info` to print more detailed information about a gem
david@zion:~/git/puppetlabs-motd (main)$
@DavidS I'm seeing this today with puppet_litmus 0.22.0:
On host `localhost:2222'
Failure/Error: its(:stdout) { is_expected.to match %r{google-public-dns-a.google.com has address 8.8.8.8} }
ArgumentError:
wrong number of arguments (given 1, expected 2)
@raphink replace your entire spec_helper_acceptance.rb with the documented code snippet:
# frozen_string_literal: true
require 'puppet_litmus'
PuppetLitmus.configure!
require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))
using this, the tests did not fail on me with this exception any more.
I'll try that, thanks @DavidS !
@DavidS Now I'm getting
An error occurred in a `before(:suite)` hook.
On host `localhost:2222'
Failure/Error: run_shell('puppet cert generate $(facter fqdn) || true')
NoMethodError:
undefined method `run_shell' for #<RSpec::Core::AnonymousExampleGroup (no description provided)>
Describe the Bug
Re-opening bug report from #227 Receiving the following when using a command method in puppet litmus: Command:
Output:
Expected Behavior
The command to execute and the exit_status to be evaluated.
Steps to Reproduce
Steps to reproduce the behavior: Write a module with an acceptance tests that uses the command function: https://serverspec.org/resource_types.html#command
pdk bundle exec rake 'litmus:provision_list[vagrant]' pdk bundle exec rake litmus:install_agent pdk bundle exec rake litmus:install_module pdk bundle exec rake litmus:acceptance:parallel
Environment
Additional Context
Running the latest PDK available.