nodeadm_sanity_test.py 18.4 KB
Newer Older
George Rojas's avatar
George Rojas committed
1
import testutils
2
3
import os
import pwd
George Rojas's avatar
George Rojas committed
4
5
6
7
8
9
# ---------------------------------------------------------------------------------
def test_nodeadm_args_1():
    """
    nodeadm test run: args_1

        Command Output:
10
        Usage: nodeadm.py [flags] [part1 part2...]"
George Rojas's avatar
George Rojas committed
11
12
        
        
George Rojas's avatar
George Rojas committed
13
14
        Command Error/Debug:No arguments or options provided
        
George Rojas's avatar
George Rojas committed
15
16
        
        
George Rojas's avatar
George Rojas committed
17
18
19
20
21
    """

    args      = ''
    exp_rs    = 256

22
23
24
25
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
26
27
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
28
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
29
30
31
32
33
34
35
36
37
38

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
39
        "Command Error:\n%s\n\n" \
40
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
41
42
43
44
45
46
47
48
49

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_args_2():
    """
    nodeadm test run: args_2

        Command Output:
50
        Usage: nodeadm.py [flags] [part1 part2...]"
George Rojas's avatar
George Rojas committed
51
52
        
        
George Rojas's avatar
George Rojas committed
53
54
        Command Error/Debug:No arguments or options provided
        
George Rojas's avatar
George Rojas committed
55
56
        
        
George Rojas's avatar
George Rojas committed
57
58
59
60
61
    """

    args      = """p1"""
    exp_rs    = 256

62
63
64
65
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
66
67
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
68
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
69
70
71
72
73
74
75
76
77
78

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
79
        "Command Error:\n%s\n\n" \
80
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
81
82
83

    assert result, errmsg

84
85
86
87
88
89
90
# ---------------------------------------------------------------------------------
def test_nodeadm_combo_1():
    """
    nodeadm test run: combo_1

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
91
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
92
93
94
95
96
        
        
    """

    args      = """--up --down p1"""
Paul Rich's avatar
Paul Rich committed
97
    exp_rs    = 0
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_combo_2():
    """
    nodeadm test run: combo_2

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
128
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
129
130
131
132
133
        
        
    """

    args      = """--up -l p1"""
Paul Rich's avatar
Paul Rich committed
134
    exp_rs    = 0
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_combo_3():
    """
    nodeadm test run: combo_3

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
165
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
166
167
168
169
        
        
    """

170
    args      = """--list_nstates --queue q1 p1"""
Paul Rich's avatar
Paul Rich committed
171
    exp_rs    = 0
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_combo_4():
    """
    nodeadm test run: combo_4

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
202
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
203
204
205
206
207
        
        
    """

    args      = """--up --queue q1 p1"""
Paul Rich's avatar
Paul Rich committed
208
    exp_rs    = 0
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_combo_5():
    """
    nodeadm test run: combo_5

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
239
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
240
241
242
243
        
        
    """

244
    args      = """--down --list_nstates p1"""
Paul Rich's avatar
Paul Rich committed
245
    exp_rs    = 0
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

George Rojas's avatar
George Rojas committed
269
270
271
272
273
274
# ---------------------------------------------------------------------------------
def test_nodeadm_up_1():
    """
    nodeadm test run: up_1

        Command Output:
George Rojas's avatar
George Rojas committed
275
        
Paul Rich's avatar
Paul Rich committed
276
277
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
George Rojas's avatar
George Rojas committed
278
        
George Rojas's avatar
George Rojas committed
279
280
281
282
283
    """

    args      = """--up p1 p2 p3"""
    exp_rs    = 0

284
285
286
287
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
288
289
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
290
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
291
292
293
294
295
296
297
298
299
300

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
301
        "Command Error:\n%s\n\n" \
302
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
303
304
305
306
307
308
309
310
311

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_up_2():
    """
    nodeadm test run: up_2

        Command Output:
George Rojas's avatar
George Rojas committed
312
        
Paul Rich's avatar
Paul Rich committed
313
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
George Rojas's avatar
George Rojas committed
314
315
        
        
George Rojas's avatar
George Rojas committed
316
317
318
319
320
    """

    args      = """--up U1 U2 U5 p1"""
    exp_rs    = 0

321
322
323
324
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
325
326
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
327
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
328
329
330
331
332
333
334
335
336
337

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
338
        "Command Error:\n%s\n\n" \
339
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
340
341
342
343
344
345
346
347
348

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_down_1():
    """
    nodeadm test run: down_1

        Command Output:
George Rojas's avatar
George Rojas committed
349
        
Paul Rich's avatar
Paul Rich committed
350
351
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
George Rojas's avatar
George Rojas committed
352
        
George Rojas's avatar
George Rojas committed
353
354
355
356
357
    """

    args      = """--down p1 p2 p3"""
    exp_rs    = 0

358
359
360
361
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
362
363
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
364
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
365
366
367
368
369
370
371
372
373
374

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
375
        "Command Error:\n%s\n\n" \
