Skip to content

Commit

Permalink
Merge branch 'infobloxopen:master' into DTC-Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
JchhatbarInfoblox authored Dec 4, 2023
2 parents dd54488 + e26d3e0 commit 99cd190
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
ansible-version: [stable-2.13, stable-2.14, stable-2.15, devel]
ansible-version: [stable-2.13, stable-2.14, stable-2.15, stable-2.16, devel]
exclude:
- ansible-version: devel
python-version: '3.8'
- ansible-version: devel
python-version: '3.9'
- ansible-version: stable-2.16
python-version: '3.8'
- ansible-version: stable-2.16
python-version: '3.9'
- ansible-version: stable-2.15
python-version: '3.8'
- ansible-version: stable-2.14
Expand All @@ -80,8 +84,8 @@ jobs:
- name: Setup Unit test Pre-requisites
run: |
ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
git clone https://github.com/ansible/ansible.git
cp -rf ansible/test/units/compat /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/
git clone https://github.com/ansible/ansible.git -b ${{ matrix.ansible-version }}
if [ "${{ matrix.ansible-version }}" != "devel" ]; then cp -rf ansible/test/units/compat /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/; fi
cp -rf ansible/test/units/modules/utils.py /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/plugins/modules/
sed -i 's/units/ansible_collections.infoblox.nios_modules.tests.unit/' /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/plugins/modules/utils.py
if [ -f /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/requirements.txt ]; then pip install -r /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/tests/unit/requirements.txt; fi
Expand All @@ -91,7 +95,13 @@ jobs:

- name: Generate coverage report
run: |
if [ "${{ matrix.ansible-version }}" == "stable-2.13" ]; then pip install coverage==4.5.4; fi
if [ "${{ matrix.ansible-version }}" == "stable-2.13" ]; then
pip install coverage==4.5.4;
elif [ "${{ matrix.ansible-version }}" == "stable-2.14" ]; then
pip install coverage==6.5.0;
elif [ "${{ matrix.ansible-version }}" == "stable-2.15" ]; then
pip install coverage==6.5.0;
fi
ansible-test coverage xml -v --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/

Expand All @@ -109,12 +119,16 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
ansible-version: [stable-2.13, stable-2.14, stable-2.15, devel]
ansible-version: [stable-2.13, stable-2.14, stable-2.15, stable-2.16, devel]
exclude:
- ansible-version: devel
python-version: '3.8'
- ansible-version: devel
python-version: '3.9'
- ansible-version: stable-2.16
python-version: '3.8'
- ansible-version: stable-2.16
python-version: '3.9'
- ansible-version: stable-2.15
python-version: '3.8'
- ansible-version: stable-2.14
Expand Down Expand Up @@ -153,7 +167,7 @@ jobs:
echo $ANSIBLE_NIOSSIM_CONTAINER
ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python-version }} --docker --coverage
env:
ANSIBLE_NIOSSIM_CONTAINER: quay.io/ansible/nios-test-container:2.0.0
ANSIBLE_NIOSSIM_CONTAINER: quay.io/ansible/nios-test-container:3.0.0
working-directory: /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/

# ansible-test support producing code coverage date
Expand All @@ -178,7 +192,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ansible-version: [stable-2.13, stable-2.14, stable-2.15, devel]
ansible-version: [stable-2.13, stable-2.14, stable-2.15, stable-2.16, devel]

steps:
- name: Set up Python 3.10
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/plugins/module_utils/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
__metaclass__ = type

import copy

from ansible_collections.infoblox.nios_modules.tests.unit.compat import unittest
try:
from ansible_collections.infoblox.nios_modules.tests.unit.compat import unittest
except ImportError:
import unittest
from ansible_collections.infoblox.nios_modules.tests.unit.compat.mock import patch, MagicMock, Mock
from ansible_collections.infoblox.nios_modules.plugins.module_utils import api

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/plugins/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
__metaclass__ = type

import json

from ansible_collections.community.general.tests.unit.compat import unittest
try:
from ansible_collections.community.general.tests.unit.compat import unittest
except ImportError:
import unittest
from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils.common.text.converters import to_bytes
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pytest-xdist
mock
pytest-mock
pytest-cov
coverage==6.5.0
coverage

0 comments on commit 99cd190

Please sign in to comment.