From 0c404b17b2dede882350c6af75b7f2c7bc4b88cb Mon Sep 17 00:00:00 2001 From: Demetri Date: Mon, 17 Apr 2023 09:23:22 -0700 Subject: [PATCH] zos_copy forward port a test case for symbols on a volume (#739) * Add a test case for symbols using an existing volume on our test system Signed-off-by: ddimatos * Add changelog fragment Signed-off-by: ddimatos * 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 --------- Signed-off-by: ddimatos --- .../739-zos_copy-volume-symbol-test.yml | 5 +++ .../functional/modules/test_zos_copy_func.py | 45 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 changelogs/fragments/739-zos_copy-volume-symbol-test.yml diff --git a/changelogs/fragments/739-zos_copy-volume-symbol-test.yml b/changelogs/fragments/739-zos_copy-volume-symbol-test.yml new file mode 100644 index 000000000..b5dfad5ee --- /dev/null +++ b/changelogs/fragments/739-zos_copy-volume-symbol-test.yml @@ -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) diff --git a/tests/functional/modules/test_zos_copy_func.py b/tests/functional/modules/test_zos_copy_func.py index 3ea2e8cf4..dbe878158 100644 --- a/tests/functional/modules/test_zos_copy_func.py +++ b/tests/functional/modules/test_zos_copy_func.py @@ -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