summaryrefslogtreecommitdiff
path: root/chef-config/spec
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-11-03 10:01:43 -0700
committerdanielsdeleo <dan@chef.io>2016-11-03 13:53:25 -0700
commit49cc8b15d99216c5fb55b690e8cd22d22e5f359f (patch)
tree7b650979d7f82f773045b33adfc1a43c00d6a18e /chef-config/spec
parent34d2b287c6a7ee0afb303b49054a25fd96f0a30a (diff)
downloadchef-49cc8b15d99216c5fb55b690e8cd22d22e5f359f.tar.gz
Enable data collector w/o token for solo, but require explicit URL
Third-party data collector implementations are supported and may not require a token for authentication. Therefore we must allow the case where the token is nil in Chef Solo mode. To reduce the chance that the data collector is accidentally enabled, only set the data collector URL to a default value in Chef Client mode. Signed-off-by: Daniel DeLeo <dan@chef.io>
Diffstat (limited to 'chef-config/spec')
-rw-r--r--chef-config/spec/unit/config_spec.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index e6070adb5a..806ab7d4fa 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -1131,9 +1131,25 @@ RSpec.describe ChefConfig::Config do
context "when using default settings" do
- it "configures the data collector URL as a relative path to the Chef Server URL" do
- ChefConfig::Config[:chef_server_url] = "https://chef.example/organizations/myorg"
- expect(ChefConfig::Config[:data_collector][:server_url]).to eq("https://chef.example/organizations/myorg/data-collector")
+ context "for Chef Client" do
+
+ it "configures the data collector URL as a relative path to the Chef Server URL" do
+ ChefConfig::Config[:chef_server_url] = "https://chef.example/organizations/myorg"
+ expect(ChefConfig::Config[:data_collector][:server_url]).to eq("https://chef.example/organizations/myorg/data-collector")
+ end
+
+ end
+
+ context "for Chef Solo" do
+
+ before do
+ ChefConfig::Config[:solo] = true
+ end
+
+ it "sets the data collector server URL to nil" do
+ ChefConfig::Config[:chef_server_url] = "https://chef.example/organizations/myorg"
+ expect(ChefConfig::Config[:data_collector][:server_url]).to be_nil
+ end
end