Sha256: db3a08b0a69483e3ab5af74dd3e7b9892aaacfadfed102f564e3501f33121ed7

Contents?: true

Size: 1.84 KB

Versions: 129

Compression:

Stored size: 1.84 KB

Contents

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

describe Puppet::Resource::Catalog do
  it "should support pson" do
    expect(Puppet::Resource::Catalog.supported_formats).to be_include(:pson)
  end

  describe "when using the indirector" do
    before do
      # This is so the tests work w/out networking.
      Facter.stubs(:to_hash).returns({"hostname" => "foo.domain.com"})
      Facter.stubs(:value).returns("eh")
    end


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

      # Load now, before we stub the exists? method.
      terminus = Puppet::Resource::Catalog.indirection.terminus(:yaml)
      terminus.expects(:path).with("me").returns "/my/yaml/file"

      Puppet::FileSystem.expects(:exist?).with("/my/yaml/file").returns false
      expect(Puppet::Resource::Catalog.indirection.find("me")).to be_nil
    end

    it "should be able to delegate to the :compiler terminus" do
      Puppet::Resource::Catalog.indirection.stubs(:terminus_class).returns :compiler

      # Load now, before we stub the exists? method.
      compiler = Puppet::Resource::Catalog.indirection.terminus(:compiler)

      node = mock 'node'
      node.stub_everything

      Puppet::Node.indirection.expects(:find).returns(node)
      compiler.expects(:compile).with(node, anything).returns nil

      expect(Puppet::Resource::Catalog.indirection.find("me")).to be_nil
    end

    it "should pass provided node information directly to the terminus" do
      terminus = mock 'terminus'

      Puppet::Resource::Catalog.indirection.stubs(:terminus).returns terminus

      node = mock 'node'
      terminus.stubs(:validate)
      terminus.expects(:find).with { |request| request.options[:use_node] == node }
      Puppet::Resource::Catalog.indirection.find("me", :use_node => node)
    end
  end
end

Version data entries

129 entries across 129 versions & 1 rubygems

Version Path
puppet-4.7.0 spec/integration/resource/catalog_spec.rb
puppet-4.7.0-x86-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.7.0-x64-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.7.0-universal-darwin spec/integration/resource/catalog_spec.rb
puppet-4.6.2 spec/integration/resource/catalog_spec.rb
puppet-4.6.2-x86-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.6.2-x64-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.6.2-universal-darwin spec/integration/resource/catalog_spec.rb
puppet-4.6.1-x86-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.6.1 spec/integration/resource/catalog_spec.rb
puppet-4.6.1-x64-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.6.1-universal-darwin spec/integration/resource/catalog_spec.rb
puppet-4.5.3 spec/integration/resource/catalog_spec.rb
puppet-4.5.3-x86-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.5.3-x64-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.5.3-universal-darwin spec/integration/resource/catalog_spec.rb
puppet-4.5.2 spec/integration/resource/catalog_spec.rb
puppet-4.5.2-x86-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.5.2-x64-mingw32 spec/integration/resource/catalog_spec.rb
puppet-4.5.2-universal-darwin spec/integration/resource/catalog_spec.rb