@@ -253,80 +253,85 @@ def mock_already_installed(package, expected_version, installed)
253
253
254
254
describe 'efs:mount' do
255
255
for_all_oses do |platform , version |
256
- context "on #{ platform } #{ version } " do
257
- cached ( :chef_run ) do
258
- runner = ChefSpec ::Runner . new (
259
- platform : platform , version : version ,
260
- step_into : [ 'efs' ]
261
- ) do |node |
262
- node . override [ 'cluster' ] [ 'region' ] = "REGION"
263
- node . override [ 'cluster' ] [ 'aws_domain' ] = "DOMAIN"
264
- end
265
- runner . converge_dsl do
266
- efs 'mount' do
267
- efs_fs_id_array %w( id_1 id_2 id_3 )
268
- shared_dir_array %w( shared_dir_1 /shared_dir_2 /shared_dir_3 )
269
- efs_encryption_in_transit_array %w( true true not_true )
270
- efs_iam_authorization_array %w( not_true true true )
271
- action :mount
256
+ %w( HeadNode ComputeFleet ) . each do |node_type |
257
+ context "on #{ platform } #{ version } and node type #{ node_type } " do
258
+ cached ( :chef_run ) do
259
+ runner = ChefSpec ::Runner . new (
260
+ platform : platform , version : version ,
261
+ step_into : [ 'efs' ]
262
+ ) do |node |
263
+ node . override [ 'cluster' ] [ 'region' ] = "REGION"
264
+ node . override [ 'cluster' ] [ 'aws_domain' ] = "DOMAIN"
265
+ node . override [ 'cluster' ] [ 'node_type' ] = node_type
266
+ end
267
+ runner . converge_dsl do
268
+ efs 'mount' do
269
+ efs_fs_id_array %w( id_1 id_2 id_3 )
270
+ shared_dir_array %w( shared_dir_1 /shared_dir_2 /shared_dir_3 )
271
+ efs_encryption_in_transit_array %w( true true not_true )
272
+ efs_iam_authorization_array %w( not_true true true )
273
+ action :mount
274
+ end
272
275
end
273
276
end
274
- end
275
277
276
- before do
277
- stub_command ( "mount | grep ' /shared_dir_1 '" ) . and_return ( false )
278
- stub_command ( "mount | grep ' /shared_dir_2 '" ) . and_return ( true )
279
- stub_command ( "mount | grep ' /shared_dir_3 '" ) . and_return ( true )
280
- end
281
-
282
- it 'creates shared directory' do
283
- %w( /shared_dir_1 /shared_dir_2 /shared_dir_3 ) . each do |shared_dir |
284
- is_expected . to create_directory ( shared_dir )
285
- . with ( owner : 'root' )
286
- . with ( group : 'root' )
287
- . with ( mode : '1777' )
288
- # .with(recursive: true) # even if we set recursive a true, the test fails
278
+ before do
279
+ stub_command ( "mount | grep ' /shared_dir_1 '" ) . and_return ( false )
280
+ stub_command ( "mount | grep ' /shared_dir_2 '" ) . and_return ( true )
281
+ stub_command ( "mount | grep ' /shared_dir_3 '" ) . and_return ( true )
289
282
end
290
- end
291
283
292
- it 'mounts shared dir if not already mounted' do
293
- is_expected . to mount_mount ( '/shared_dir_1' )
294
- . with ( device : 'id_1:/' )
295
- . with ( fstype : 'efs' )
296
- . with ( dump : 0 )
297
- . with ( pass : 0 )
298
- . with ( options : %w( _netdev noresvport tls ) )
299
- . with ( retries : 10 )
300
- . with ( retry_delay : 60 )
301
- end
284
+ it 'creates shared directory' do
285
+ %w( /shared_dir_1 /shared_dir_2 /shared_dir_3 ) . each do |shared_dir |
286
+ is_expected . to create_directory ( shared_dir )
287
+ . with ( owner : 'root' )
288
+ . with ( group : 'root' )
289
+ . with ( mode : '1777' )
290
+ # .with(recursive: true) # even if we set recursive a true, the test fails
291
+ end
292
+ end
302
293
303
- it 'enables shared dir mount if already mounted' do
304
- is_expected . to enable_mount ( '/shared_dir_2' )
305
- . with ( device : 'id_2.efs.REGION.DOMAIN:/' )
306
- . with ( fstype : 'efs' )
307
- . with ( dump : 0 )
308
- . with ( pass : 0 )
309
- . with ( options : %w( _netdev noresvport tls iam ) )
310
- . with ( retries : 10 )
311
- . with ( retry_delay : 6 )
294
+ it 'mounts shared dir if not already mounted' do
295
+ is_expected . to mount_mount ( '/shared_dir_1' )
296
+ . with ( device : 'id_1:/' )
297
+ . with ( fstype : 'efs' )
298
+ . with ( dump : 0 )
299
+ . with ( pass : 0 )
300
+ . with ( options : %w( _netdev noresvport tls ) )
301
+ . with ( retries : 10 )
302
+ . with ( retry_delay : 60 )
303
+ end
312
304
313
- is_expected . to enable_mount ( '/shared_dir_3' )
314
- . with ( device : 'id_3.efs.REGION.DOMAIN:/' )
315
- . with ( fstype : 'efs' )
316
- . with ( dump : 0 )
317
- . with ( pass : 0 )
318
- . with ( options : %w( _netdev noresvport ) )
319
- . with ( retries : 10 )
320
- . with ( retry_delay : 6 )
321
- end
305
+ it 'enables shared dir mount if already mounted' do
306
+ is_expected . to enable_mount ( '/shared_dir_2' )
307
+ . with ( device : 'id_2.efs.REGION.DOMAIN:/' )
308
+ . with ( fstype : 'efs' )
309
+ . with ( dump : 0 )
310
+ . with ( pass : 0 )
311
+ . with ( options : %w( _netdev noresvport tls iam ) )
312
+ . with ( retries : 10 )
313
+ . with ( retry_delay : 6 )
314
+
315
+ is_expected . to enable_mount ( '/shared_dir_3' )
316
+ . with ( device : 'id_3.efs.REGION.DOMAIN:/' )
317
+ . with ( fstype : 'efs' )
318
+ . with ( dump : 0 )
319
+ . with ( pass : 0 )
320
+ . with ( options : %w( _netdev noresvport ) )
321
+ . with ( retries : 10 )
322
+ . with ( retry_delay : 6 )
323
+ end
322
324
323
- it 'changes permissions' do
324
- %w( /shared_dir_1 /shared_dir_2 /shared_dir_3 ) . each do |shared_dir |
325
- is_expected . to create_directory ( "change permissions for #{ shared_dir } " )
326
- . with ( path : shared_dir )
327
- . with ( owner : 'root' )
328
- . with ( group : 'root' )
329
- . with ( mode : '1777' )
325
+ if node_type == "HeadNode"
326
+ it 'changes permissions' do
327
+ %w( /shared_dir_1 /shared_dir_2 /shared_dir_3 ) . each do |shared_dir |
328
+ is_expected . to create_directory ( "change permissions for #{ shared_dir } " )
329
+ . with ( path : shared_dir )
330
+ . with ( owner : 'root' )
331
+ . with ( group : 'root' )
332
+ . with ( mode : '1777' )
333
+ end
334
+ end
330
335
end
331
336
end
332
337
end
0 commit comments