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

[v1.10.0][zos_lineinfile] Removed zos_copy dependency from test cases #1152

Merged
merged 4 commits into from
Jan 16, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trivial:
- zos_lineinfile - remove zos_copy calls from test cases.
(https://github.com/ansible-collections/ibm_zos_core/pull/1152).
34 changes: 17 additions & 17 deletions tests/functional/modules/test_zos_lineinfile_func.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) IBM Corporation 2020, 2022, 2023
# Copyright (c) IBM Corporation 2020 - 2024
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -29,14 +29,13 @@
int main(int argc, char** argv)
{
char dsname[ strlen(argv[1]) + 4];
sprintf(dsname, "//'%s'", argv[1]);
sprintf(dsname, \\\"//'%s'\\\", argv[1]);
FILE* member;
member = fopen(dsname, "rb,type=record");
member = fopen(dsname, \\\"rb,type=record\\\");
sleep(300);
fclose(member);
return 0;
}
"""
}"""

call_c_jcl="""//PDSELOCK JOB MSGCLASS=A,MSGLEVEL=(1,1),NOTIFY=&SYSUID,REGION=0M
//LOCKMEM EXEC PGM=BPXBATCH
Expand Down Expand Up @@ -893,12 +892,12 @@ def test_ds_line_force(ansible_zos_module, dstype):
for result in results.contacted.values():
assert int(result.get("stdout")) != 0
# copy/compile c program and copy jcl to hold data set lock for n seconds in background(&)
hosts.all.zos_copy(content=c_pgm, dest='/tmp/disp_shr/pdse-lock.c', force=True)
hosts.all.zos_copy(
content=call_c_jcl.format(DEFAULT_DATA_SET_NAME, MEMBER_1),
dest='/tmp/disp_shr/call_c_pgm.jcl',
force=True
)
hosts.all.shell(cmd="echo \"{0}\" > {1}".format(c_pgm, '/tmp/disp_shr/pdse-lock.c'))
hosts.all.shell(cmd="echo \"{0}\" > {1}".format(
call_c_jcl.format(
DEFAULT_DATA_SET_NAME,
MEMBER_1),
'/tmp/disp_shr/call_c_pgm.jcl'))
hosts.all.shell(cmd="xlc -o pdse-lock pdse-lock.c", chdir="/tmp/disp_shr/")
hosts.all.shell(cmd="submit call_c_pgm.jcl", chdir="/tmp/disp_shr/")
time.sleep(5)
Expand Down Expand Up @@ -946,12 +945,13 @@ def test_ds_line_force_fail(ansible_zos_module, dstype):
for result in results.contacted.values():
assert int(result.get("stdout")) != 0
# copy/compile c program and copy jcl to hold data set lock for n seconds in background(&)
hosts.all.zos_copy(content=c_pgm, dest='/tmp/disp_shr/pdse-lock.c', force=True)
hosts.all.zos_copy(
content=call_c_jcl.format(DEFAULT_DATA_SET_NAME, MEMBER_1),
dest='/tmp/disp_shr/call_c_pgm.jcl',
force=True
)
hosts.all.file(path="/tmp/disp_shr", state='directory')
hosts.all.shell(cmd="echo \"{0}\" > {1}".format(c_pgm, '/tmp/disp_shr/pdse-lock.c'))
hosts.all.shell(cmd="echo \"{0}\" > {1}".format(
call_c_jcl.format(
DEFAULT_DATA_SET_NAME,
MEMBER_1),
'/tmp/disp_shr/call_c_pgm.jcl'))
hosts.all.shell(cmd="xlc -o pdse-lock pdse-lock.c", chdir="/tmp/disp_shr/")
hosts.all.shell(cmd="submit call_c_pgm.jcl", chdir="/tmp/disp_shr/")
time.sleep(5)
Expand Down