[dd-handler] add tests for tags blacklist regex
MODIFY
spec/dd-handler_spec.rb
spec/dd-handler_spec.rb
@@ -10,7 +10,7 @@ shared_examples 'a chef-handler-datadog installer' do |version|
end
end
-shared_examples 'a chef-handler-datadog runner' do |extra_endpoints|
+shared_examples 'a chef-handler-datadog runner' do |extra_endpoints, tags_blacklist_regex|
it 'runs the handler' do
handler_config = {
api_key: 'somethingnotnil',
@@ -18,7 +18,8 @@ shared_examples 'a chef-handler-datadog runner' do |extra_endpoints|
use_ec2_instance_id: true,
tag_prefix: 'tag:',
url: 'https://app.datadoghq.com',
- extra_endpoints: extra_endpoints || []
+ extra_endpoints: extra_endpoints || [],
+ tags_blacklist_regex: tags_blacklist_regex
}
expect(chef_run).to enable_chef_handler('Chef::Handler::Datadog').with(
@@ -90,7 +91,7 @@ describe 'datadog::dd-handler' do
it_behaves_like 'a chef-handler-datadog installer'
- it_behaves_like 'a chef-handler-datadog runner', extra_endpoints
+ it_behaves_like 'a chef-handler-datadog runner', extra_endpoints, nil
end
context 'multiple endpoints disabled' do
cached(:chef_run) do
@@ -112,4 +113,23 @@ describe 'datadog::dd-handler' do
it_behaves_like 'a chef-handler-datadog runner'
end
+
+ context 'tags_blacklist_regex set' do
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ platform: 'ubuntu',
+ version: '14.04'
+ ) do |node|
+ node.set['datadog']['api_key'] = 'somethingnotnil'
+ node.set['datadog']['application_key'] = 'somethingnotnil2'
+ node.set['datadog']['chef_handler_enable'] = true
+ node.set['datadog']['use_ec2_instance_id'] = true
+ node.set['datadog']['tags_blacklist_regex'] = 'tags.*'
+ end.converge described_recipe
+ end
+
+ it_behaves_like 'a chef-handler-datadog installer'
+
+ it_behaves_like 'a chef-handler-datadog runner', nil, 'tags.*'
+ end
end

[dd-handler] add tests for tags blacklist regex