376
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
377
378
379
380
381
382
383
384
385

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_down_2():
    """
    nodeadm test run: down_2

        Command Output:
George Rojas's avatar
George Rojas committed
386
387
388
389
390
391
392
393
394
        
        Command Error/Debug:
        nodeadm.py -d --down p1 p2 p3
        
        component: "system.get_implementation", defer: False
          get_implementation(
             )
        
        
Paul Rich's avatar
Paul Rich committed
395
        nodeadm is only supported on cluster systems.  Try partlist instead.
George Rojas's avatar
George Rojas committed
396
397
        
        
George Rojas's avatar
George Rojas committed
398
399
400
401
402
    """

    args      = """-d --down p1 p2 p3"""
    exp_rs    = 0

403
404
405
406
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
407
408
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
409
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
410
411
412
413
414
415
416
417
418
419

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
420
        "Command Error:\n%s\n\n" \
421
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
422
423
424
425
426
427
428
429
430

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_down_3():
    """
    nodeadm test run: down_3

        Command Output:
George Rojas's avatar
George Rojas committed
431
        
Paul Rich's avatar
Paul Rich committed
432
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
George Rojas's avatar
George Rojas committed
433
434
        
        
George Rojas's avatar
George Rojas committed
435
436
437
438
439
    """

    args      = """--down D1 D2 D5 p1"""
    exp_rs    = 0

440
441
442
443
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
444
445
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
446
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
447
448
449
450
451
452
453
454
455
456

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
457
        "Command Error:\n%s\n\n" \
458
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
459
460
461
462
463
464
465
466
467

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_list_1():
    """
    nodeadm test run: list_1

        Command Output:
George Rojas's avatar
George Rojas committed
468
        
Paul Rich's avatar
Paul Rich committed
469
470
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
George Rojas's avatar
George Rojas committed
471
        
George Rojas's avatar
George Rojas committed
472
473
474
475
476
    """

    args      = """-l"""
    exp_rs    = 0

477
478
479
480
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
481
482
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
483
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
484
485
486
487
488
489
490
491
492
493

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
494
        "Command Error:\n%s\n\n" \
495
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
496
497
498
499
500
501
502
503
504

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_list_2():
    """
    nodeadm test run: list_2

        Command Output:
George Rojas's avatar
George Rojas committed
505
        
Paul Rich's avatar
Paul Rich committed
506
507
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
George Rojas's avatar
George Rojas committed
508
        
George Rojas's avatar
George Rojas committed
509
510
511
512
513
    """

    args      = """-l p1"""
    exp_rs    = 0

514
515
516
517
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
518
519
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
520
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
521
522
523
524
525
526
527
528
529
530

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
531
        "Command Error:\n%s\n\n" \
532
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
533
534
535

    assert result, errmsg

536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# ---------------------------------------------------------------------------------
def test_nodeadm_list_details_1():
    """
    nodeadm test run: list_details_1

        Command Output:
        Usage: nodeadm.py [flags] [part1 part2...]"
        
        
        Command Error/Debug:No arguments or options provided
        
        
        
    """

    args      = """-b"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_list_details_2():
    """
    nodeadm test run: list_details_2

        Command Output:
        
Paul Rich's avatar
Paul Rich committed
583
584
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
        
    """

    args      = """-b D1"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg

George Rojas's avatar
George Rojas committed
613
614
615
616
617
618
# ---------------------------------------------------------------------------------
def test_nodeadm_queue_1():
    """
    nodeadm test run: queue_1

        Command Output:
619
        Usage: nodeadm.py [flags] [part1 part2...]"
George Rojas's avatar
George Rojas committed
620
621
        
        
George Rojas's avatar
George Rojas committed
622
623
        Command Error/Debug:No arguments or options provided
        
George Rojas's avatar
George Rojas committed
624
625
        
        
George Rojas's avatar
George Rojas committed
626
627
628
629
630
    """

    args      = """--queue QU1"""
    exp_rs    = 256

631
632
633
634
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
635
636
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
637
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
638
639
640
641
642
643
644
645
646
647

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
648
        "Command Error:\n%s\n\n" \
649
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
650
651
652
653
654
655
656
657
658

    assert result, errmsg

# ---------------------------------------------------------------------------------
def test_nodeadm_queue_2():
    """
    nodeadm test run: queue_2

        Command Output:
George Rojas's avatar
George Rojas committed
659
        
Paul Rich's avatar
Paul Rich committed
660
661
        Command Error/Debug:nodeadm is only supported on cluster systems.  Try partlist instead.
        
George Rojas's avatar
George Rojas committed
662
        
George Rojas's avatar
George Rojas committed
663
664
665
666
667
    """

    args      = """--queue "QU1 QD1" U1 D1 P1"""
    exp_rs    = 0

668
669
670
671
    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('nodeadm.py',_args,None) 
George Rojas's avatar
George Rojas committed
672
673
    rs      = results[0]
    cmd_out = results[1]
George Rojas's avatar
George Rojas committed
674
    cmd_err = results[3]
George Rojas's avatar
George Rojas committed
675
676
677
678
679
680
681
682
683
684

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
George Rojas's avatar
George Rojas committed
685
        "Command Error:\n%s\n\n" \
686
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)
George Rojas's avatar
George Rojas committed
687
688

    assert result, errmsg