Sha256: 214ab9a5c40098e530da28366fa7e4db0363f2e9d3dac7b6f3969bfefffedccf

Contents?: true

Size: 1.66 KB

Versions: 44

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'
require 'puppet/face'
require 'puppet/file_serving/metadata'
require 'puppet/file_serving/content'
require 'puppet/indirector/memory'
require 'puppet/indirector/file_metadata'
require 'puppet/indirector/file_content'

module PuppetFaceIntegrationSpecs
describe "Puppet plugin face" do
  INDIRECTORS = [
    Puppet::Indirector::FileMetadata,
    Puppet::Indirector::FileContent,
  ]

  INDIRECTED_CLASSES = [
    Puppet::FileServing::Metadata,
    Puppet::FileServing::Content,
    Puppet::Node::Facts,
  ]

  INDIRECTORS.each do |indirector|
    class indirector::Memory < Puppet::Indirector::Memory
      def find(request)
        model.new('/dev/null', { 'type' => 'directory' })
      end
    end
  end

  before do
    FileUtils.mkdir(File.join(Puppet[:vardir], 'lib'))
    FileUtils.mkdir(File.join(Puppet[:vardir], 'facts.d'))
    FileUtils.mkdir(File.join(Puppet[:vardir], 'locales'))
    @termini_classes = {}
    INDIRECTED_CLASSES.each do |indirected|
      @termini_classes[indirected] = indirected.indirection.terminus_class
      indirected.indirection.terminus_class = :memory
    end
  end

  after do
    INDIRECTED_CLASSES.each do |indirected|
      indirected.indirection.terminus_class = @termini_classes[indirected]
      indirected.indirection.termini.clear
    end
  end

  def init_cli_args_and_apply_app(args = ["download"])
    Puppet::Application.find(:plugin).new(stub('command_line', :subcommand_name => :plugin, :args => args))
  end

  it "processes a download request" do
    app = init_cli_args_and_apply_app
    expect do
      expect {
        app.run
      }.to exit_with(0)
    end.to have_printed(/No plugins downloaded/)
  end
end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/integration/faces/plugin_spec.rb
puppet-6.4.0-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.4.0-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.4.0-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-6.0.7 spec/integration/faces/plugin_spec.rb
puppet-6.0.7-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.0.7-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.0.7-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-6.3.0 spec/integration/faces/plugin_spec.rb
puppet-6.3.0-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.3.0-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.3.0-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-6.2.0 spec/integration/faces/plugin_spec.rb
puppet-6.2.0-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.2.0-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.2.0-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-6.0.5 spec/integration/faces/plugin_spec.rb
puppet-6.0.5-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.0.5-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-6.0.5-universal-darwin spec/integration/faces/plugin_spec.rb