Skip to content

Commit 4f6b373

Browse files
committed
Add some solution
1 parent ccff1e4 commit 4f6b373

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/functional/modules/test_zos_volume_init_func.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from ibm_zos_core.tests.helpers.dataset import (
2020
get_random_q,
2121
)
22+
from ibm_zos_core.tests.helpers.volumes import (
23+
create_vvds_on_volume,
24+
)
2225
# TEST_VOL_ADDR = '0903'
2326
# TEST_VOL_SER = 'KET999'
2427
TEST_VOL_ADDR = '01A2'
@@ -27,6 +30,13 @@
2730
INDEX_CREATION_SUCCESS_MSG = 'VTOC INDEX CREATION SUCCESSFUL'
2831
VTOC_LOC_MSG = "ICK01314I VTOC IS LOCATED AT CCHH=X'0000 0001' AND IS {:4d} TRACKS."
2932

33+
def clear_volume(hosts, volume):
34+
datasets_in_volume = hosts.all.shell(cmd="vtocls {0}".format(volume))
35+
for dataset in datasets_in_volume.contacted.values():
36+
datasets = str(dataset.get("stdout")).split("\n")
37+
for dataset in datasets:
38+
dataset_t_del = dataset.split(' ', 1)[0]
39+
hosts.all.shell(cmd="""drm "{0}" """.format(dataset_t_del))
3040

3141
# Guard Rail to prevent unintentional initialization of targeted volume.
3242
# If this test fails, either reset target volume serial to match
@@ -35,9 +45,8 @@
3545

3646
def test_guard_rail_and_setup(ansible_zos_module):
3747
hosts = ansible_zos_module
38-
hlq = get_random_q()
3948
# remove all data sets from target volume. Expected to be the following 3
40-
hosts.all.zos_data_set(name="*", volumes=TEST_VOL_ADDR, state="absent")
49+
clear_volume(hosts, TEST_VOL_SER)
4150

4251
params = {
4352
"address":TEST_VOL_ADDR,

0 commit comments

Comments
 (0)