Skip to content

Commit daa4250

Browse files
committed
Merge branch 'main' into linting
2 parents 6165cb5 + 896451a commit daa4250

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

meta/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
requires_ansible: ">=2.10.7"
33
action_groups:
4-
cmci:
4+
cmci_group:
55
- cmci_action
66
- cmci_create
77
- cmci_delete

tests/integration/targets/cics_cmci/playbooks/cics_cmci_module_defaults.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
error_msg: "{{ error_msg_27 if lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' else error_msg_38 }}"
1717

1818
module_defaults:
19-
group/ibm.ibm_zos_cics.cmci:
19+
group/ibm.ibm_zos_cics.cmci_group:
2020
cmci_host: "{{ cmci_host }}"
2121
cmci_port: "{{ cmci_port }}"
2222
cmci_user: "{{ cmci_user }}"

tests/unit/helpers/cmci_helper.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,14 @@ def run(self, module, config):
123123
assert isinstance(self.expected, dict)
124124
assert isinstance(result, dict)
125125

126+
# when a list of items is expected but the order varies, this block intecepts the actual result and sorts
127+
# the list, allowing the expected and actual output to be compared in the same order
126128
if self.expected_list:
127-
# get list of items from a string in the result dict - comma separated text between 2 points in string
128129
actual_list = result.get(self.string_containing_list)[self.chars_before_list:-self.chars_after_list].split(", ")
129-
# sort alphabetically
130130
actual_list.sort()
131-
# get the text before the list in the string
132131
before_list = result.get(self.string_containing_list)[:self.chars_before_list]
133-
# get the text after the list in the string
134132
after_list = result.get(self.string_containing_list)[-self.chars_after_list:]
135-
# put the text before and after the list together with the newly ordered list
136133
concat = before_list + ", ".join(actual_list) + after_list
137-
# update the result dict to use the string with the ordered list of items
138134
result.update({self.string_containing_list: concat})
139135

140136
if self.expected != result:

tests/unit/modules/test_cmci_filters.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ def test_extra_attributes_root(cmci_module):
640640
if sys.version_info.major <= 2:
641641
extension = "pyc"
642642

643+
# Order that Ansible returns supported parameters is not consistent everytime
644+
# expect_list ensures expected and actual output are compared after sorting the
645+
# list first. This means passing tests if all expected attributes are listed, but not caring about
646+
# the order.
643647
before_list = "Unsupported parameters for (basic.%s) module: resources.complex_filter.orange. Supported parameters include: " % extension
644648
sorted_list = ["cmci_cert", "cmci_host", "cmci_key", "cmci_password",
645649
"cmci_port", "cmci_user", "context", "fail_on_nodata", "insecure",

0 commit comments

Comments
 (0)