Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zos_copy forward port a test case for symbols on a volume #739 #740

Merged
merged 3 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelogs/fragments/740-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/740)
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 @@ -1867,6 +1867,51 @@ def test_copy_pds_loadlib_member_to_pds_loadlib_member(ansible_zos_module,):
hosts.all.zos_data_set(name=cobol_pds, 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