Add boilerplate config for Zuul and unit tests
Adds the required configuration to run Zuul on reviews, including flake8, pylint, bandit and unit tests. Tested by running tox locally. Partial-Bug: 1927003 Signed-off-by: Isac Souza <IsacSacchi.Souza@windriver.com> Change-Id: I7906dbadc00693736dedc2f5ea88ed24f74345f7
This commit is contained in:
parent
633d0a9a76
commit
87dcbb336b
82
.zuul.yaml
82
.zuul.yaml
@ -3,13 +3,95 @@
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- k8sapp-nginx-ingress-controller-tox-py27
|
||||
- k8sapp-nginx-ingress-controller-tox-py36
|
||||
- k8sapp-nginx-ingress-controller-tox-flake8
|
||||
- k8sapp-nginx-ingress-controller-tox-pylint
|
||||
- k8sapp-nginx-ingress-controller-tox-bandit
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- k8sapp-nginx-ingress-controller-tox-py27
|
||||
- k8sapp-nginx-ingress-controller-tox-py36
|
||||
- k8sapp-nginx-ingress-controller-tox-flake8
|
||||
- k8sapp-nginx-ingress-controller-tox-pylint
|
||||
- k8sapp-nginx-ingress-controller-tox-bandit
|
||||
post:
|
||||
jobs:
|
||||
- stx-nginx-ingress-controller-armada-app-upload-git-mirror
|
||||
|
||||
- job:
|
||||
name: k8sapp-nginx-ingress-controller-tox-py27
|
||||
parent: tox
|
||||
description: |
|
||||
Run py27 test for k8sapp-nginx-ingress-controller
|
||||
nodeset: ubuntu-xenial
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/update
|
||||
- starlingx/utilities
|
||||
files:
|
||||
- python-k8sapp-nginx-ingress-controller/*
|
||||
vars:
|
||||
tox_envlist: py27
|
||||
tox_extra_args: -c python-k8sapp-nginx-ingress-controller/k8sapp_nginx_ingress_controller/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-nginx-ingress-controller-tox-py36
|
||||
parent: tox
|
||||
description: |
|
||||
Run py36 test for k8sapp-nginx-ingress-controller
|
||||
nodeset: ubuntu-bionic
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/update
|
||||
- starlingx/utilities
|
||||
files:
|
||||
- python-k8sapp-nginx-ingress-controller/*
|
||||
vars:
|
||||
tox_envlist: py36
|
||||
tox_extra_args: -c python-k8sapp-nginx-ingress-controller/k8sapp_nginx_ingress_controller/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-nginx-ingress-controller-tox-flake8
|
||||
parent: tox
|
||||
description: |
|
||||
Run flake8 test for k8sapp-nginx-ingress-controller
|
||||
files:
|
||||
- python-k8sapp-nginx-ingress-controller/*
|
||||
vars:
|
||||
tox_envlist: flake8
|
||||
tox_extra_args: -c python-k8sapp-nginx-ingress-controller/k8sapp_nginx_ingress_controller/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-nginx-ingress-controller-tox-pylint
|
||||
parent: tox
|
||||
description: |
|
||||
Run pylint test for k8sapp-nginx-ingress-controller
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/update
|
||||
- starlingx/utilities
|
||||
files:
|
||||
- python-k8sapp-nginx-ingress-controller/*
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
tox_extra_args: -c python-k8sapp-nginx-ingress-controller/k8sapp_nginx_ingress_controller/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-nginx-ingress-controller-tox-bandit
|
||||
parent: tox
|
||||
description: |
|
||||
Run bandit test for k8sapp-nginx-ingress-controller
|
||||
files:
|
||||
- python-k8sapp-nginx-ingress-controller/*
|
||||
vars:
|
||||
tox_envlist: bandit
|
||||
tox_extra_args: -c python-k8sapp-nginx-ingress-controller/k8sapp_nginx_ingress_controller/tox.ini
|
||||
|
||||
- job:
|
||||
name: stx-nginx-ingress-controller-armada-app-upload-git-mirror
|
||||
parent: upload-git-mirror
|
||||
|
@ -0,0 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_path=./k8sapp_nginx_ingress_controller/tests
|
||||
top_dir=./k8sapp_nginx_ingress_controller
|
||||
#parallel_class=True
|
@ -1,5 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
@ -1,5 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
@ -6,7 +6,7 @@
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
||||
""" System inventory App lifecycle operator."""
|
||||
"""System inventory App lifecycle operator."""
|
||||
|
||||
from k8sapp_nginx_ingress_controller.common import constants as app_constants
|
||||
from oslo_log import log as logging
|
||||
@ -18,7 +18,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class NginxIngressControllerAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info):
|
||||
""" Perform lifecycle actions for an operation
|
||||
"""Perform lifecycle actions for an operation
|
||||
|
||||
:param context: request context
|
||||
:param conductor_obj: conductor object
|
||||
@ -34,7 +34,8 @@ class NginxIngressControllerAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
return self.pre_etcd_backup(app_op)
|
||||
|
||||
# Use the default behaviour for other hooks
|
||||
super(NginxIngressControllerAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app, hook_info)
|
||||
super(NginxIngressControllerAppLifecycleOperator, self).app_lifecycle_actions(
|
||||
context, conductor_obj, app_op, app, hook_info)
|
||||
|
||||
def pre_etcd_backup(self, app_op):
|
||||
"""Pre Etcd backup actions
|
||||
@ -46,7 +47,9 @@ class NginxIngressControllerAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
label_selector = "app.kubernetes.io/name={}," \
|
||||
"app.kubernetes.io/component={}"\
|
||||
.format(app_constants.HELM_CHART_INGRESS_NGINX, "admission-webhook")
|
||||
# pylint: disable=protected-access
|
||||
webhooks = app_op._kube.kube_get_validating_webhook_configurations_by_selector(label_selector, "")
|
||||
if webhooks:
|
||||
admission_webhook = webhooks[0].metadata.name
|
||||
# pylint: disable=protected-access
|
||||
app_op._kube.kube_delete_validating_webhook_configuration(admission_webhook)
|
||||
|
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from sysinv.tests.db import base
|
||||
|
||||
|
||||
class NginxICTestCase(base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(NginxICTestCase, self).setUp()
|
||||
|
||||
def tearDown(self):
|
||||
super(NginxICTestCase, self).tearDown()
|
||||
|
||||
def test_plugins(self):
|
||||
# placeholder for future unit tests
|
||||
pass
|
@ -1,2 +1,2 @@
|
||||
pbr>=2.0.0
|
||||
PyYAML==3.10
|
||||
PyYAML==3.13
|
||||
|
@ -1,8 +1,6 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
flake8<3.8.0
|
||||
pycodestyle<2.6.0 # MIT License
|
||||
hacking>=1.1.0,<=2.0.0 # Apache-2.0
|
||||
coverage>=3.6
|
||||
discover
|
||||
@ -12,14 +10,12 @@ passlib>=1.7.0
|
||||
psycopg2-binary
|
||||
python-subunit>=0.0.18
|
||||
requests-mock>=0.6.0 # Apache-2.0
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
oslosphinx<2.6.0,>=2.5.0 # Apache-2.0
|
||||
sphinx
|
||||
oslosphinx
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
testrepository>=0.0.18
|
||||
testtools!=1.2.0,>=0.9.36
|
||||
tempest-lib<0.5.0,>=0.4.0
|
||||
ipaddr
|
||||
pytest
|
||||
pyudev
|
||||
migrate
|
||||
|
@ -1,8 +1,9 @@
|
||||
[tox]
|
||||
envlist = flake8,py27,py36,pylint,bandit
|
||||
minversion = 1.6
|
||||
# skipsdist = True
|
||||
#,pip-missing-reqs
|
||||
# disable source dist generation because Zuul fails on setting up
|
||||
# pbr randomly in the sdist step.
|
||||
skipsdist = True
|
||||
|
||||
# tox does not work if the path to the workdir is too long, so move it to /tmp
|
||||
toxworkdir = /tmp/{env:USER}_k8sapp_nginx_ingress_controllertox
|
||||
@ -36,7 +37,6 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US:en
|
||||
LC_ALL=C
|
||||
EVENTS_YAML=./k8sapp_nginx_ingress_controller/tests/events_for_testing.yaml
|
||||
SYSINV_TEST_ENV=True
|
||||
TOX_WORK_DIR={toxworkdir}
|
||||
PYLINTHOME={toxworkdir}
|
||||
|
12
tox.ini
12
tox.ini
@ -33,3 +33,15 @@ commands =
|
||||
[testenv:linters]
|
||||
commands =
|
||||
{[testenv:bashate]commands}
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow flake8 to be run in subdir tox
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow pylint to be run in subdir tox
|
||||
|
||||
[testenv:bandit]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow bandit to be run in subdir tox
|
||||
|
Loading…
x
Reference in New Issue
Block a user