-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathdatadog_agent_reports_spec.rb
More file actions
99 lines (89 loc) · 2.76 KB
/
datadog_agent_reports_spec.rb
File metadata and controls
99 lines (89 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
require 'spec_helper'
describe 'datadog_agent::reports' do
context 'all supported operating systems' do
let(:params) do
{
api_key: 'notanapikey',
hostname_extraction_regex: nil,
puppetmaster_user: 'puppet',
dogapi_version: 'installed',
puppet_gem_provider: 'gem'
}
end
ALL_OS.each do |operatingsystem|
describe "datadog_agent class common actions on #{operatingsystem}" do
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: DEBIAN_OS.include?(operatingsystem) ? 'debian' : 'redhat'
}
end
it { should contain_class('ruby').with_rubygems_update(false) }
it { should contain_class('ruby::params') }
it { should contain_package('ruby').with_ensure('installed') }
it { should contain_package('rubygems').with_ensure('installed') }
if DEBIAN_OS.include?(operatingsystem)
it do
should contain_package('ruby-dev')\
.with_ensure('installed')\
.that_comes_before('Package[dogapi]')
end
elsif REDHAT_OS.include?(operatingsystem)
it do
should contain_package('ruby-devel')\
.with_ensure('installed')\
.that_comes_before('Package[dogapi]')
end
end
it do
should contain_package('dogapi')\
.with_ensure('installed')
.with_provider('gem')
end
it do
should contain_file('/etc/dd-agent/datadog.yaml')\
.with_owner('puppet')\
.with_group('root')
end
end
end
end
context 'specific dogapi version' do
let(:params) do
{
api_key: 'notanapikey',
hostname_extraction_regex: nil,
puppetmaster_user: 'puppet',
dogapi_version: '1.2.2',
puppet_gem_provider: 'gem'
}
end
describe "datadog_agent class dogapi version override" do
let(:facts) do
{
operatingsystem: 'Debian',
osfamily: 'debian'
}
end
it { should contain_class('ruby').with_rubygems_update(false) }
it { should contain_class('ruby::params') }
it { should contain_package('ruby').with_ensure('installed') }
it { should contain_package('rubygems').with_ensure('installed') }
it do
should contain_package('ruby-dev')\
.with_ensure('installed')\
.that_comes_before('Package[dogapi]')
end
it do
should contain_package('dogapi')\
.with_ensure('1.2.2')
.with_provider('gem')
end
it do
should contain_file('/etc/dd-agent/datadog.yaml')\
.with_owner('puppet')\
.with_group('root')
end
end
end
end