Skip to content

Commit 231a374

Browse files
committed
(spec) test roles against centos 7 using facterdb data
1 parent da25705 commit 231a374

21 files changed

+838
-673
lines changed

metadata.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "lsst-itconf",
3+
"version": "0.1.0",
4+
"author": "AURA/LSST/Rubin Observatory",
5+
"summary": "LSST/Rubin control repo",
6+
"license": "Apache-2.0",
7+
"source": "https://github.com/lsst-it/lsst-itconf",
8+
"dependencies": [],
9+
"operatingsystem_support": [
10+
{
11+
"operatingsystem": "CentOS",
12+
"operatingsystemrelease": [
13+
"7"
14+
]
15+
}
16+
],
17+
"requirements": [
18+
{
19+
"name": "puppet",
20+
"version_requirement": ">= 6.0.0 < 8.0.0"
21+
}
22+
]
23+
}

spec/classes/core/docker_spec.rb

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,42 @@
33
require 'spec_helper'
44

55
describe 'profile::core::docker' do
6-
it { is_expected.to compile.with_all_deps }
7-
8-
it do
9-
is_expected.to contain_class('docker').with(
10-
overlay2_override_kernel_check: true,
11-
socket_group: 70_014,
12-
socket_override: false,
13-
storage_driver: 'overlay2',
14-
version: '19.03.15',
15-
)
16-
end
6+
on_supported_os.each do |os, facts|
7+
context "on #{os}" do
8+
let(:facts) do
9+
facts
10+
end
1711

18-
it { is_expected.to contain_class('yum::plugin::versionlock') }
19-
it { is_expected.to have_yum__versionlock_resource_count(2) }
20-
it { is_expected.to contain_class('docker::networks') }
12+
it { is_expected.to compile.with_all_deps }
2113

22-
it do
23-
is_expected.to contain_systemd__dropin_file('wait-for-docker-group.conf').with(
24-
unit: 'docker.socket',
25-
content: %r{SocketGroup=root},
26-
)
27-
end
14+
it do
15+
is_expected.to contain_class('docker').with(
16+
overlay2_override_kernel_check: true,
17+
socket_group: 70_014,
18+
socket_override: false,
19+
storage_driver: 'overlay2',
20+
version: '19.03.15',
21+
)
22+
end
2823

29-
it do
30-
is_expected.to contain_file('/etc/systemd/system/docker.service.d/wait-for-docker-group.conf').with_content(%r{Requires=docker.socket containerd.service sssd.service})
31-
end
24+
it { is_expected.to contain_class('yum::plugin::versionlock') }
25+
it { is_expected.to have_yum__versionlock_resource_count(2) }
26+
it { is_expected.to contain_class('docker::networks') }
27+
28+
it do
29+
is_expected.to contain_systemd__dropin_file('wait-for-docker-group.conf').with(
30+
unit: 'docker.socket',
31+
content: %r{SocketGroup=root},
32+
)
33+
end
34+
35+
it do
36+
is_expected.to contain_file('/etc/systemd/system/docker.service.d/wait-for-docker-group.conf').with_content(%r{Requires=docker.socket containerd.service sssd.service})
37+
end
3238

33-
it do
34-
is_expected.to contain_file('/etc/docker/daemon.json').with_content(%r{"live-restore": true})
39+
it do
40+
is_expected.to contain_file('/etc/docker/daemon.json').with_content(%r{"live-restore": true})
41+
end
42+
end
3543
end
3644
end

spec/hosts/roles/amor_spec.rb

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,33 @@
22

33
require 'spec_helper'
44

5-
describe 'test1.dev.lsst.org' do
6-
describe 'amor role' do
7-
lsst_sites.each do |site|
8-
context "with site #{site}", :site, :common do
9-
let(:node_params) do
10-
{
11-
site: site,
12-
role: 'amor',
13-
cluster: 'amor',
14-
}
15-
end
5+
role = 'amor'
166

17-
it { is_expected.to compile.with_all_deps }
7+
describe "#{role} role" do
8+
on_supported_os.each do |os, facts|
9+
context "on #{os}" do
10+
let(:facts) do
11+
facts.merge(
12+
fqdn: self.class.description,
13+
)
14+
end
1815

