Skip to content

Commit 72b149f

Browse files
Merge pull request #18 from dell/UT_WorkFlow_Unity
Adding Unit Test WorkFlow Unity
2 parents 8b829a7 + 00c99ea commit 72b149f

File tree

3 files changed

+50
-7
lines changed

3 files changed

+50
-7
lines changed

.github/workflows/ansible-test.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
ansible-version: [stable-2.10]
16+
ansible-version: [stable-2.12]
1717
steps:
1818
- name: Check out code
1919
uses: actions/checkout@v2
@@ -35,6 +35,46 @@ jobs:
3535
name: collection
3636
path: .cache/collection-tarballs
3737

38+
###
39+
# Unit tests (OPTIONAL)
40+
#
41+
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
42+
43+
unit:
44+
name: Unit Tests
45+
needs: [build]
46+
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
python-version: [3.8, 3.9]
51+
ansible-version: [ stable-2.11, stable-2.12, stable-2.13]
52+
53+
steps:
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v1
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install ansible (${{ matrix.ansible-version }}) version
60+
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
61+
62+
- name: Download migrated collection artifacts
63+
uses: actions/download-artifact@v1
64+
with:
65+
name: collection
66+
path: .cache/collection-tarballs
67+
68+
- name: Setup Unit test Pre-requisites
69+
run: |
70+
ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
71+
if [ -f /home/runner/.ansible/collections/ansible_collections/dellemc/unity/tests/requirements.txt ]; then pip install -r /home/runner/.ansible/collections/ansible_collections/dellemc/unity/tests/requirements.txt; fi
72+
73+
74+
- name: Run Unit tests using ansible-test
75+
run: ansible-test units -v --color --python ${{ matrix.python-version }} --coverage
76+
working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/unity
77+
3878
###
3979
# Sanity tests (REQUIRED)
4080
#
@@ -46,7 +86,7 @@ jobs:
4686
needs: [build]
4787
strategy:
4888
matrix:
49-
ansible-version: [stable-2.10, stable-2.11, stable-2.12]
89+
ansible-version: [stable-2.11, stable-2.12, stable-2.13]
5090

5191
steps:
5292
- name: Set up Python 3.9
@@ -73,4 +113,4 @@ jobs:
73113
# and all python versions ansible supports.
74114
- name: Run sanity tests
75115
run: ansible-test sanity --docker -v --color
76-
working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/unity
116+
working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/unity

tests/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pytest
2+
pytest-xdist
3+
mock
4+
pytest-mock
5+
pytest-cov
6+
coverage==4.5.4

tests/sanity/ignore-2.10.txt renamed to tests/sanity/ignore-2.13.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
plugins/modules/nfs.py compile-2.6
2-
plugins/modules/nfs.py import-2.6
31
plugins/modules/consistencygroup.py validate-modules:missing-gplv3-license
42
plugins/modules/filesystem.py validate-modules:missing-gplv3-license
53
plugins/modules/filesystem_snapshot.py validate-modules:missing-gplv3-license
@@ -14,5 +12,4 @@ plugins/modules/storagepool.py validate-modules:missing-gplv3-license
1412
plugins/modules/tree_quota.py validate-modules:missing-gplv3-license
1513
plugins/modules/user_quota.py validate-modules:missing-gplv3-license
1614
plugins/modules/volume.py validate-modules:missing-gplv3-license
17-
plugins/modules/host.py import-2.6
18-
plugins/modules/host.py import-2.7
15+
plugins/modules/host.py import-2.7

0 commit comments

Comments
 (0)