Sha256: 683c506c42009bb9db6d2bb66b11b0b115cd35841505344dbfd2b5149cd3931e

Contents?: true

Size: 1.18 KB

Versions: 60

Compression:

Stored size: 1.18 KB

Contents

require 'foreman_tasks_test_helper'

module ForemanTasks
  module Concerns
    class PollingActionExtensionsTest < ::ActiveSupport::TestCase
      class Action < ::Dynflow::Action
        include ::Dynflow::Action::Polling
      end

      describe 'polling interval tuning' do
        let(:default_intervals) { [0.5, 1, 2, 4, 8, 16] }

        it 'is extends the polling action module' do
          _(::Dynflow::Action::Polling.ancestors.first).must_equal ForemanTasks::Concerns::PollingActionExtensions
        end

        it 'does not modify polling intervals by default' do
          _(Action.allocate.poll_intervals).must_equal default_intervals
        end

        it 'cannot make intervals shorter than 0.5 seconds' do
          Setting.expects(:[]).with(:foreman_tasks_polling_multiplier).returns 0
          _(Action.allocate.poll_intervals).must_equal(default_intervals.map { 0.5 })
        end

        it 'can be used to make the intervals longer' do
          value = 5
          Setting.expects(:[]).with(:foreman_tasks_polling_multiplier).returns value
          _(Action.allocate.poll_intervals).must_equal(default_intervals.map { |i| i * value })
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
foreman-tasks-9.0.4 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-9.1.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-9.0.2 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-9.0.1 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.3.3 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-9.0.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.2.1 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.1.4 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.3.2 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.3.1 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.1.3 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.3.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.2.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.1.2 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.1.1 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.1.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.0.2 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.0.1 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-8.0.0 test/lib/concerns/polling_action_extensions_test.rb
foreman-tasks-7.2.1 test/lib/concerns/polling_action_extensions_test.rb