@@ -1305,17 +1305,17 @@ def job_info(opts = {})
1305
1305
it 'returns the correct accounts names' do
1306
1306
allow ( Etc ) . to receive ( :getlogin ) . and_return ( 'me' )
1307
1307
allow ( Open3 ) . to receive ( :capture3 )
1308
- . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,partition, qos' , 'where' , 'user=me' , { stdin_data : '' } )
1308
+ . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,qos' , 'where' , 'user=me' , { stdin_data : '' } )
1309
1309
. and_return ( [ File . read ( 'spec/fixtures/output/slurm/sacctmgr_show_accts.txt' ) , '' , double ( "success?" => true ) ] )
1310
1310
1311
- expect ( subject . accounts . map ( &:to_s ) . uniq ) . to eq ( expected_accounts )
1311
+ expect ( subject . accounts . map ( &:to_s ) . uniq . to_set ) . to eq ( expected_accounts . to_set )
1312
1312
end
1313
1313
1314
1314
# TODO test for qos & cluster once the API solidifies
1315
1315
it 'parses qos correctly' do
1316
1316
allow ( Etc ) . to receive ( :getlogin ) . and_return ( 'me' )
1317
1317
allow ( Open3 ) . to receive ( :capture3 )
1318
- . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,partition, qos' , 'where' , 'user=me' , { stdin_data : '' } )
1318
+ . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,qos' , 'where' , 'user=me' , { stdin_data : '' } )
1319
1319
. and_return ( [ File . read ( 'spec/fixtures/output/slurm/sacctmgr_show_accts.txt' ) , '' , double ( "success?" => true ) ] )
1320
1320
1321
1321
accts = subject . accounts
@@ -1327,22 +1327,6 @@ def job_info(opts = {})
1327
1327
expect ( acct . qos ) . to eq ( [ "#{ acct . cluster } -default" ] )
1328
1328
end
1329
1329
end
1330
-
1331
- it 'parses partition correctly' do
1332
- allow ( Etc ) . to receive ( :getlogin ) . and_return ( 'me' )
1333
- allow ( Open3 ) . to receive ( :capture3 )
1334
- . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,partition,qos' , 'where' , 'user=me' , { stdin_data : '' } )
1335
- . and_return ( [ File . read ( 'spec/fixtures/output/slurm/sacctmgr_show_accts.txt' ) , '' , double ( "success?" => true ) ] )
1336
-
1337
- accts = subject . accounts
1338
- acct_w_partitions = accts . select { |a | a . cluster == 'ascend' }
1339
- acct_w_no_partitions = accts . select { |a | a . queue . nil? }
1340
-
1341
- expect ( acct_w_partitions . size ) . to eq ( 2 )
1342
- expect ( accts - acct_w_no_partitions ) . to eq ( acct_w_partitions )
1343
- expect ( acct_w_partitions . select { |a | a . name == 'pzs0715' } . first . queue ) . to eq ( 'partition_a' )
1344
- expect ( acct_w_partitions . select { |a | a . name == 'pzs0714' } . first . queue ) . to eq ( 'partition_b' )
1345
- end
1346
1330
end
1347
1331
1348
1332
context 'when sacctmgr fails' do
@@ -1351,7 +1335,7 @@ def job_info(opts = {})
1351
1335
it 'raises the error' do
1352
1336
allow ( Etc ) . to receive ( :getlogin ) . and_return ( 'me' )
1353
1337
allow ( Open3 ) . to receive ( :capture3 )
1354
- . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,partition, qos' , 'where' , 'user=me' , { stdin_data : '' } )
1338
+ . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,qos' , 'where' , 'user=me' , { stdin_data : '' } )
1355
1339
. and_return ( [ '' , 'the error message' , double ( "success?" => false ) ] )
1356
1340
1357
1341
expect { subject . accounts } . to raise_error ( OodCore ::Job ::Adapters ::Slurm ::Batch ::Error , 'the error message' )
@@ -1365,11 +1349,11 @@ def job_info(opts = {})
1365
1349
it 'returns the correct accounts' do
1366
1350
allow ( Etc ) . to receive ( :getlogin ) . and_return ( 'me' )
1367
1351
allow ( Open3 ) . to receive ( :capture3 )
1368
- . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,partition, qos' , 'where' , 'user=me' , { stdin_data : '' } )
1352
+ . with ( { } , 'sacctmgr' , '-nP' , 'show' , 'users' , 'withassoc' , 'format=account,cluster,qos' , 'where' , 'user=me' , { stdin_data : '' } )
1369
1353
. and_return ( [ File . read ( 'spec/fixtures/output/slurm/sacctmgr_show_accts.txt' ) , '' , double ( "success?" => true ) ] )
1370
1354
1371
1355
with_modified_env ( { OOD_UPCASE_ACCOUNTS : 'true' } ) do
1372
- expect ( subject . accounts . map ( &:to_s ) . uniq ) . to eq ( expected_accounts )
1356
+ expect ( subject . accounts . map ( &:to_s ) . uniq . to_set ) . to eq ( expected_accounts . to_set )
1373
1357
end
1374
1358
end
1375
1359
end
0 commit comments