summaryrefslogtreecommitdiff
path: root/spec/unit/indirector/facts/inventory_service_spec.rb
blob: 5b2db6928918dec17ed0e226dd800b20aaa8acdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env ruby
require 'spec_helper'

require 'puppet/indirector/facts/inventory_service'

describe Puppet::Node::Facts::InventoryService do
  it "should suppress failures and warn when saving facts" do
    facts = Puppet::Node::Facts.new('foo')
    request = Puppet::Indirector::Request.new(:facts, :save, nil, facts)

    Net::HTTP.any_instance.stubs(:put).raises(Errno::ECONNREFUSED)

    Puppet.expects(:warning).with do |msg|
      msg =~ /Could not upload facts for foo to inventory service/
    end

    expect {
      subject.save(request)
    }.to_not raise_error
  end
end