Github workflow
This commit is contained in:
parent
385881ac04
commit
efe4e040ad
27
charms/ovn-central-k8s/.github/workflows/tox.yaml
vendored
Normal file
27
charms/ovn-central-k8s/.github/workflows/tox.yaml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Python package
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.8, 3.9]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install tox tox-gh-actions
|
||||||
|
- name: Lint with tox
|
||||||
|
run: tox -e pep8
|
||||||
|
- name: Test with tox
|
||||||
|
run: tox -e py${{ matrix.python-version }}
|
@ -1,33 +0,0 @@
|
|||||||
# Copyright 2022 liam
|
|
||||||
# See LICENSE file for licensing details.
|
|
||||||
#
|
|
||||||
# Learn more about testing at: https://juju.is/docs/sdk/testing
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
from unittest.mock import Mock
|
|
||||||
|
|
||||||
from charm import SunbeamOvnCentralOperatorCharm
|
|
||||||
from ops.testing import Harness
|
|
||||||
|
|
||||||
|
|
||||||
class TestCharm(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.harness = Harness(SunbeamOvnCentralOperatorCharm)
|
|
||||||
self.addCleanup(self.harness.cleanup)
|
|
||||||
self.harness.begin()
|
|
||||||
|
|
||||||
def test_config_changed(self):
|
|
||||||
self.assertEqual(list(self.harness.charm._stored.things), [])
|
|
||||||
self.harness.update_config({"thing": "foo"})
|
|
||||||
self.assertEqual(list(self.harness.charm._stored.things), ["foo"])
|
|
||||||
|
|
||||||
def test_action(self):
|
|
||||||
# the harness doesn't (yet!) help much with actions themselves
|
|
||||||
action_event = Mock(params={"fail": ""})
|
|
||||||
self.harness.charm._on_fortune_action(action_event)
|
|
||||||
|
|
||||||
self.assertTrue(action_event.set_results.called)
|
|
||||||
|
|
||||||
def test_action_fail(self):
|
|
||||||
action_event = Mock(params={"fail": "fail this"})
|
|
||||||
self.harness.charm._on_fortune_action(action_event)
|
|
@ -35,26 +35,16 @@ whitelist_externals =
|
|||||||
passenv = HOME TERM CS_* OS_* TEST_*
|
passenv = HOME TERM CS_* OS_* TEST_*
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:py35]
|
[testenv:py3.8]
|
||||||
basepython = python3.5
|
|
||||||
# python3.5 is irrelevant on a focal+ charm.
|
|
||||||
commands = /bin/true
|
|
||||||
|
|
||||||
[testenv:py36]
|
|
||||||
basepython = python3.6
|
|
||||||
deps = -r{toxinidir}/requirements.txt
|
|
||||||
-r{toxinidir}/test-requirements.txt
|
|
||||||
|
|
||||||
[testenv:py37]
|
|
||||||
basepython = python3.7
|
|
||||||
deps = -r{toxinidir}/requirements.txt
|
|
||||||
-r{toxinidir}/test-requirements.txt
|
|
||||||
|
|
||||||
[testenv:py38]
|
|
||||||
basepython = python3.8
|
basepython = python3.8
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
|
[testenv:py3.9]
|
||||||
|
basepython = python3.9
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:py3]
|
[testenv:py3]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user