From 071e84c6974d3f783abc8b5a0ded66684f6ac65f Mon Sep 17 00:00:00 2001 From: Enis Inan Date: Wed, 9 Jan 2019 09:53:37 -0800 Subject: (maint) Simplify the confine in the unauthorized users acceptance test --- ...orized_users_crontab_if_puppet_authorizes_them_spec.rb | 15 +++------------ 1 file 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 -- cgit v1.2.3