Skip to content

Conversation

@bastelfreak
Copy link
Member

@bastelfreak bastelfreak commented Oct 7, 2018

This is a rebase of #118

Fixes #116

@bastelfreak bastelfreak added the enhancement New feature or request label Oct 7, 2018
@bastelfreak
Copy link
Member Author

Hi @linuxdan. I fixed the spec issues. The function was in the wrong directory. Can you add an acceptance test for this?

@linuxdan
Copy link

linuxdan commented Oct 7, 2018

@bastelfreak
Sure, but I do not know how.
Might you have a link or three describing how to write one ?

@linuxdan
Copy link

linuxdan commented Apr 4, 2019

@dhoppe I could never get past Travis.
If you can get my function into the master branch, I would be eternally grateful.

@dhoppe
Copy link
Member

dhoppe commented Apr 5, 2019

TravisCI fails for two reasons. First the variable $path contains a / and the Rspec tests have to be adjusted.

  1) yum::gpgkey with content provided with ensure = present should contain Exec[rpm-import-/test-key] with path => "/bin:/usr/bin:/sbin/:/usr/sbin", command => "rpm --import /test-key", unless => "rpm -q gpg-pubkey-$(gpg --with-colons /test-key | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')" and require => "File[/test-key]"
     �[31mFailure/Error:�[0m
     �[31m  is_expected.to contain_exec("rpm-import-#{title}").with(�[0m
     �[31m    'path'    => '/bin:/usr/bin:/sbin/:/usr/sbin',�[0m
     �[31m    'command' => "rpm --import #{title}",�[0m
     �[31m    'unless'  => "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')",�[0m
     �[31m    'require' => "File[#{title}]"�[0m
     �[31m  )�[0m
     �[31m�[0m
     �[31m  expected that the catalogue would contain Exec[rpm-import-/test-key]�[0m
     �[36m# ./spec/defines/gpgkey_spec.rb:21:in `block (4 levels) in <top (required)>'�[0m

  2) yum::gpgkey with content provided with ensure = absent should contain Exec[rpm-delete-/test-key] with path => "/bin:/usr/bin:/sbin/:/usr/sbin", command => "rpm -e gpg-pubkey-$(gpg --with-colons /test-key | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')", onlyif => ["test -f /test-key", "rpm -q gpg-pubkey-$(gpg --with-colons /test-key | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')"] and before => "File[/test-key]"
     �[31mFailure/Error:�[0m
     �[31m  is_expected.to contain_exec("rpm-delete-#{title}").with(�[0m
     �[31m    'path'    => '/bin:/usr/bin:/sbin/:/usr/sbin',�[0m
     �[31m    'command' => "rpm -e gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')",�[0m
     �[31m    'onlyif'  => ["test -f #{title}", "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')"],�[0m
     �[31m    'before' => "File[#{title}]"�[0m
     �[31m  )�[0m
     �[31m�[0m
     �[31m  expected that the catalogue would contain Exec[rpm-delete-/test-key]�[0m
     �[36m# ./spec/defines/gpgkey_spec.rb:37:in `block (4 levels) in <top (required)>'�[0m
puppetlabs_spec_helper: defaults `mock_with` to `:mocha`. See https://github.com/puppetlabs/puppetlabs_spec_helper#mock_with to choose a sensible value for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests-fail

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants