diff options
author | Enis Inan <enis.inan@puppet.com> | 2019-01-09 09:53:37 -0800 |
---|---|---|
committer | Enis Inan <enis.inan@puppet.com> | 2019-01-09 09:53:37 -0800 |
commit | 071e84c6974d3f783abc8b5a0ded66684f6ac65f (patch) | |
tree | 9164f92b9654ed6ae84271a7d205fc3c8c32cd53 /spec | |
parent | a369886d68aa84a14defd3e594aa75cab71da328 (diff) | |
download | puppet-cron_core-071e84c6974d3f783abc8b5a0ded66684f6ac65f.tar.gz puppet-cron_core-071e84c6974d3f783abc8b5a0ded66684f6ac65f.tar.bz2 |
(maint) Simplify the confine in the unauthorized users acceptance test
Diffstat (limited to 'spec')
-rw-r--r-- | spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb b/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb index 964cc17..834cac7 100644 --- a/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb +++ b/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb @@ -1,17 +1,6 @@ require 'spec_helper_acceptance' RSpec.context 'when Puppet authorizes a previously unauthorized user to use crontab' do - class << self - alias_method :orig_compatible_agents, :compatible_agents - - # This test is confined to AIX and Solaris agents only. - def compatible_agents - orig_compatible_agents.select do |agent| - agent['platform'].include?('aix') || agent['platform'].include?('solaris') - end - end - end - let(:username) { "pl#{rand(999_999).to_i}" } let(:unauthorized_username) { "pl#{rand(999_999).to_i}" } @@ -70,7 +59,9 @@ RSpec.context 'when Puppet authorizes a previously unauthorized user to use cron end compatible_agents.each do |agent| - it "should write that user's crontab on #{agent}" do + is_aix_or_solaris_agent = agent['platform'].include?('aix') || agent['platform'].include?('solaris') + + it "should write that user's crontab on #{agent}", if: is_aix_or_solaris_agent do step 'Add the unauthorized user to the cron.deny file' do on(agent, "echo #{unauthorized_username} >> #{cron_deny_path[agent]}") end |