Skip to content

Commit 2eff925

Browse files
author
Himani Anil Deshpande
committed
[Kitchen Test] Test for cfn_hup_configuration resource
1 parent 5498c50 commit 2eff925

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

cookbooks/aws-parallelcluster-environment/kitchen.environment-config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,20 @@ suites:
314314
directory_service:
315315
enabled: "true"
316316
node_type: HeadNode
317+
- name: cfn_hup_configuration
318+
run_list:
319+
- recipe[aws-parallelcluster-tests::setup]
320+
- recipe[aws-parallelcluster-tests::test_resource]
321+
verifier:
322+
controls:
323+
- /tag:config_cfn_hup/
324+
attributes:
325+
resource: cfn_hup_configuration:configure
326+
dependencies:
327+
- recipe:aws-parallelcluster-platform::directories
328+
cluster:
329+
node_type: HeadNode
330+
stack_arn: 'test'
317331

318332
# Recipes
319333
- name: cfnconfig_mixed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License").
4+
# You may not use this file except in compliance with the License. A copy of the License is located at
5+
#
6+
# http://aws.amazon.com/apache2.0/
7+
#
8+
# or in the "LICENSE.txt" file accompanying this file.
9+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
10+
# See the License for the specific language governing permissions and limitations under the License.
11+
12+
control 'tag:config_cfn_hup_conf_files_created' do
13+
title "cfn_hup configuration files and directories should be created"
14+
15+
%w(/etc/cfn /etc/cfn/hooks.d).each do |dir|
16+
describe directory(dir) do
17+
it { should exist }
18+
its('mode') { should cmp '0770' }
19+
its('owner') { should eq 'root' }
20+
its('group') { should eq 'root' }
21+
end
22+
end
23+
24+
%w(/etc/cfn/cfn-hup.conf /etc/cfn/hooks.d/pcluster-update.conf).each do |conf_file|
25+
describe file(conf_file) do
26+
it { should exist }
27+
its('mode') { should cmp '0400' }
28+
its('owner') { should eq 'root' }
29+
its('group') { should eq 'root' }
30+
end
31+
end
32+
end
33+
34+
control 'tag:config_cfn_hup_head_node_configuration' do
35+
title "cfn_hup configuration files and directories for HeadNode should be created"
36+
only_if { instance.head_node? }
37+
38+
describe file("#{node['cluster']['scripts_dir']}/get_compute_user_data.py") do
39+
it { should exist }
40+
its('mode') { should cmp '0400' }
41+
its('owner') { should eq 'root' }
42+
its('group') { should eq 'root' }
43+
end
44+
45+
describe directory("#{node['cluster']['base_dir']}/dna") do
46+
it { should exist }
47+
end
48+
end
49+
50+
control 'tag:config_cfn_hup_compute_configuration' do
51+
title "cfn_hup configuration files and directories for ComputeFleet should be created"
52+
only_if { instance.compute_node? }
53+
54+
describe file("#{node['cluster']['scripts_dir']}/cfn-hup-update-action.sh") do
55+
it { should exist }
56+
its('mode') { should cmp '0744' }
57+
its('owner') { should eq 'root' }
58+
its('group') { should eq 'root' }
59+
end
60+
end

0 commit comments

Comments
 (0)