Major improvement in OSM charms
- Adapt all new operator charms to use the same pattern. They are all
using now this library that encapsulates the common logic for all
charms: https://github.com/davigar15/ops-lib-charmed-osm. That will be
eventually moved to gitlab, when it has a PyPI repository available
- Add unit tests to all charms
- Modify installer and bundles to point to the new charms
- Improve the build.sh script for building the charms
Change-Id: I0896ceb082d1b6a76b3560c07482a4135a220a3f
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charm/pla/.gitignore b/installers/charm/pla/.gitignore
index dad4b21..493739e 100644
--- a/installers/charm/pla/.gitignore
+++ b/installers/charm/pla/.gitignore
@@ -1,19 +1,30 @@
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
+venv
.vscode
build
-pla.charm
+*.charm
+.coverage
+coverage.xml
.stestr
-.coverage*
-cover/
\ No newline at end of file
+cover
+release
diff --git a/installers/charm/pla/.jujuignore b/installers/charm/pla/.jujuignore
new file mode 100644
index 0000000..bf04eb4
--- /dev/null
+++ b/installers/charm/pla/.jujuignore
@@ -0,0 +1,28 @@
+# Copyright 2021 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
+venv
+.vscode
+build
+prometheus.charm
+.coverage
+.stestr
+cover
diff --git a/installers/charm/pla/.yamllint.yaml b/installers/charm/pla/.yamllint.yaml
index ab52c60..d71fb69 100644
--- a/installers/charm/pla/.yamllint.yaml
+++ b/installers/charm/pla/.yamllint.yaml
@@ -1,16 +1,24 @@
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
---
extends: default
@@ -20,4 +28,7 @@
- ".yamllint"
ignore: |
.tox
- mod
+ cover/
+ build/
+ venv
+ release/
diff --git a/installers/charm/pla/config.yaml b/installers/charm/pla/config.yaml
index 57c5df0..ae90304 100644
--- a/installers/charm/pla/config.yaml
+++ b/installers/charm/pla/config.yaml
@@ -16,31 +16,11 @@
# limitations under the License.
options:
- image:
- description: Docker image name
- type: string
- default: opensourcemano/pla:latest
- image_username:
- description: Docker repository username
- type: string
- default: ""
- image_password:
- description: Docker repository password
- type: string
- default: ""
- port:
- description: Port number
- type: int
- default: 8080 # Fake port
log_level:
description: Log level
type: string
default: INFO
- database:
- description: Database name
- type: string
- default: pla
- database_common_key:
+ database_commonkey:
description: Common Key for Mongo database
type: string
default: osm
diff --git a/installers/charm/pla/metadata.yaml b/installers/charm/pla/metadata.yaml
index 90c9d40..b9a344b 100644
--- a/installers/charm/pla/metadata.yaml
+++ b/installers/charm/pla/metadata.yaml
@@ -22,8 +22,13 @@
deployment:
type: stateless
service: cluster
+resources:
+ image:
+ type: oci-image
+ description: OSM docker image for POL
+ upstream-source: "opensourcemano/pla:latest"
requires:
kafka:
interface: kafka
- mongo:
+ mongodb:
interface: mongodb
diff --git a/installers/charm/pla/requirements-test.txt b/installers/charm/pla/requirements-test.txt
new file mode 100644
index 0000000..d7585f3
--- /dev/null
+++ b/installers/charm/pla/requirements-test.txt
@@ -0,0 +1,31 @@
+# Copyright 2021 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+-r requirements.txt
+coverage
+stestr
+mock
+black
+yamllint
+flake8
+safety
+requests-mock
+asynctest
+nose2
\ No newline at end of file
diff --git a/installers/charm/pla/requirements.txt b/installers/charm/pla/requirements.txt
index 10ecdcd..f10a199 100644
--- a/installers/charm/pla/requirements.txt
+++ b/installers/charm/pla/requirements.txt
@@ -1,14 +1,22 @@
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-ops
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
+git+https://github.com/davigar15/ops-lib-charmed-osm/@e7f26cd29b322e175a23cadbe4546b7f2bbf111c
\ No newline at end of file
diff --git a/installers/charm/pla/src/charm.py b/installers/charm/pla/src/charm.py
index 6847580..4f463bf 100755
--- a/installers/charm/pla/src/charm.py
+++ b/installers/charm/pla/src/charm.py
@@ -1,147 +1,119 @@
#!/usr/bin/env python3
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
+# pylint: disable=E0213
+
import logging
-
-from ops.charm import CharmBase
-from ops.framework import StoredState
-from ops.main import main
-from ops.model import (
- ActiveStatus,
- MaintenanceStatus,
- WaitingStatus,
-)
from typing import NoReturn
+from ops.main import main
+
+from opslib.osm.charm import CharmedOsmBase, RelationsMissing
+
+from opslib.osm.pod import (
+ ContainerV3Builder,
+ PodSpecV3Builder,
+)
+
+from opslib.osm.validator import (
+ ModelValidator,
+ validator,
+)
+
+from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.mongo import MongoClient
+
+
logger = logging.getLogger(__name__)
+PORT = 9999
-class PLACharm(CharmBase):
- state = StoredState()
+class ConfigModel(ModelValidator):
+ database_commonkey: str
+ log_level: str
+
+ @validator("log_level")
+ def validate_log_level(cls, v):
+ if v not in {"INFO", "DEBUG"}:
+ raise ValueError("value must be INFO or DEBUG")
+ return v
+
+
+class PlaCharm(CharmedOsmBase):
def __init__(self, *args) -> NoReturn:
- super().__init__(*args)
- self.state.set_default(spec=None)
- self.state.set_default(kafka_host=None)
- self.state.set_default(kafka_port=None)
- self.state.set_default(mongodb_uri=None)
+ super().__init__(*args, oci_image="image")
- # Observe Charm related events
- self.framework.observe(self.on.config_changed, self.on_config_changed)
- self.framework.observe(self.on.start, self.on_start)
- self.framework.observe(self.on.upgrade_charm, self.on_upgrade_charm)
+ self.kafka_client = KafkaClient(self, "kafka")
+ self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
+ self.framework.observe(self.on["kafka"].relation_broken, self.configure_pod)
- # Relations
- self.framework.observe(
- self.on.kafka_relation_changed, self.on_kafka_relation_changed
- )
- self.framework.observe(
- self.on.mongo_relation_changed, self.on_mongo_relation_changed
- )
+ self.mongodb_client = MongoClient(self, "mongodb")
+ self.framework.observe(self.on["mongodb"].relation_changed, self.configure_pod)
+ self.framework.observe(self.on["mongodb"].relation_broken, self.configure_pod)
- def _apply_spec(self):
- # Only apply the spec if this unit is a leader.
- unit = self.model.unit
- if not unit.is_leader():
- unit.status = ActiveStatus("ready")
- return
- if not self.state.kafka_host or not self.state.kafka_port:
- unit.status = WaitingStatus("Waiting for Kafka")
- return
- if not self.state.mongodb_uri:
- unit.status = WaitingStatus("Waiting for MongoDB")
- return
+ def _check_missing_dependencies(self, config: ConfigModel):
+ missing_relations = []
- unit.status = MaintenanceStatus("Applying new pod spec")
+ if self.kafka_client.is_missing_data_in_unit():
+ missing_relations.append("kafka")
+ if self.mongodb_client.is_missing_data_in_unit():
+ missing_relations.append("mongodb")
- new_spec = self.make_pod_spec()
- if new_spec == self.state.spec:
- unit.status = ActiveStatus("ready")
- return
- self.framework.model.pod.set_spec(new_spec)
- self.state.spec = new_spec
- unit.status = ActiveStatus("ready")
+ if missing_relations:
+ raise RelationsMissing(missing_relations)
- def make_pod_spec(self):
- config = self.framework.model.config
-
- ports = [
+ def build_pod_spec(self, image_info):
+ # Validate config
+ config = ConfigModel(**dict(self.config))
+ # Check relations
+ self._check_missing_dependencies(config)
+ # Create Builder for the PodSpec
+ pod_spec_builder = PodSpecV3Builder()
+ # Build Container
+ container_builder = ContainerV3Builder(self.app.name, image_info)
+ container_builder.add_port(name=self.app.name, port=PORT)
+ container_builder.add_envs(
{
- "name": "port",
- "containerPort": config["port"],
- "protocol": "TCP",
- },
- ]
+ # General configuration
+ "ALLOW_ANONYMOUS_LOGIN": "yes",
+ "OSMPLA_GLOBAL_LOG_LEVEL": config.log_level,
+ # Kafka configuration
+ "OSMPLA_MESSAGE_DRIVER": "kafka",
+ "OSMPLA_MESSAGE_HOST": self.kafka_client.host,
+ "OSMPLA_MESSAGE_PORT": self.kafka_client.port,
+ # Database configuration
+ "OSMPLA_DATABASE_DRIVER": "mongo",
+ "OSMPLA_DATABASE_URI": self.mongodb_client.connection_string,
+ "OSMPLA_DATABASE_COMMONKEY": config.database_commonkey,
+ }
+ )
- config_spec = {
- "OSMPLA_MESSAGE_DRIVER": "kafka",
- "OSMPLA_MESSAGE_HOST": self.state.kafka_host,
- "OSMPLA_MESSAGE_PORT": self.state.kafka_port,
- "OSMPLA_DATABASE_DRIVER": "mongo",
- "OSMPLA_DATABASE_URI": self.state.mongodb_uri,
- "OSMPLA_GLOBAL_LOG_LEVEL": config["log_level"],
- "OSMPLA_DATABASE_COMMONKEY": config["database_common_key"],
- }
-
- spec = {
- "version": 2,
- "containers": [
- {
- "name": self.framework.model.app.name,
- "imageDetails": {
- "imagePath": config["image"],
- "username": config["image_username"],
- "password": config["image_password"],
- },
- "ports": ports,
- "config": config_spec,
- }
- ],
- }
-
- return spec
-
- def on_config_changed(self, event):
- """Handle changes in configuration"""
- self._apply_spec()
-
- def on_start(self, event):
- """Called when the charm is being installed"""
- self._apply_spec()
-
- def on_upgrade_charm(self, event):
- """Upgrade the charm."""
- unit = self.model.unit
- unit.status = MaintenanceStatus("Upgrading charm")
- self._apply_spec()
-
- def on_kafka_relation_changed(self, event):
- kafka_host = event.relation.data[event.unit].get("host")
- kafka_port = event.relation.data[event.unit].get("port")
- if kafka_host and self.state.kafka_host != kafka_host:
- self.state.kafka_host = kafka_host
- if kafka_port and self.state.kafka_port != kafka_port:
- self.state.kafka_port = kafka_port
- self._apply_spec()
-
- def on_mongo_relation_changed(self, event):
- mongodb_uri = event.relation.data[event.unit].get("connection_string")
- if mongodb_uri and self.state.mongodb_uri != mongodb_uri:
- self.state.mongodb_uri = mongodb_uri
- self._apply_spec()
+ container = container_builder.build()
+ # Add container to pod spec
+ pod_spec_builder.add_container(container)
+ return pod_spec_builder.build()
if __name__ == "__main__":
- main(PLACharm)
+ main(PlaCharm)
diff --git a/installers/charm/pla/tests/__init__.py b/installers/charm/pla/tests/__init__.py
index 6004c6d..d0d973a 100644
--- a/installers/charm/pla/tests/__init__.py
+++ b/installers/charm/pla/tests/__init__.py
@@ -22,10 +22,10 @@
"""Init mocking for unit tests."""
-# import sys
-# import mock
+import sys
+import mock
-# sys.path.append("src")
+sys.path.append("src")
-# oci_image = mock.MagicMock()
-# sys.modules["oci_image"] = oci_image
+oci_image = mock.MagicMock()
+sys.modules["oci_image"] = oci_image
diff --git a/installers/charm/pla/tests/test_charm.py b/installers/charm/pla/tests/test_charm.py
index dbc7be3..b1a7820 100644
--- a/installers/charm/pla/tests/test_charm.py
+++ b/installers/charm/pla/tests/test_charm.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -20,27 +20,80 @@
# osm-charmers@lists.launchpad.net
##
+import sys
from typing import NoReturn
import unittest
-
+from ops.model import ActiveStatus, BlockedStatus
from ops.testing import Harness
-from charm import PLACharm
+from charm import PlaCharm
class TestCharm(unittest.TestCase):
- """PLA Charm unit tests."""
+ """Pla Charm unit tests."""
def setUp(self) -> NoReturn:
"""Test setup"""
- self.harness = Harness(PLACharm)
+ self.image_info = sys.modules["oci_image"].OCIImageResource().fetch()
+ self.harness = Harness(PlaCharm)
self.harness.set_leader(is_leader=True)
self.harness.begin()
+ self.config = {
+ "log_level": "INFO",
+ }
+ self.harness.update_config(self.config)
- def test_on_start_without_relations(self) -> NoReturn:
- """Test installation without any relation."""
+ def test_config_changed_no_relations(
+ self,
+ ) -> NoReturn:
+ """Test ingress resources without HTTP."""
+
self.harness.charm.on.config_changed.emit()
+ # Assertions
+ self.assertIsInstance(self.harness.charm.unit.status, BlockedStatus)
+ self.assertTrue(
+ all(
+ relation in self.harness.charm.unit.status.message
+ for relation in ["mongodb", "kafka"]
+ )
+ )
+
+ def test_config_changed_non_leader(
+ self,
+ ) -> NoReturn:
+ """Test ingress resources without HTTP."""
+ self.harness.set_leader(is_leader=False)
+ self.harness.charm.on.config_changed.emit()
+
+ # Assertions
+ self.assertIsInstance(self.harness.charm.unit.status, ActiveStatus)
+
+ def test_with_relations(
+ self,
+ ) -> NoReturn:
+ "Test with relations (internal)"
+ self.initialize_kafka_relation()
+ self.initialize_mongo_relation()
+ # Verifying status
+ self.assertNotIsInstance(self.harness.charm.unit.status, BlockedStatus)
+
+ def initialize_kafka_relation(self):
+ kafka_relation_id = self.harness.add_relation("kafka", "kafka")
+ self.harness.add_relation_unit(kafka_relation_id, "kafka/0")
+ self.harness.update_relation_data(
+ kafka_relation_id, "kafka/0", {"host": "kafka", "port": 9092}
+ )
+
+ def initialize_mongo_relation(self):
+ mongodb_relation_id = self.harness.add_relation("mongodb", "mongodb")
+ self.harness.add_relation_unit(mongodb_relation_id, "mongodb/0")
+ self.harness.update_relation_data(
+ mongodb_relation_id,
+ "mongodb/0",
+ {"connection_string": "mongodb://mongo:27017"},
+ )
+
if __name__ == "__main__":
unittest.main()
diff --git a/installers/charm/pla/tox.ini b/installers/charm/pla/tox.ini
index 32d78d3..1f9442e 100644
--- a/installers/charm/pla/tox.ini
+++ b/installers/charm/pla/tox.ini
@@ -1,4 +1,4 @@
-# Copyright 2020 Canonical Ltd.
+# Copyright 2021 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -18,64 +18,98 @@
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
##
+#######################################################################################
[tox]
+envlist = flake8, cover, pylint, safety, yamllint
skipsdist = True
-envlist = unit, lint
-sitepackages = False
-skip_missing_interpreters = False
[testenv]
basepython = python3.8
setenv =
+ VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
PYTHONPATH = {toxinidir}/src
- CHARM_NAME = pla
+deps = -r{toxinidir}/requirements.txt
+#######################################################################################
+[testenv:cover]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+commands =
+ sh -c 'rm -f nosetests.xml'
+ coverage erase
+ nose2 -C --coverage src
+ coverage report --omit='*tests*'
+ coverage html -d ./cover --omit='*tests*'
+ coverage xml -o coverage.xml --omit=*tests*
+whitelist_externals = sh
+
+#######################################################################################
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+commands =
+ - safety check --full-report
+
+#######################################################################################
+[testenv:flake8]
+deps = flake8
+commands =
+ flake8 src/ tests/
+
+#######################################################################################
+[testenv:pylint]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+ pylint
+commands =
+ pylint -E src
+
+#######################################################################################
+[testenv:black]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+ black
+commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+
+#######################################################################################
+[testenv:yamllint]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+ yamllint
+commands = yamllint .
+
+#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-test.txt
+ charmcraft
whitelist_externals =
charmcraft
- rm
- unzip
+ cp
commands =
- rm -rf release pla.charm
charmcraft build
- unzip pla.charm -d release
+ cp -r build release
-[testenv:unit]
-commands =
- coverage erase
- stestr run --slowest --test-path=./tests --top-dir=./
- coverage combine
- coverage html -d cover
- coverage xml -o cover/coverage.xml
- coverage report
-deps =
- coverage
- stestr
- mock
- ops
-setenv =
- {[testenv]setenv}
- PYTHON=coverage run
+#######################################################################################
+[flake8]
+ignore =
+ W291,
+ W293,
+ E123,
+ E125,
+ E226,
+ E241,
+exclude =
+ .git,
+ __pycache__,
+ .tox,
+max-line-length = 120
+show-source = True
+builtins = _
-[testenv:lint]
-deps =
- black
- yamllint
- flake8
-commands =
- black --check --diff . --exclude "build/|.tox/|mod/|lib/|release/"
- yamllint .
- flake8 . --max-line-length=100 --ignore="E501,W503,W504,F722" --exclude "build/ .tox/ mod/ lib/ release/"
-
-[coverage:run]
-branch = True
-concurrency = multiprocessing
-parallel = True
-source =
- .
-omit =
- .tox/*
- tests/*