Skip to content

Commit 01b58b0

Browse files
authored
add new tests (#22)
* test * add ignore, change py version * fix test * add changelog, fix before assignment * fix pyrfc before assignment * change ignore file 2.15
1 parent 02a425c commit 01b58b0

File tree

10 files changed

+44
-25
lines changed

10 files changed

+44
-25
lines changed

.github/workflows/ansible-test.yml

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ jobs:
2222
- stable-2.11
2323
- stable-2.12
2424
- stable-2.13
25-
runs-on: ubuntu-latest
25+
- stable-2.14
26+
- devel
27+
28+
runs-on: >-
29+
${{ contains(fromJson(
30+
'["stable-2.9", "stable-2.10", "stable-2.11", "stable-2.12", "stable-2.13", "stable-2.14"]'
31+
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
2632
steps:
2733

2834
- name: Check out code
@@ -36,37 +42,23 @@ jobs:
3642

3743

3844
units:
39-
runs-on: ubuntu-latest
45+
runs-on: >-
46+
${{ contains(fromJson(
47+
'["stable-2.9", "stable-2.10", "stable-2.11", "stable-2.12", "stable-2.13", "stable-2.14"]'
48+
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
4049
name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
4150
strategy:
4251
# As soon as the first unit test fails, cancel the others to free up the CI queue
4352
fail-fast: true
4453
matrix:
4554
ansible:
46-
- stable-2.9 # Only if your collection supports Ansible 2.9
55+
- stable-2.9
4756
- stable-2.10
4857
- stable-2.11
4958
- stable-2.12
5059
- stable-2.13
51-
python:
52-
- 2.6
53-
- 2.7
54-
- 3.5
55-
- 3.6
56-
- 3.7
57-
- 3.8
58-
- 3.9
59-
exclude:
60-
# Because ansible-test doesn't support python3.9 for Ansible 2.9
61-
- ansible: stable-2.9
62-
python: 3.9
63-
- ansible: stable-2.13
64-
python: 2.6
65-
include:
66-
# Test Devel on Python 3.10 only
67-
- ansible: devel
68-
python: '3.10'
69-
60+
- stable-2.14
61+
- devel
7062

7163
steps:
7264
- name: Check out code
@@ -76,8 +68,6 @@ jobs:
7668
uses: ansible-community/ansible-test-gh-action@release/v1
7769
with:
7870
ansible-core-version: ${{ matrix.ansible }}
79-
target-python-version: ${{ matrix.python }}
80-
python-version: '3.10'
8171
testing-type: units
8272
test-deps: >-
8373
ansible.netcommon
@@ -129,4 +119,4 @@ jobs:
129119
# testing-type: integration
130120
# test-deps: >-
131121
# ansible.netcommon
132-
# ansible.utils
122+
# ansible.utils
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bugfixes:
3+
- modules - fix a "variable used before assignment" that cannot be reached but causes sanity test failures.

plugins/modules/sap_company.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
HAS_PYRFC_LIBRARY = False
200200
ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc()
201201
else:
202+
ANOTHER_LIBRARY_IMPORT_ERROR = None
202203
HAS_PYRFC_LIBRARY = True
203204

204205

plugins/modules/sap_control_exec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
HAS_SUDS_LIBRARY = False
268268
SUDS_LIBRARY_IMPORT_ERROR = traceback.format_exc()
269269
else:
270+
SUDS_LIBRARY_IMPORT_ERROR = None
270271
HAS_SUDS_LIBRARY = True
271272

272273

plugins/modules/sap_pyrfc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
HAS_PYRFC_LIBRARY = False
119119
PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc()
120120
else:
121+
PYRFC_LIBRARY_IMPORT_ERROR = None
121122
HAS_PYRFC_LIBRARY = True
122123

123124

@@ -162,6 +163,7 @@ def main():
162163
try:
163164
conn = get_connection(module, conn_params)
164165
result = conn.call(function, **func_params)
166+
error_msg = None
165167
except CommunicationError as err:
166168
msg = "Could not connect to server"
167169
error_msg = err.message

plugins/modules/sap_snote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
HAS_PYRFC_LIBRARY = False
148148
ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc()
149149
else:
150+
ANOTHER_LIBRARY_IMPORT_ERROR = None
150151
HAS_PYRFC_LIBRARY = True
151152

152153

plugins/modules/sap_task_list_execute.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,15 @@
193193
HAS_PYRFC_LIBRARY = False
194194
PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc()
195195
else:
196+
PYRFC_LIBRARY_IMPORT_ERROR = None
196197
HAS_PYRFC_LIBRARY = True
197198
try:
198199
import xmltodict
199200
except ImportError:
200201
HAS_XMLTODICT_LIBRARY = False
201202
XMLTODICT_LIBRARY_IMPORT_ERROR = traceback.format_exc()
202203
else:
204+
XMLTODICT_LIBRARY_IMPORT_ERROR = None
203205
HAS_XMLTODICT_LIBRARY = True
204206

205207

plugins/modules/sap_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@
246246
HAS_PYRFC_LIBRARY = False
247247
PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc()
248248
else:
249+
PYRFC_LIBRARY_IMPORT_ERROR = None
249250
HAS_PYRFC_LIBRARY = True
250251

251252

tests/sanity/ignore-2.14.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
2+
plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
3+
plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
4+
plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
5+
plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
6+
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
7+
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
8+
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

tests/sanity/ignore-2.15.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
2+
plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
3+
plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
4+
plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
5+
plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
6+
plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
7+
plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
8+
plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0
9+
plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0

0 commit comments

Comments
 (0)