summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-10-24 18:13:24 -0700
committerdanielsdeleo <dan@chef.io>2016-11-02 08:06:38 -0700
commitbc596e0e0e3302dd013565943b1aa91f17fffc8f (patch)
tree25671021adf88f092c25c7f588dd824573219d79 /spec/support
parentb95fce9f28693aa09dd0d37742063027596f6847 (diff)
downloadchef-bc596e0e0e3302dd013565943b1aa91f17fffc8f.tar.gz
Enable the data collector automatically
Signed-off-by: Daniel DeLeo <dan@chef.io>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/context/client.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb
index b0530ab497..295bd6ce5f 100644
--- a/spec/support/shared/context/client.rb
+++ b/spec/support/shared/context/client.rb
@@ -68,9 +68,10 @@ shared_context "a client run" do
let(:api_client_exists?) { false }
let(:enable_fork) { false }
- let(:http_cookbook_sync) { double("Chef::ServerAPI (cookbook sync)") }
- let(:http_node_load) { double("Chef::ServerAPI (node)") }
- let(:http_node_save) { double("Chef::ServerAPI (node save)") }
+ let(:http_data_collector) { double("Chef::ServerAPI (data collector)") }
+ let(:http_cookbook_sync) { double("Chef::ServerAPI (cookbook sync)") }
+ let(:http_node_load) { double("Chef::ServerAPI (node)") }
+ let(:http_node_save) { double("Chef::ServerAPI (node save)") }
let(:reporting_rest_client) { double("Chef::ServerAPI (reporting client)") }
let(:runner) { instance_double("Chef::Runner") }
@@ -92,6 +93,13 @@ shared_context "a client run" do
end
end
+ def stub_for_data_collector_init
+ expect(Chef::ServerAPI).to receive(:new).
+ with(Chef::Config[:data_collector][:server_url]).
+ exactly(:once).
+ and_return(http_data_collector)
+ end
+
def stub_for_node_load
# Client.register will then turn around create another
# Chef::ServerAPI object, this time with the client key it got from the
@@ -154,6 +162,7 @@ shared_context "a client run" do
stub_rest_clean
stub_for_register
+ stub_for_data_collector_init
stub_for_node_load
stub_for_sync_cookbooks
stub_for_converge