Commit b623faa1 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'fix/ofc22-tests' into 'develop'

Improving scripts that launch all the tests of ofc22 and ecoc22 at once

See merge request !19
parents 898d74f9 8053fb61
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


PROJECTDIR=`pwd`
PROJECTDIR=`pwd`


cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc
RCFILE=$PROJECTDIR/coverage/.coveragerc
COVERAGEFILE=$PROJECTDIR/coverage/.coverage
COVERAGEFILE=$PROJECTDIR/coverage/.coverage


@@ -26,18 +25,20 @@ cat $PROJECTDIR/coverage/.coveragerc.template | sed s+~/teraflow/controller+$PRO
# Destroy old coverage file
# Destroy old coverage file
rm -f $COVERAGEFILE
rm -f $COVERAGEFILE


source tfs_runtime_env_vars.sh

# Force a flush of Context database
# Force a flush of Context database
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL


# Run functional tests and analyze code coverage at the same time
# Run functional tests and analyze code coverage at the same time
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ecoc22/tests/test_functional_bootstrap.py
    src/tests/ecoc22/tests/test_functional_bootstrap.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ecoc22/tests/test_functional_create_service.py
    src/tests/ecoc22/tests/test_functional_create_service.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ecoc22/tests/test_functional_delete_service.py
    src/tests/ecoc22/tests/test_functional_delete_service.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ecoc22/tests/test_functional_cleanup.py
    src/tests/ecoc22/tests/test_functional_cleanup.py
+8 −8
Original line number Original line Diff line number Diff line
@@ -16,30 +16,30 @@


PROJECTDIR=`pwd`
PROJECTDIR=`pwd`


cd $PROJECTDIR/src
# cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc
RCFILE=$PROJECTDIR/coverage/.coveragerc
COVERAGEFILE=$PROJECTDIR/coverage/.coverage
COVERAGEFILE=$PROJECTDIR/coverage/.coverage


# Configure the correct folder on the .coveragerc file
# Configure the correct folder on the .coveragerc file
cat $PROJECTDIR/coverage/.coveragerc.template | sed s+~/teraflow/controller+$PROJECTDIR+g > $RCFILE
cat $PROJECTDIR/coverage/.coveragerc.template | sed s+~/teraflow/controller+$PROJECTDIR/src+g > $RCFILE


# Destroy old coverage file
# Destroy old coverage file
rm -f $COVERAGEFILE
rm -f $COVERAGEFILE


source tfs_runtime_env_vars.sh

# Force a flush of Context database
# Force a flush of Context database
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL


source tfs_runtime_env_vars.sh

# Run functional tests and analyze code coverage at the same time
# Run functional tests and analyze code coverage at the same time
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ofc22/tests/test_functional_bootstrap.py
    src/tests/ofc22/tests/test_functional_bootstrap.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ofc22/tests/test_functional_create_service.py
    src/tests/ofc22/tests/test_functional_create_service.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ofc22/tests/test_functional_delete_service.py
    src/tests/ofc22/tests/test_functional_delete_service.py


coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    tests/ofc22/tests/test_functional_cleanup.py
    src/tests/ofc22/tests/test_functional_cleanup.py
+1 −2
Original line number Original line Diff line number Diff line
@@ -198,7 +198,6 @@ def test_scenario_kpis_created(monitoring_client: MonitoringClient):
    during the service creation process.
    during the service creation process.
    """
    """
    response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty())
    response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty())
    LOGGER.info("Number of KPIs created: {}".format(len(response.kpi_descriptor_list)))
    # TODO: replace the magic number `16` below for a formula that adapts to the number
    # TODO: replace the magic number `16` below for a formula that adapts to the number
    # of links and devices
    # of links and devices
    assert len(response.kpi_descriptor_list) == 16
    assert len(response.kpi_descriptor_list) >= 16