19-
it { is_expected.to contain_class('docker::networks') }
16+
let(:node_params) do
17+
{
18+
role: role,
19+
site: site,
20+
cluster: role,
21+
}
2022
end
21-
end # site
22-
end # role
23-
end
23+
24+
lsst_sites.each do |site|
25+
describe "#{role}.#{site}.lsst.org", :site, :common do
26+
let(:site) { site }
27+
28+
it { is_expected.to compile.with_all_deps }
29+
it { is_expected.to contain_class('docker::networks') }
30+
end # host
31+
end # lsst_sites
32+
end # on os
33+
end # on_supported_os
34+
end # role

spec/hosts/roles/atsccs_spec.rb

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,34 @@
22

33
require 'spec_helper'
44

5-
shared_examples 'generic auxtel-mcm' do
6-
it { is_expected.to contain_class('ccs_sal') }
7-
end
8-
9-
describe 'atsccs role' do
10-
let(:node_params) do
11-
{
12-
role: 'atsccs',
13-
cluster: 'auxtel-ccs',
14-
}
15-
end
16-
17-
let(:facts) { { fqdn: self.class.description } }
18-
19-
context 'with tu site' do
20-
let(:node_params) do
21-
super().merge(
22-
site: 'tu',
23-
)
24-
end
25-
26-
describe 'auxtel-mcm.tu.lsst.org', :site, :common do
27-
it { is_expected.to compile.with_all_deps }
28-
29-
include_examples 'generic auxtel-mcm'
30-
end
31-
end # site
32-
33-
context 'with cp site' do
34-
let(:node_params) do
35-
super().merge(
36-
site: 'cp',
37-
)
38-
end
39-
40-
describe 'auxtel-mcm.cp.lsst.org', :site, :common do
41-
it { is_expected.to compile.with_all_deps }
42-
43-
include_examples 'generic auxtel-mcm'
44-
end
45-
end # site
46-
end
5+
role = 'atsccs'
6+
7+
describe "#{role} role" do
8+
on_supported_os.each do |os, facts|
9+
context "on #{os}" do
10+
let(:facts) do
11+
facts.merge(
12+
fqdn: self.class.description,
13+
)
14+
end
15+
16+
let(:node_params) do
17+
{
18+
role: role,
19+
site: site,
20+
cluster: 'auxtel-ccs',
21+
}
22+
end
23+
24+
lsst_sites.each do |site|
25+
describe "#{role}.#{site}.lsst.org", :site, :common do
26+
let(:site) { site }
27+
28+
it { is_expected.to compile.with_all_deps }
29+
30+
it { is_expected.to contain_class('ccs_sal') }
31+
end # host
32+
end # lsst_sites
33+
end # on os
34+
end # on_supported_os
35+
end # role

spec/hosts/roles/atsdaq_spec.rb

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,39 @@
22

33
require 'spec_helper'
44

5-
shared_examples 'generic auxtel-fp' do
6-
include_examples 'lsst-daq client'
7-
# it { is_expected.to contain_class('ccs_daq') }
8-
# it { is_expected.to contain_class('daq::daqsdk').with_version('R5-V0.6') }
9-
end
10-
11-
describe 'atsdaq role' do
12-
let(:node_params) do
13-
{
14-
role: 'atsdaq',
15-
cluster: 'auxtel-ccs',
16-
}
17-
end
18-
19-
let(:facts) { { fqdn: self.class.description } }
20-
21-
describe 'auxtel-fp01.cp.lsst.org', :site, :common do
22-
let(:node_params) do
23-
super().merge(
24-
site: 'cp',
25-
)
26-
end
27-
28-
it { is_expected.to compile.with_all_deps }
29-
30-
include_examples 'generic auxtel-fp'
31-
end # host
32-
33-
describe 'auxtel-fp01.tu.lsst.org', :site, :common do
34-
let(:node_params) do
35-
super().merge(
36-
site: 'tu',
37-
)
38-
end
39-
40-
it { is_expected.to compile.with_all_deps }
41-
42-
include_examples 'generic auxtel-fp'
43-
end # host
5+
role = 'atsdaq'
6+
7+
describe "#{role} role" do
8+
on_supported_os.each do |os, facts|
9+
context "on #{os}" do
10+
let(:facts) do
11+
facts.merge(
12+
fqdn: self.class.description,
13+
)
14+
end
15+
16+
let(:node_params) do
17+
{
18+
role: role,
19+
site: site,
20+
cluster: 'auxtel-ccs',
21+
}
22+
end
23+
24+
lsst_sites.each do |site|
25+
describe "auxtel-fp01.#{site}.lsst.org", :site, :common do
26+
let(:site) { site }
27+
28+
it { is_expected.to compile.with_all_deps }
29+
30+
case site
31+
when 'tu', 'cp'
32+
include_examples 'lsst-daq client'
33+
end
34+
# it { is_expected.to contain_class('ccs_daq') }
35+
# it { is_expected.to contain_class('daq::daqsdk').with_version('R5-V0.6') }
36+
end # host
37+
end # lsst_sites
38+
end # on os
39+
end # on_supported_os
4440
end # role

