Skip to content

Commit f412cb9

Browse files
Add unit tests
Signed-off-by: Hanwen <[email protected]>
1 parent f05574e commit f412cb9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2024 Amazon.com, Inc. and its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
6+
# License. A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0/
9+
#
10+
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
11+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
require 'spec_helper'
15+
16+
recipes = %w(
17+
aws-parallelcluster-slurm::config_head_node_directories
18+
aws-parallelcluster-slurm::external_slurmdbd_disable_unrequired_services
19+
aws-parallelcluster-slurm::config_munge_key
20+
aws-parallelcluster-slurm::retrieve_slurmdbd_config_from_s3
21+
aws-parallelcluster-slurm::config_slurm_accounting
22+
)
23+
24+
describe 'aws-parallelcluster-entrypoints::external_slurmdbd_config' do
25+
before do
26+
@included_recipes = []
27+
recipes.each do |recipe_name|
28+
allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with(recipe_name) do
29+
@included_recipes << recipe_name
30+
end
31+
end
32+
end
33+
34+
for_all_oses do |platform, version|
35+
context "on #{platform}#{version}" do
36+
cached(:chef_run) do
37+
runner.converge(described_recipe)
38+
end
39+
40+
expected_recipes = recipes
41+
42+
it "includes the recipes in the right order" do
43+
chef_run
44+
expect(@included_recipes).to eq(expected_recipes)
45+
end
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)