Added an option to run Nailgun performance test

A new option -x added

run_tests.sh [-x | --performance]
             - run nailgun performance tests

If -x option is not specified, run_test.sh will not run
performance tests. For this reason no matching -X option was added.

Option -n | -N works exactly as before: run | do not run
Nailgun non-performance tests.

Examples of usage:
run_tests.sh -n -x - run both regular and performance nailgun tests.
run_tests.sh -x    - run nailgun performance tests only, do not run
                     regular nailgun tests
run_tests.sh -n    - run regular nailgun tests only
run_tests.sh -N    - run all tests except for nailgun regular and
                     performance tests

DocImpact
Change-Id: Id155e722da88549499641f5b924f35bfab3ab137
Closes-Bug: #1394196
This commit is contained in:
Julia Varigina 2014-12-29 08:17:37 -08:00
parent 5f6ecb14fd
commit 30e4d4e655
3 changed files with 17 additions and 8 deletions

View File

@ -801,7 +801,6 @@ DUMP:
to_file: proc_interrupts.txt
# performance tests settings
PERFORMANCE_PROFILING_TESTS: 0
PERFORMANCE_TESTS_RUN_NUMBER: 10
PERFORMANCE_TESTS_TOLERANCE: 0.1
LOAD_TESTS_PATHS:

View File

@ -15,7 +15,6 @@
from collections import defaultdict
import functools
from nose import SkipTest
import os.path
import shutil
import six
@ -36,7 +35,10 @@ from nailgun.test.base import reverse
from nailgun.test.base import test_db_driver
from nailgun.test.performance.profiler import ProfilerMiddleware
import pytest
@pytest.mark.performance
class BaseLoadTestCase(BaseTestCase):
"""All load test are long and test suits should be run only in purpose.
"""
@ -52,9 +54,6 @@ class BaseLoadTestCase(BaseTestCase):
@classmethod
def setUpClass(cls):
if not settings.PERFORMANCE_PROFILING_TESTS:
raise SkipTest("PERFORMANCE_PROFILING_TESTS in settings.yaml"
"is not set")
if os.path.exists(settings.LOAD_TESTS_PATHS['load_tests_base']):
shutil.rmtree(settings.LOAD_TESTS_PATHS['load_tests_base'])
os.makedirs(settings.LOAD_TESTS_PATHS['load_tests_base'])

View File

@ -29,8 +29,9 @@ function usage {
echo " -K, --no-tasklib Don't run tasklib unit and functional tests"
echo " -l, --lint-ui Run UI linting tasks"
echo " -L, --no-lint-ui Don't run UI linting tasks"
echo " -n, --nailgun Run NAILGUN both unit and integration tests"
echo " -N, --no-nailgun Don't run NAILGUN tests"
echo " -n, --nailgun Run NAILGUN unit/integration tests"
echo " -N, --no-nailgun Don't run NAILGUN unit/integration tests"
echo " -x, --performance Run NAILGUN performance tests"
echo " -p, --flake8 Run FLAKE8 and HACKING compliance check"
echo " -P, --no-flake8 Don't run static code checks"
echo " -s, --shotgun Run SHOTGUN tests"
@ -55,6 +56,7 @@ function process_options {
-A|--no-agent) no_agent_tests=1;;
-n|--nailgun) nailgun_tests=1;;
-N|--no-nailgun) no_nailgun_tests=1;;
-x|--performance) performance_tests=1;;
-k|--tasklib) tasklib_tests=1;;
-K|--no-tasklib) no_tasklib_tests=1;;
-w|--webui) webui_tests=1;;
@ -109,6 +111,7 @@ agent_tests=0
no_agent_tests=0
nailgun_tests=0
no_nailgun_tests=0
performance_tests=0
webui_tests=0
no_webui_tests=0
cli_tests=0
@ -150,6 +153,7 @@ function run_tests {
# Enable all tests if none was specified skipping all explicitly disabled tests.
if [[ $agent_tests -eq 0 && \
$nailgun_tests -eq 0 && \
$performance_tests -eq 0 && \
$tasklib_tests -eq 0 && \
$webui_tests -eq 0 && \
$cli_tests -eq 0 && \
@ -180,7 +184,7 @@ function run_tests {
run_agent_tests || errors+=" agent_tests"
fi
if [ $nailgun_tests -eq 1 ]; then
if [ $nailgun_tests -eq 1 ] || [ $performance_tests -eq 1 ]; then
echo "Starting Nailgun tests..."
run_nailgun_tests || errors+=" nailgun_tests"
fi
@ -256,6 +260,13 @@ function run_nailgun_tests {
local artifacts=$ARTIFACTS/nailgun
local config=$artifacts/test.yaml
local options="-vv --cleandb --junit-xml $NAILGUN_XUNIT"
if [ $nailgun_tests -eq 1 ] && [ $performance_tests -eq 0 ]; then
options+=" -m 'not performance' "
elif [ $nailgun_tests -eq 0 ] && [ $performance_tests -eq 1 ]; then
options+=" -m performance "
fi
prepare_artifacts $artifacts $config
if [ $# -ne 0 ]; then
TESTS="$@"