spec/hosts/roles/auxtel_archiver_spec.rb

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,55 @@
22

33
require 'spec_helper'
44

5-
describe 'test1.dev.lsst.org' do
6-
describe 'auxtel-archiver role' do
7-
lsst_sites.each do |site|
8-
context "with site #{site}", :site, :common do
9-
let(:node_params) do
10-
{
11-
site: site,
12-
role: 'auxtel-archiver',
13-
}
14-
end
15-
16-
it { is_expected.to compile.with_all_deps }
17-
18-
include_examples 'lhn sysctls'
19-
include_examples 'archiver'
20-
21-
it { is_expected.to contain_file('/data/repo/LATISS') }
22-
23-
it { is_expected.to contain_rabbitmq_vhost('/test_at') }
24-
it { is_expected.to contain_rabbitmq_user_permissions('iip@/test_at') }
25-
it { is_expected.to contain_rabbitmq_user_permissions('guest@/test_at') }
26-
it { is_expected.to contain_rabbitmq_exchange('message@/test_at') }
27-
28-
%w[
29-
f98_consume@/test_at
30-
f99_consume@/test_at
31-
at_foreman_ack_publish@/test_at
32-
at_publish_to_oods@/test_at
33-
oods_publish_to_at@/test_at
34-
archive_ctrl_publish@/test_at
35-
archive_ctrl_consume@/test_at
36-
telemetry_queue@/test_at
37-
].each do |q|
38-
it { is_expected.to contain_rabbitmq_queue(q) }
39-
it { is_expected.to contain_rabbitmq_binding("message@#{q}") }
40-
end
5+
role = 'auxtel-archiver'
6+
7+
describe "#{role} role" do
8+
on_supported_os.each do |os, facts|
9+
context "on #{os}" do
10+
let(:facts) do
11+
facts.merge(
12+
fqdn: self.class.description,
13+
)
14+
end
15+
16+
let(:node_params) do
17+
{
18+
role: role,
19+
site: site,
20+
}
4121
end
42-
end # site
43-
end # role
44-
end
22+
23+
lsst_sites.each do |site|
24+
describe "#{role}.#{site}.lsst.org", :site, :common do
25+
let(:site) { site }
26+
27+
it { is_expected.to compile.with_all_deps }
28+
29+
include_examples 'lhn sysctls'
30+
include_examples 'archiver'
31+
32+
it { is_expected.to contain_file('/data/repo/LATISS') }
33+
34+
it { is_expected.to contain_rabbitmq_vhost('/test_at') }
35+
it { is_expected.to contain_rabbitmq_user_permissions('iip@/test_at') }
36+
it { is_expected.to contain_rabbitmq_user_permissions('guest@/test_at') }
37+
it { is_expected.to contain_rabbitmq_exchange('message@/test_at') }
38+
39+
%w[
40+
f98_consume@/test_at
41+
f99_consume@/test_at
42+
at_foreman_ack_publish@/test_at
43+
at_publish_to_oods@/test_at
44+
oods_publish_to_at@/test_at
45+
archive_ctrl_publish@/test_at
46+
archive_ctrl_consume@/test_at
47+
telemetry_queue@/test_at
48+
].each do |q|
49+
it { is_expected.to contain_rabbitmq_queue(q) }
50+
it { is_expected.to contain_rabbitmq_binding("message@#{q}") }
51+
end
52+
end # host
53+
end # lsst_sites
54+
end # on os
55+
end # on_supported_os
56+
end # role

0 commit comments

Comments
 (0)