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

Add tests to actions #1525

Merged
merged 6 commits into from
Feb 14, 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
38 changes: 38 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test IM

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4

- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: python -m pip install -r requirements-tests.txt

- name: Check code style
run: pycodestyle --max-line-length=120 --ignore=E402,W504,W605,E722 . --exclude=doc

- name: Test with nose
#run: nosetests test/unit/connectors/*.py test/unit/*.py test/functional/*.py -v --stop --with-xunit --with-coverage --cover-erase --cover-xml --cover-package=IM,contextualization
run: python -m coverage run --source=. -m unittest discover -s test/unit -p '*.py'

- name: Generate XML coverage report
run: python -m coverage xml

- name: Report coverage
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
6 changes: 3 additions & 3 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ansible >= 2.4
ansible-base
paramiko >= 1.14
PyYAML
cheroot
Expand All @@ -11,7 +12,7 @@ requests >= 2.19
scp
tosca-parser
defusedxml
urllib3>=1.23
urllib3>=1.23,<2.0
pycodestyle
suds-py3
xmltodict
Expand All @@ -31,7 +32,6 @@ pyVmomi
hvac
psutil
scar
nose
mock
coverage
requests-cache
requests-cache
2 changes: 1 addition & 1 deletion test/unit/connectors/OpenNebula.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_30_updateVMInfo(self, server_proxy):
server_proxy.return_value = one_server

success, vm = one_cloud.updateVMInfo(vm, auth)
self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.01")
self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1")
self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "158.42.1.1")

self.assertTrue(success, msg="ERROR: updating VM info.")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/connectors/files/vm_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<NIC>
<AR_ID><![CDATA[71]]></AR_ID>
<BRIDGE><![CDATA[br1]]></BRIDGE>
<IP><![CDATA[10.0.0.01]]></IP>
<IP><![CDATA[10.0.0.1]]></IP>
<MAC><![CDATA[10:00:00:00:00:01]]></MAC>
<NETWORK><![CDATA[privada]]></NETWORK>
<NETWORK_ID><![CDATA[0]]></NETWORK_ID>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/connectors/files/vm_info_off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<NIC>
<AR_ID><![CDATA[71]]></AR_ID>
<BRIDGE><![CDATA[br1]]></BRIDGE>
<IP><![CDATA[10.0.0.01]]></IP>
<IP><![CDATA[10.0.0.1]]></IP>
<MAC><![CDATA[10:00:00:00:00:01]]></MAC>
<NETWORK><![CDATA[privada]]></NETWORK>
<NETWORK_ID><![CDATA[0]]></NETWORK_ID>
Expand Down