Sha256: 3ca1a14cc97b4068f9d7950f13aca12eddef7f6cb84a3afc97e5d092a258bc7d

Contents?: true

Size: 1.04 KB

Versions: 340

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'puppet/util/splayer'

describe Puppet::Util::Splayer do
  include Puppet::Util::Splayer

  let (:subject) { self }

  before do
    Puppet[:splay] = true
    Puppet[:splaylimit] = "10"
  end

  it "should do nothing if splay is disabled" do
    Puppet[:splay] = false
    expect(subject).not_to receive(:sleep)
    subject.splay
  end

  it "should do nothing if it has already splayed" do
    expect(subject).to receive(:splayed?).and_return(true)
    expect(subject).not_to receive(:sleep)
    subject.splay
  end

  it "should log that it is splaying" do
    allow(subject).to receive(:sleep)
    expect(Puppet).to receive(:info)
    subject.splay
  end

  it "should sleep for a random portion of the splaylimit plus 1" do
    Puppet[:splaylimit] = "50"
    expect(subject).to receive(:rand).with(51).and_return(10)
    expect(subject).to receive(:sleep).with(10)
    subject.splay
  end

  it "should mark that it has splayed" do
    allow(subject).to receive(:sleep)
    subject.splay
    expect(subject).to be_splayed
  end
end

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/util/splayer_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.3.0-universal-darwin spec/unit/util/splayer_spec.rb
puppet-8.4.0 spec/unit/util/splayer_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.4.0-universal-darwin spec/unit/util/splayer_spec.rb
puppet-7.28.0 spec/unit/util/splayer_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/util/splayer_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/util/splayer_spec.rb
puppet-7.28.0-universal-darwin spec/unit/util/splayer_spec.rb
puppet-8.3.1 spec/unit/util/splayer_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/util/splayer_spec.rb
puppet-8.3.1-universal-darwin spec/unit/util/splayer_spec.rb
puppet-7.27.0 spec/unit/util/splayer_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/util/splayer_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/util/splayer_spec.rb
puppet-7.27.0-universal-darwin spec/unit/util/splayer_spec.rb