Sha256: f72583e14ef28dac22053437139d81ca7598431a2a0ef4ce670ea96aea03454b

Contents?: true

Size: 1.51 KB

Versions: 57

Compression:

Stored size: 1.51 KB

Contents

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

describe Puppet::Node::Facts do
  describe "when using the indirector" do
    it "should expire any cached node instances when it is saved" do
      Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml

      Puppet::Node::Facts.indirection.terminus(:yaml).should equal(Puppet::Node::Facts.indirection.terminus(:yaml))
      terminus = Puppet::Node::Facts.indirection.terminus(:yaml)
      terminus.stubs :save

      Puppet::Node.indirection.expects(:expire).with("me", optionally(instance_of(Hash)))

      facts = Puppet::Node::Facts.new("me")
      Puppet::Node::Facts.indirection.save(facts)
    end

    it "should be able to delegate to the :yaml terminus" do
      Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml

      # Load now, before we stub the exists? method.
      terminus = Puppet::Node::Facts.indirection.terminus(:yaml)

      terminus.expects(:path).with("me").returns "/my/yaml/file"
      Puppet::FileSystem.expects(:exist?).with("/my/yaml/file").returns false

      Puppet::Node::Facts.indirection.find("me").should be_nil
    end

    it "should be able to delegate to the :facter terminus" do
      Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :facter

      Facter.expects(:to_hash).returns "facter_hash"
      facts = Puppet::Node::Facts.new("me")
      Puppet::Node::Facts.expects(:new).with("me", "facter_hash").returns facts

      Puppet::Node::Facts.indirection.find("me").should equal(facts)
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/integration/node/facts_spec.rb
puppet-3.8.7-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.7-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.6 spec/integration/node/facts_spec.rb
puppet-3.8.6-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.6-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.5 spec/integration/node/facts_spec.rb
puppet-3.8.5-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.5-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.4 spec/integration/node/facts_spec.rb
puppet-3.8.4-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.4-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.3 spec/integration/node/facts_spec.rb
puppet-3.8.3-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.3-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.2 spec/integration/node/facts_spec.rb
puppet-3.8.2-x86-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.2-x64-mingw32 spec/integration/node/facts_spec.rb
puppet-3.8.1 spec/integration/node/facts_spec.rb
puppet-3.8.1-x86-mingw32 spec/integration/node/facts_spec.rb