From c706aedb953f94570b036165c5c7ff5bbb8a1d15 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 26 Jun 2020 17:39:24 +0300 Subject: [PATCH] Add linters check This patch adds linters check with help of ansible-lint tool Change-Id: Id7d11416ac7cf375211f9b9fb9c5bf2028cba496 --- .zuul.yaml | 2 ++ test-requirements.txt | 1 + tests/test.yml | 1 + tests/test_vars.yml | 2 +- tox.ini | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.zuul.yaml b/.zuul.yaml index 79ce9a0..0f823d0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -8,6 +8,8 @@ check: jobs: - ffrouting-deploy + - tox-linters gate: jobs: - ffrouting-deploy + - tox-linters diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..6dd128e --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +ansible-lint diff --git a/tests/test.yml b/tests/test.yml index ae1a654..fd77289 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -29,6 +29,7 @@ shell: | set -e ping -c2 "{{ item.address }}" + changed_when: false register: _ping_vlan until: _ping_vlan is success retries: 5 diff --git a/tests/test_vars.yml b/tests/test_vars.yml index e59e1c3..8ffc978 100644 --- a/tests/test_vars.yml +++ b/tests/test_vars.yml @@ -14,7 +14,7 @@ # limitations under the License. frr_vlans: - - vlan-raw-device: eth0 + - vlan-raw-device: "{{ ansible_default_ipv4.interface }}" id: 100 address: 192.168.1.100 netmask: 255.255.255.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d65313e --- /dev/null +++ b/tox.ini @@ -0,0 +1,36 @@ +[tox] +minversion = 3.1 +skipsdist = True +envlist = linters +ignore_basepython_conflict = True + +[testenv] +basepython = python3 +usedevelop = False +commands = + /usr/bin/find . -type f -name "*.pyc" -delete +deps = + -r{toxinidir}/test-requirements.txt +passenv = + COMMON_TESTS_PATH + HOME + http_proxy + HTTP_PROXY + https_proxy + HTTPS_PROXY + no_proxy + NO_PROXY + TESTING_BRANCH + TESTING_HOME + USER +whitelist_externals = + bash +setenv = + PYTHONUNBUFFERED=1 + TEST_IDEMPOTENCE=false + VIRTUAL_ENV={envdir} + WORKING_DIR={toxinidir} + +[testenv:linters] +commands = + ansible-lint {toxinidir}/tests/test.yml