Sha256: 9e6195dc40d46fb1da664f81f73dea69ed9d9f830e3209a95f9838d4b5fafdfe

Contents?: true

Size: 965 Bytes

Versions: 79

Compression:

Stored size: 965 Bytes

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/scheduler'

describe Puppet::Scheduler::SplayJob do
  let(:run_interval) { 10 }
  let(:last_run) { 50 }
  let(:splay_limit) { 5 }
  let(:start_time) { 23 }
  let(:job) { described_class.new(run_interval, splay_limit) }

  it "does not apply a splay after the first run" do
    job.run(last_run)
    job.interval_to_next_from(last_run).should == run_interval
  end

  it "calculates the first run splayed from the start time" do
    job.start_time = start_time

    job.interval_to_next_from(start_time).should == job.splay
  end

  it "interval to the next run decreases as time advances" do
    time_passed = 3
    job.start_time = start_time

    job.interval_to_next_from(start_time + time_passed).should == job.splay - time_passed
  end

  it "is not immediately ready if splayed" do
    job.start_time = start_time
    job.expects(:splay).returns(6)
    job.ready?(start_time).should_not be
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.6 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.5 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.4 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.3 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.2 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.1 spec/unit/scheduler/splay_job_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/scheduler/splay_job_spec.rb