Skip to content

Commit

Permalink
zos_copy forward port a test case for symbols on a volume (#739)
Browse files Browse the repository at this point in the history
* Add a test case for symbols using an existing volume on our test system

Signed-off-by: ddimatos <[email protected]>

* Add changelog fragment

Signed-off-by: ddimatos <[email protected]>

* Update 739-zos_copy-volume-symbol-test.yml

Update description to use symbols overs special chars.

* Update test case with added comments

Signed-off-by: ddimatos <[email protected]>

---------

Signed-off-by: ddimatos <[email protected]>
  • Loading branch information
ddimatos authored Apr 17, 2023
1 parent 787d3df commit 0c404b1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/739-zos_copy-volume-symbol-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trivial:
- zos_copy - prior, there was no test case for symbols on a volume.
This change adds a test case to test a volume which has in it symbols,
issue 738.
(https://github.com/ansible-collections/ibm_zos_core/pull/739)
45 changes: 45 additions & 0 deletions tests/functional/modules/test_zos_copy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,51 @@ def test_copy_pds_to_existing_pds(ansible_zos_module, args):
hosts.all.zos_data_set(name=dest, state="absent")


@pytest.mark.pdse
def test_copy_pds_member_with_system_symbol(ansible_zos_module,):
"""This test is for bug #543 in GitHub. In some versions of ZOAU,
datasets.listing can't handle system symbols in volume names and
therefore fails to get details from a dataset.
Note: `listcat ent('SYS1.SAMPLIB') all` will display 'volser = ******'
and `D SYMBOLS` will show you that `&SYSR2. = "RES80A"` where
the symbols for this volume correspond to volume `RES80A`
"""
hosts = ansible_zos_module
# The volume for this dataset should use a system symbol.
# This dataset and member should be available on any z/OS system.
src = "SYS1.SAMPLIB(IZUPRM00)"
dest = "USER.TEST.PDS.DEST"

try:
hosts.all.zos_data_set(
name=dest,
state="present",
type="pdse",
replace=True
)

copy_res = hosts.all.zos_copy(src=src, dest=dest, remote_src=True)
verify_copy = hosts.all.shell(
cmd="mls {0}".format(dest),
executable=SHELL_EXECUTABLE
)

for result in copy_res.contacted.values():
assert result.get("msg") is None
assert result.get("changed") is True
assert result.get("dest") == dest

for v_cp in verify_copy.contacted.values():
assert v_cp.get("rc") == 0
stdout = v_cp.get("stdout")
assert stdout is not None
assert len(stdout.splitlines()) == 1

finally:
hosts.all.zos_data_set(name=dest, state="absent")


@pytest.mark.pdse
def test_copy_multiple_data_set_members(ansible_zos_module):
hosts = ansible_zos_module
Expand Down

0 comments on commit 0c404b1

Please sign in to comment.