@@ -243,6 +243,9 @@ def test_backup_of_data_set(ansible_zos_module, backup_name, overwrite, recover)
243
243
recover = recover ,
244
244
)
245
245
assert_module_did_not_fail (results )
246
+ for result in results .contacted .values ():
247
+ assert result .get ("backup_name" ) == backup_name , \
248
+ f"Backup name '{ backup_name } ' not found in output"
246
249
assert_data_set_or_file_exists (hosts , backup_name )
247
250
finally :
248
251
delete_data_set_or_file (hosts , data_set_name )
@@ -282,6 +285,9 @@ def test_backup_of_data_set_when_backup_dest_exists(
282
285
)
283
286
if overwrite :
284
287
assert_module_did_not_fail (results )
288
+ for result in results .contacted .values ():
289
+ assert result .get ("backup_name" ) == backup_name , \
290
+ f"Backup name '{ backup_name } ' not found in output"
285
291
else :
286
292
assert_module_failed (results )
287
293
assert_data_set_or_file_exists (hosts , backup_name )
@@ -329,6 +335,13 @@ def test_backup_and_restore_of_data_set(
329
335
overwrite = overwrite ,
330
336
recover = recover ,
331
337
)
338
+ assert_module_did_not_fail (results )
339
+ # NEW: Assert backup_name appears in output
340
+ for result in results .contacted .values ():
341
+ assert result .get ("backup_name" ) == backup_name , \
342
+ f"Backup name '{ backup_name } ' not found in output"
343
+ # Verify backup file/dataset exists
344
+ assert_data_set_or_file_exists (hosts , backup_name )
332
345
if not overwrite :
333
346
new_hlq = "N" + get_random_q (4 )
334
347
hlqs .append (new_hlq )
@@ -341,6 +354,9 @@ def test_backup_and_restore_of_data_set(
341
354
overwrite = overwrite ,
342
355
)
343
356
assert_module_did_not_fail (results )
357
+ for result in results .contacted .values ():
358
+ assert result .get ("backup_name" ) == backup_name , \
359
+ "Backup name '{backup_name}' not found in restore output"
344
360
finally :
345
361
delete_data_set_or_file (hosts , data_set_name )
346
362
delete_data_set_or_file (hosts , backup_name )
@@ -391,6 +407,9 @@ def test_backup_and_restore_of_data_set_various_space_measurements(
391
407
args ["space_type" ] = space_type
392
408
results = hosts .all .zos_backup_restore (** args )
393
409
assert_module_did_not_fail (results )
410
+ for result in results .contacted .values ():
411
+ assert result .get ("backup_name" ) == backup_name , \
412
+ f"Backup name '{ backup_name } ' not found in backup output"
394
413
assert_data_set_or_file_exists (hosts , backup_name )
395
414
args = dict (
396
415
operation = "restore" ,
@@ -403,6 +422,9 @@ def test_backup_and_restore_of_data_set_various_space_measurements(
403
422
args ["space_type" ] = space_type
404
423
results = hosts .all .zos_backup_restore (** args )
405
424
assert_module_did_not_fail (results )
425
+ for result in results .contacted .values ():
426
+ assert result .get ("backup_name" ) == backup_name , \
427
+ f"Backup name '{ backup_name } ' not found in restore output"
406
428
finally :
407
429
delete_data_set_or_file (hosts , data_set_name )
408
430
delete_data_set_or_file (hosts , backup_name )
@@ -442,13 +464,19 @@ def test_backup_and_restore_of_data_set_when_restore_location_exists(
442
464
backup_name = backup_name ,
443
465
)
444
466
assert_module_did_not_fail (results )
467
+ for result in results .contacted .values ():
468
+ assert result .get ("backup_name" ) == backup_name , \
469
+ f"Backup name '{ backup_name } ' not found in backup output"
445
470
assert_data_set_or_file_exists (hosts , backup_name )
446
471
results = hosts .all .zos_backup_restore (
447
472
operation = "restore" ,
448
473
backup_name = backup_name ,
449
474
hlq = new_hlq ,
450
475
)
451
476
assert_module_did_not_fail (results )
477
+ for result in results .contacted .values ():
478
+ assert result .get ("backup_name" ) == backup_name , \
479
+ f"Backup name '{ backup_name } ' not found in restore output"
452
480
results = hosts .all .zos_backup_restore (
453
481
operation = "restore" ,
454
482
backup_name = backup_name ,
@@ -457,6 +485,9 @@ def test_backup_and_restore_of_data_set_when_restore_location_exists(
457
485
)
458
486
if overwrite :
459
487
assert_module_did_not_fail (results )
488
+ for result in results .contacted .values ():
489
+ assert result .get ("backup_name" ) == backup_name , \
490
+ f"Backup name '{ backup_name } ' not found in restore output"
460
491
else :
461
492
assert_module_failed (results )
462
493
finally :
@@ -490,6 +521,9 @@ def test_backup_and_restore_of_multiple_data_sets(ansible_zos_module):
490
521
backup_name = data_set_backup_location ,
491
522
)
492
523
assert_module_did_not_fail (results )
524
+ for result in results .contacted .values ():
525
+ assert result .get ("backup_name" ) == data_set_backup_location , \
526
+ f"Backup name '{ data_set_backup_location } ' not found in backup output"
493
527
assert_data_set_or_file_exists (hosts , data_set_backup_location )
494
528
results = hosts .all .zos_backup_restore (
495
529
operation = "restore" ,
@@ -499,6 +533,9 @@ def test_backup_and_restore_of_multiple_data_sets(ansible_zos_module):
499
533
hlq = new_hlq ,
500
534
)
501
535
assert_module_did_not_fail (results )
536
+ for result in results .contacted .values ():
537
+ assert result .get ("backup_name" ) == data_set_backup_location , \
538
+ f"Backup name '{ data_set_backup_location } ' not found in restore output"
502
539
finally :
503
540
delete_data_set_or_file (hosts , data_set_name )
504
541
delete_data_set_or_file (hosts , data_set_name2 )
@@ -531,6 +568,9 @@ def test_backup_and_restore_of_multiple_data_sets_by_hlq(ansible_zos_module):
531
568
backup_name = data_set_backup_location ,
532
569
)
533
570
assert_module_did_not_fail (results )
571
+ for result in results .contacted .values ():
572
+ assert result .get ("backup_name" ) == data_set_backup_location , \
573
+ f"Backup name '{ data_set_backup_location } ' not found in backup output"
534
574
assert_data_set_or_file_exists (hosts , data_set_backup_location )
535
575
results = hosts .all .zos_backup_restore (
536
576
operation = "restore" ,
@@ -540,6 +580,9 @@ def test_backup_and_restore_of_multiple_data_sets_by_hlq(ansible_zos_module):
540
580
hlq = new_hlq ,
541
581
)
542
582
assert_module_did_not_fail (results )
583
+ for result in results .contacted .values ():
584
+ assert result .get ("backup_name" ) == data_set_backup_location , \
585
+ f"Backup name '{ data_set_backup_location } ' not found in restore output"
543
586
assert_data_set_exists (hosts , data_set_backup_location )
544
587
finally :
545
588
delete_data_set_or_file (hosts , data_set_name )
@@ -574,6 +617,9 @@ def test_backup_and_restore_exclude_from_pattern(ansible_zos_module):
574
617
backup_name = data_set_backup_location ,
575
618
)
576
619
assert_module_did_not_fail (results )
620
+ for result in results .contacted .values ():
621
+ assert result .get ("backup_name" ) == data_set_backup_location , \
622
+ f"Backup name '{ data_set_backup_location } ' not found in backup output"
577
623
assert_data_set_or_file_exists (hosts , data_set_backup_location )
578
624
results = hosts .all .zos_backup_restore (
579
625
operation = "restore" ,
@@ -583,6 +629,9 @@ def test_backup_and_restore_exclude_from_pattern(ansible_zos_module):
583
629
hlq = new_hlq ,
584
630
)
585
631
assert_module_did_not_fail (results )
632
+ for result in results .contacted .values ():
633
+ assert result .get ("backup_name" ) == data_set_backup_location , \
634
+ f"Backup name '{ data_set_backup_location } ' not found in restore output"
586
635
assert_data_set_exists (hosts , data_set_backup_location )
587
636
assert_data_set_does_not_exist (hosts , data_set_restore_location2 )
588
637
finally :
@@ -706,6 +755,9 @@ def test_restore_of_data_set_when_volume_does_not_exist(ansible_zos_module):
706
755
backup_name = data_set_backup_location ,
707
756
)
708
757
assert_module_did_not_fail (results )
758
+ for result in results .contacted .values ():
759
+ assert result .get ("backup_name" ) == data_set_backup_location , \
760
+ f"Backup name '{ data_set_backup_location } ' not found in backup output"
709
761
assert_data_set_or_file_exists (hosts , data_set_backup_location )
710
762
results = hosts .all .zos_backup_restore (
711
763
operation = "restore" ,
@@ -738,12 +790,19 @@ def test_backup_and_restore_a_data_set_with_same_hlq(ansible_zos_module):
738
790
)
739
791
delete_data_set_or_file (hosts , data_set_name )
740
792
assert_module_did_not_fail (results )
793
+ for result in results .contacted .values ():
794
+ assert result .get ("backup_name" ) == data_set_backup_location , \
795
+ f"Backup name '{ data_set_backup_location } ' not found in restore output"
741
796
assert_data_set_or_file_exists (hosts , data_set_backup_location )
742
797
results = hosts .all .zos_backup_restore (
743
798
operation = "restore" ,
744
799
backup_name = data_set_backup_location ,
745
800
)
746
801
assert_module_did_not_fail (results )
802
+ for result in results .contacted .values ():
803
+ assert result .get ("backup_name" ) == data_set_backup_location , \
804
+ f"Backup name '{ data_set_backup_location } ' not found in restore output"
805
+ assert_data_set_or_file_exists (hosts , data_set_backup_location )
747
806
# Check the HLQ in the response
748
807
assert_data_set_or_file_exists (hosts , data_set_name )
749
808
finally :
@@ -858,6 +917,8 @@ def test_backup_gds(ansible_zos_module, dstype):
858
917
for result in results .contacted .values ():
859
918
assert result .get ("changed" ) is True
860
919
assert result .get ("module_stderr" ) is None
920
+ assert result .get ("backup_name" ) == backup_dest , \
921
+ f"Backup_name '{ backup_dest } ' not found in backup output"
861
922
finally :
862
923
hosts .all .shell (cmd = f"drm ANSIBLE.* " )
863
924
@@ -889,26 +950,33 @@ def test_backup_into_gds(ansible_zos_module, dstype):
889
950
for result in results .contacted .values ():
890
951
assert result .get ("changed" ) is True
891
952
assert result .get ("module_stderr" ) is None
953
+ backup_target = f"{ data_set_name } .G0002V00"
892
954
results = hosts .all .zos_backup_restore (
893
955
operation = "backup" ,
894
956
data_sets = dict (include = [ds_name ]),
895
- backup_name = f" { data_set_name } .G0002V00" ,
957
+ backup_name = backup_target ,
896
958
)
897
959
for result in results .contacted .values ():
898
960
assert result .get ("changed" ) is True
899
961
assert result .get ("module_stderr" ) is None
962
+ assert result .get ("backup_name" ) == backup_target , \
963
+ f"Expected backup_name '{ backup_target } ' not found in backup output"
900
964
escaped_ds_name = ds_name .replace ('$' , '\$' )
901
965
results = hosts .all .shell (cmd = f"drm \" { escaped_ds_name } \" " )
902
966
for result in results .contacted .values ():
903
967
assert result .get ("changed" ) is True
904
968
assert result .get ("module_stderr" ) is None
969
+ restore_source = f"{ data_set_name } (0)"
905
970
results = hosts .all .zos_backup_restore (
906
971
operation = "restore" ,
907
- backup_name = f" { data_set_name } (0)" ,
972
+ backup_name = restore_source ,
908
973
)
909
974
for result in results .contacted .values ():
910
975
assert result .get ("changed" ) is True
911
976
assert result .get ("module_stderr" ) is None
977
+ assert result .get ("backup_name" ) == restore_source , \
978
+ f"Backup_name '{ restore_source } ' not found in output"
979
+
912
980
finally :
913
981
hosts .all .shell (cmd = f"drm ANSIBLE.* ; drm OMVSADM.*" )
914
982
@@ -940,6 +1008,9 @@ def test_backup_tolerate_enqueue(ansible_zos_module):
940
1008
backup_name = data_sets_backup_location ,
941
1009
)
942
1010
assert_module_did_not_fail (results )
1011
+ for result in results .contacted .values ():
1012
+ assert result .get ("backup_name" ) == data_sets_backup_location , \
1013
+ f"Backup name '{ data_sets_backup_location } ' not found in backup output"
943
1014
assert_data_set_or_file_exists (hosts , data_sets_backup_location )
944
1015
finally :
945
1016
hosts .all .shell (cmd = "rm -rf " + temp_file )
0 commit comments