Skip to content

Commit 33271c5

Browse files
committed
Add spec tests
1 parent d15e0ea commit 33271c5

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

spec/classes/datadog_agent_spec.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,20 @@
833833
end
834834

835835
if DEBIAN_OS.include?(operatingsystem)
836-
it { should contain_class('datadog_agent::ubuntu::agent5') }
836+
it do
837+
should contain_class('datadog_agent::ubuntu::agent5')\
838+
.with_apt_keyserver('hkp://keyserver.ubuntu.com:80')
839+
end
840+
context 'use backup keyserver' do
841+
let(:params) {{
842+
:use_apt_backup_keyserver => true,
843+
:agent5_enable => true,
844+
}}
845+
it do
846+
should contain_class('datadog_agent::ubuntu::agent5')\
847+
.with_apt_keyserver('hkp://pool.sks-keyservers.net:80')
848+
end
849+
end
837850
elsif REDHAT_OS.include?(operatingsystem)
838851
it { should contain_class('datadog_agent::redhat::agent5') }
839852
end

spec/classes/datadog_agent_ubuntu_spec.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@
1717

1818
# it should install the mirror
1919
it { should_not contain_datadog_agent__ubuntu__install_key('935F5A436A5A6E8788F0765B226AE980C7A7DA52') }
20-
it { should contain_datadog_agent__ubuntu__install_key('A2923DFF56EDA6E76E55E492D3A80E30382E94DE') }
20+
it do
21+
should contain_datadog_agent__ubuntu__install_key('A2923DFF56EDA6E76E55E492D3A80E30382E94DE')\
22+
end
23+
context 'overriding keyserver' do
24+
let(:params) {{
25+
apt_keyserver: 'hkp://pool.sks-keyservers.net:80',
26+
}}
27+
it do
28+
should contain_datadog_agent__ubuntu__install_key('A2923DFF56EDA6E76E55E492D3A80E30382E94DE')\
29+
.with_server('hkp://pool.sks-keyservers.net:80')
30+
end
31+
end
32+
2133
it do
2234
should contain_file('/etc/apt/sources.list.d/datadog.list')\
2335
.that_notifies('exec[apt_update]')

0 commit comments

Comments
 (0)