Skip to content

Commit d6c5221

Browse files
authored
Hardcode back volume values in zos_volume_init test cases (#1945)
* adding hardcoded volumes * only adding hardcoded volumes * removing debug print statements * changelog addition
1 parent a58ddce commit d6c5221

File tree

2 files changed

+61
-70
lines changed

2 files changed

+61
-70
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
trivial:
2+
- tests/functional/modules/test_zos_volume_init_func.py- The script now has hardcoded required volumes,
3+
allowing these parameters to be ignored in the pipeline and execution.
4+
(https://github.com/ansible-collections/ibm_zos_core/pull/1945).

tests/functional/modules/test_zos_volume_init_func.py

Lines changed: 57 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright (c) IBM Corporation 2023, 2024
3+
# Copyright (c) IBM Corporation 2023, 2025
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
@@ -16,6 +16,8 @@
1616

1717
__metaclass__ = type
1818

19+
TEST_VOL_ADDR = '01A2'
20+
TEST_VOL_SER = 'USER02'
1921
from ibm_zos_core.tests.helpers.volumes import Volume_Handler
2022
from ibm_zos_core.tests.helpers.dataset import get_tmp_ds_name
2123

@@ -39,12 +41,13 @@ def clear_volume(hosts, volume):
3941
# verify_volid below or change value to match current volume serial on
4042
# target.
4143

42-
def test_guard_rail_and_setup(ansible_zos_module, volumes_on_systems):
44+
def test_guard_rail_and_setup(ansible_zos_module):
4345
hosts = ansible_zos_module
4446
# remove all data sets from target volume. Expected to be the following 3
45-
volumes = Volume_Handler(volumes_on_systems)
46-
volume_1 = volumes.get_available_vol()
47-
volume_2 = volumes.get_available_vol()
47+
48+
volume_1 = TEST_VOL_SER
49+
volume_2 = TEST_VOL_ADDR
50+
4851
clear_volume(hosts, volume_1)
4952

5053
params = {
@@ -72,12 +75,11 @@ def test_guard_rail_and_setup(ansible_zos_module, volumes_on_systems):
7275
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
7376

7477

75-
def test_index_param_index(ansible_zos_module, volumes_on_systems):
78+
def test_index_param_index(ansible_zos_module):
7679
hosts = ansible_zos_module
7780

78-
volumes = Volume_Handler(volumes_on_systems)
79-
volume_1 = volumes.get_available_vol()
80-
volume_2 = volumes.get_available_vol()
81+
volume_1 = TEST_VOL_SER
82+
volume_2 = TEST_VOL_ADDR
8183

8284
# take volume offline
8385
hosts.all.zos_operator(cmd=f"vary {volume_2},offline")
@@ -104,12 +106,11 @@ def test_index_param_index(ansible_zos_module, volumes_on_systems):
104106
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
105107

106108

107-
def test_index_param_index_sms_false(ansible_zos_module, volumes_on_systems):
109+
def test_index_param_index_sms_false(ansible_zos_module):
108110
hosts = ansible_zos_module
109111

110-
volumes = Volume_Handler(volumes_on_systems)
111-
volume_1 = volumes.get_available_vol()
112-
volume_2 = volumes.get_available_vol()
112+
volume_1 = TEST_VOL_SER
113+
volume_2 = TEST_VOL_ADDR
113114

114115
# take volume offline
115116
hosts.all.zos_operator(cmd=f"vary {volume_2},offline")
@@ -138,12 +139,11 @@ def test_index_param_index_sms_false(ansible_zos_module, volumes_on_systems):
138139

139140

140141
# check that correct volume_addr is assigned to correct volid
141-
def test_volid_address_assigned_correctly(ansible_zos_module, volumes_on_systems):
142+
def test_volid_address_assigned_correctly(ansible_zos_module):
142143
hosts = ansible_zos_module
143144

144-
volumes = Volume_Handler(volumes_on_systems)
145-
volume_1 = volumes.get_available_vol()
146-
volume_2 = volumes.get_available_vol()
145+
volume_1 = TEST_VOL_SER
146+
volume_2 = TEST_VOL_ADDR
147147

148148
params = {
149149
'address': volume_2,
@@ -185,12 +185,12 @@ def test_volid_address_assigned_correctly(ansible_zos_module, volumes_on_systems
185185

186186
assert volume_1 in display_cmd_output
187187

188-
def test_no_index_sms_managed_mutually_exclusive(ansible_zos_module, volumes_on_systems):
188+
def test_no_index_sms_managed_mutually_exclusive(ansible_zos_module):
189189
hosts = ansible_zos_module
190190

191-
volumes = Volume_Handler(volumes_on_systems)
192-
volume_1 = volumes.get_available_vol()
193-
volume_2 = volumes.get_available_vol()
191+
volume_1 = TEST_VOL_SER
192+
volume_2 = TEST_VOL_ADDR
193+
194194

195195
params = {
196196
'address': volume_2,
@@ -212,12 +212,11 @@ def test_no_index_sms_managed_mutually_exclusive(ansible_zos_module, volumes_on_
212212
assert "'Index' cannot be False" in result.get("msg")
213213

214214

215-
def test_vtoc_size_parm(ansible_zos_module, volumes_on_systems):
215+
def test_vtoc_size_parm(ansible_zos_module):
216216
hosts = ansible_zos_module
217217

218-
volumes = Volume_Handler(volumes_on_systems)
219-
volume_1 = volumes.get_available_vol()
220-
volume_2 = volumes.get_available_vol()
218+
volume_1 = TEST_VOL_SER
219+
volume_2 = TEST_VOL_ADDR
221220
params = {
222221
'address': volume_2,
223222
'verify_offline': False,
@@ -240,12 +239,11 @@ def test_vtoc_size_parm(ansible_zos_module, volumes_on_systems):
240239
assert VTOC_LOC_MSG.format(params.get('vtoc_size')) in content_str
241240

242241

243-
def test_good_param_values_only_volid(ansible_zos_module, volumes_on_systems):
242+
def test_good_param_values_only_volid(ansible_zos_module):
244243
hosts = ansible_zos_module
245244

246-
volumes = Volume_Handler(volumes_on_systems)
247-
volume_1 = volumes.get_available_vol()
248-
volume_2 = volumes.get_available_vol()
245+
volume_1 = TEST_VOL_SER
246+
volume_2 = TEST_VOL_ADDR
249247

250248
params = {
251249
'address': volume_2,
@@ -265,12 +263,11 @@ def test_good_param_values_only_volid(ansible_zos_module, volumes_on_systems):
265263
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
266264

267265

268-
def test_good_param_values_volid_n_verify_volid(ansible_zos_module, volumes_on_systems):
266+
def test_good_param_values_volid_n_verify_volid(ansible_zos_module):
269267
hosts = ansible_zos_module
270268

271-
volumes = Volume_Handler(volumes_on_systems)
272-
volume_1 = volumes.get_available_vol()
273-
volume_2 = volumes.get_available_vol()
269+
volume_1 = TEST_VOL_SER
270+
volume_2 = TEST_VOL_ADDR
274271

275272
params = {
276273
'address': volume_2,
@@ -291,12 +288,11 @@ def test_good_param_values_volid_n_verify_volid(ansible_zos_module, volumes_on_s
291288
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
292289

293290

294-
def test_good_param_values_volid_n_verify_volume_empty(ansible_zos_module, volumes_on_systems):
291+
def test_good_param_values_volid_n_verify_volume_empty(ansible_zos_module):
295292
hosts = ansible_zos_module
296293

297-
volumes = Volume_Handler(volumes_on_systems)
298-
volume_1 = volumes.get_available_vol()
299-
volume_2 = volumes.get_available_vol()
294+
volume_1 = TEST_VOL_SER
295+
volume_2 = TEST_VOL_ADDR
300296

301297
params = {
302298
'address': volume_2,
@@ -317,13 +313,12 @@ def test_good_param_values_volid_n_verify_volume_empty(ansible_zos_module, volum
317313
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
318314

319315

320-
def test_bad_param_values_address_not_hexadecimal(ansible_zos_module, volumes_on_systems):
316+
def test_bad_param_values_address_not_hexadecimal(ansible_zos_module):
321317
hosts = ansible_zos_module
322318

323319
expected_rc = 12
324-
volumes = Volume_Handler(volumes_on_systems)
325-
volume_1 = volumes.get_available_vol()
326-
volume_2 = volumes.get_available_vol()
320+
volume_1 = TEST_VOL_SER
321+
volume_2 = TEST_VOL_ADDR
327322

328323
params = {
329324
"address": 'XYZ',
@@ -345,13 +340,12 @@ def test_bad_param_values_address_not_hexadecimal(ansible_zos_module, volumes_on
345340
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
346341

347342

348-
def test_bad_param_values_address_length_too_short(ansible_zos_module, volumes_on_systems):
343+
def test_bad_param_values_address_length_too_short(ansible_zos_module):
349344
hosts = ansible_zos_module
350345

351346
expected_rc = 12
352-
volumes = Volume_Handler(volumes_on_systems)
353-
volume_1 = volumes.get_available_vol()
354-
volume_2 = volumes.get_available_vol()
347+
volume_1 = TEST_VOL_SER
348+
volume_2 = TEST_VOL_ADDR
355349

356350
params = {
357351
"address": '01',
@@ -373,14 +367,12 @@ def test_bad_param_values_address_length_too_short(ansible_zos_module, volumes_o
373367
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
374368

375369

376-
def test_bad_param_values_address_specified_is_not_accesible_to_current(ansible_zos_module, volumes_on_systems):
370+
def test_bad_param_values_address_specified_is_not_accesible_to_current(ansible_zos_module):
377371
hosts = ansible_zos_module
378372

379373
expected_rc = 12
380-
volumes = Volume_Handler(volumes_on_systems)
381-
volume_1 = volumes.get_available_vol()
382-
volume_2 = volumes.get_available_vol()
383-
374+
volume_1 = TEST_VOL_SER
375+
volume_2 = TEST_VOL_ADDR
384376
params = {
385377
"address": '0000',
386378
"verify_offline": False,
@@ -401,13 +393,12 @@ def test_bad_param_values_address_specified_is_not_accesible_to_current(ansible_
401393
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
402394

403395

404-
def test_bad_param_values_negative_value_for_vtoc_size(ansible_zos_module, volumes_on_systems):
396+
def test_bad_param_values_negative_value_for_vtoc_size(ansible_zos_module):
405397
hosts = ansible_zos_module
406398

407399
expected_rc = 12
408-
volumes = Volume_Handler(volumes_on_systems)
409-
volume_1 = volumes.get_available_vol()
410-
volume_2 = volumes.get_available_vol()
400+
volume_1 = TEST_VOL_SER
401+
volume_2 = TEST_VOL_ADDR
411402

412403
params = {
413404
"address": volume_2,
@@ -430,13 +421,12 @@ def test_bad_param_values_negative_value_for_vtoc_size(ansible_zos_module, volum
430421
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
431422

432423

433-
def test_bad_param_incorrect_existing_volid(ansible_zos_module, volumes_on_systems):
424+
def test_bad_param_incorrect_existing_volid(ansible_zos_module):
434425
hosts = ansible_zos_module
435426

436427
expected_rc = 12
437-
volumes = Volume_Handler(volumes_on_systems)
438-
volume_1 = volumes.get_available_vol()
439-
volume_2 = volumes.get_available_vol()
428+
volume_1 = TEST_VOL_SER
429+
volume_2 = TEST_VOL_ADDR
440430

441431
params = {
442432
"address": volume_2,
@@ -459,13 +449,12 @@ def test_bad_param_incorrect_existing_volid(ansible_zos_module, volumes_on_syste
459449
hosts.all.zos_operator(cmd=f"vary {volume_2},online")
460450

461451

462-
def test_bad_param_volid_value_too_long(ansible_zos_module, volumes_on_systems):
452+
def test_bad_param_volid_value_too_long(ansible_zos_module):
463453
hosts = ansible_zos_module
464454

465455
expected_rc = 12
466-
volumes = Volume_Handler(volumes_on_systems)
467-
volume_1 = volumes.get_available_vol()
468-
volume_2 = volumes.get_available_vol()
456+
volume_1 = TEST_VOL_SER
457+
volume_2 = TEST_VOL_ADDR
469458

470459
params = {
471460
"address": 'ABCDEFGHIJK',
@@ -495,13 +484,12 @@ def test_bad_param_volid_value_too_long(ansible_zos_module, volumes_on_systems):
495484
# If there is a data set remaining on the volume, that would interfere
496485
# with other tests!
497486

498-
def test_no_existing_data_sets_check(ansible_zos_module, volumes_on_systems):
487+
def test_no_existing_data_sets_check(ansible_zos_module):
499488
hosts = ansible_zos_module
500489
dataset = get_tmp_ds_name()
501490

502-
volumes = Volume_Handler(volumes_on_systems)
503-
volume_1 = volumes.get_available_vol()
504-
volume_2 = volumes.get_available_vol()
491+
volume_1 = TEST_VOL_SER
492+
volume_2 = TEST_VOL_ADDR
505493

506494
setup_params = {
507495
'address': volume_2,
@@ -555,12 +543,11 @@ def test_no_existing_data_sets_check(ansible_zos_module, volumes_on_systems):
555543
# Therefore, while testing against the EC machines, the verify_offline
556544
# check needs to be skipped in order for ickdsf to be invoked.
557545

558-
def test_minimal_params(ansible_zos_module, volumes_on_systems):
546+
def test_minimal_params(ansible_zos_module):
559547
hosts = ansible_zos_module
560548

561-
volumes = Volume_Handler(volumes_on_systems)
562-
volume_1 = volumes.get_available_vol()
563-
volume_2 = volumes.get_available_vol()
549+
volume_1 = TEST_VOL_SER
550+
volume_2 = TEST_VOL_ADDR
564551

565552
params = {
566553
"address":volume_2,

0 commit comments

Comments
 (0)