Update Dockerfile and stage-test script to run tests for charms 34/13134/3
authorDario Faccin <dario.faccin@canonical.com>
Fri, 31 Mar 2023 14:47:35 +0000 (16:47 +0200)
committerDario Faccin <dario.faccin@canonical.com>
Mon, 3 Apr 2023 15:52:53 +0000 (17:52 +0200)
This patch updates Dockerfile to use Ubuntu 20.04 as base for building
and testing charms.
This patch updates stage-test script to execute testing for charms.
Tests will be executed only for charms modified by the review.
This patch updates tox configuration for charms setting the python
interpreter to python3.8.

Change-Id: Ib9046b78d6520188cc51ac776fe60ea16479f11c
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
Dockerfile
devops-stages/stage-test.sh
installers/charm/osm-lcm/tox.ini
installers/charm/osm-mon/tox.ini
installers/charm/osm-nbi/tox.ini
installers/charm/osm-ng-ui/tox.ini
installers/charm/osm-pol/tox.ini
installers/charm/osm-ro/tox.ini
installers/charm/vca-integrator-operator/tox.ini

index 931da3e..dda7a41 100644 (file)
@@ -24,7 +24,7 @@
 #   devops-stages/stage-build.sh
 #
 
-FROM ubuntu:18.04
+FROM ubuntu:20.04
 
 ARG APT_PROXY
 RUN if [ ! -z $APT_PROXY ] ; then \
@@ -37,13 +37,13 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
         debhelper \
         dh-make \
         git \
-        python3.8 \
+        python3 \
         python3-all \
         python3-dev \
         python3-setuptools
 
-RUN python3 -m easy_install pip==21.0.1
-RUN pip3 install tox==3.22.0
+RUN python3 -m easy_install pip==21.3.1
+RUN pip install tox==3.24.5
 
 ENV LC_ALL C.UTF-8
 ENV LANG C.UTF-8
index b37ca5c..ae36ccf 100755 (executable)
 
 set -eu
 
-if [ $(git diff --name-only origin/$GERRIT_BRANCH -- installers/charm/ |wc -l) -eq 0 ]; then
-    exit 0
-fi
-
 CURRENT_DIR=`pwd`
 
 # Execute tests for charms
 CHARM_PATH="./installers/charm"
-CHARM_NAMES="keystone prometheus grafana"
+CHARM_NAMES="osm-lcm osm-mon osm-nbi osm-ng-ui osm-pol osm-ro keystone prometheus grafana vca-integrator-operator"
 for charm in $CHARM_NAMES; do
-    cd $CHARM_PATH/$charm
-    TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto
-    cd $CURRENT_DIR
+    if [ $(git diff --name-only "origin/${GERRIT_BRANCH}" -- "installers/charm/${charm}" | wc -l) -ne 0 ]; then
+        echo "Running tox for ${charm}"
+        cd "${CHARM_PATH}/${charm}"
+        TOX_PARALLEL_NO_SPINNER=1 tox -e lint,unit --parallel=auto
+        cd "${CURRENT_DIR}"
+    fi
 done
index 62ca08b..2d95eca 100644 (file)
@@ -29,6 +29,7 @@ tst_path = {toxinidir}/tests/
 all_path = {[vars]src_path} {[vars]tst_path} 
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index 96679d4..64bab10 100644 (file)
@@ -29,6 +29,7 @@ tst_path = {toxinidir}/tests/
 all_path = {[vars]src_path} {[vars]tst_path}
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index ff1d657..07ea16d 100644 (file)
@@ -30,6 +30,7 @@ lib_path = {toxinidir}/lib/charms/osm_nbi
 all_path = {[vars]src_path} {[vars]tst_path} 
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index 73cbb28..8c614b8 100644 (file)
@@ -29,6 +29,7 @@ tst_path = {toxinidir}/tests
 all_path = {[vars]src_path} {[vars]tst_path}
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index 62ca08b..2d95eca 100644 (file)
@@ -29,6 +29,7 @@ tst_path = {toxinidir}/tests/
 all_path = {[vars]src_path} {[vars]tst_path} 
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index 36f1061..c6cc629 100644 (file)
@@ -30,6 +30,7 @@ lib_path = {toxinidir}/lib/charms/osm_ro
 all_path = {[vars]src_path} {[vars]tst_path}
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace
index ea2f1a1..e063dd4 100644 (file)
@@ -27,6 +27,7 @@ lib_path = {toxinidir}/lib/charms/osm_vca_integrator
 all_path = {[vars]src_path} {[vars]tst_path} {[vars]lib_path}
 
 [testenv]
+basepython = python3.8
 setenv =
   PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
   PYTHONBREAKPOINT=ipdb.set_trace