@@ -21,6 +21,7 @@ def self.update(chef_run)
2121script_dir = 'SCRIPT_DIR'
2222slurm_install_dir = 'SLURM_INSTALL_DIR'
2323block_sizes = '9,18'
24+ new_block_size = '1,2'
2425cluster_config = 'CONFIG_YAML'
2526cookbook_env = 'FAKE_COOKBOOK_PATH'
2627force_configuration_extra_args = ' --force-configuration'
@@ -162,9 +163,8 @@ def self.update(chef_run)
162163 chef_run . find_resource ( 'block_topology' , 'update' )
163164 end
164165
165- context "when queues are updated and topolog.conf does exists" do
166+ context "when capacity block is removed and topolog.conf does exists" do
166167 before do
167- allow_any_instance_of ( Object ) . to receive ( :are_queues_updated? ) . and_return ( true )
168168 allow ( File ) . to receive ( :exist? ) . with ( "#{ slurm_install_dir } /etc/topology.conf" ) . and_return ( true )
169169 chef_run . node . override [ 'cluster' ] [ 'p6egb200_block_sizes' ] = nil
170170 end
@@ -174,20 +174,19 @@ def self.update(chef_run)
174174 end
175175 end
176176
177- context "when queues are not updated and topolog.conf does not exists" do
177+ context "when capacity block is not used and topolog.conf does not exists" do
178178 before do
179- allow_any_instance_of ( Object ) . to receive ( :are_queues_updated? ) . and_return ( false )
180179 allow ( File ) . to receive ( :exist? ) . with ( "#{ slurm_install_dir } /etc/topology.conf" ) . and_return ( false )
180+ chef_run . node . override [ 'cluster' ] [ 'p6egb200_block_sizes' ] = nil
181181 end
182182
183183 it 'it gives nil' do
184184 expect ( resource . topology_generator_command_args ) . to eq ( nil )
185185 end
186186 end
187187
188- context "when queues are updated and topolog.conf does not exists" do
188+ context "when capacity block is updated and topolog.conf does not exists" do
189189 before do
190- allow_any_instance_of ( Object ) . to receive ( :are_queues_updated? ) . and_return ( true )
191190 allow ( File ) . to receive ( :exist? ) . with ( "#{ slurm_install_dir } /etc/topology.conf" ) . and_return ( false )
192191 chef_run . node . override [ 'cluster' ] [ 'p6egb200_block_sizes' ] = block_sizes
193192 end
@@ -197,6 +196,17 @@ def self.update(chef_run)
197196 end
198197 end
199198
199+ context "when capacity block is updated and topolog.conf does exists" do
200+ before do
201+ allow ( File ) . to receive ( :exist? ) . with ( "#{ slurm_install_dir } /etc/topology.conf" ) . and_return ( true )
202+ chef_run . node . override [ 'cluster' ] [ 'p6egb200_block_sizes' ] = new_block_size
203+ end
204+
205+ it 'returns block-sizes argument' do
206+ expect ( resource . topology_generator_command_args ) . to eq ( " --block-sizes #{ new_block_size } " )
207+ end
208+ end
209+
200210 context "when block sizes is not nil" do
201211 before do
202212 chef_run . node . override [ 'cluster' ] [ 'p6egb200_block_sizes' ] = block_sizes
0 commit comments