Browse Source

Switch to using stestr

Change-Id: Ia70ef63f78c40fa60fc84e660c216ffbbadcfec9
changes/04/587404/16
jiaopengju 3 years ago
parent
commit
dfcd6ab7e1
7 changed files with 32 additions and 20 deletions
  1. +1
    -1
      .gitignore
  2. +3
    -0
      .stestr.conf
  3. +5
    -5
      karbor/tests/contrib/post_test_hook.sh
  4. +1
    -1
      lower-constraints.txt
  5. +2
    -2
      playbooks/legacy/karbor-dsvm-fullstack/post.yaml
  6. +1
    -0
      test-requirements.txt
  7. +19
    -11
      tox.ini

+ 1
- 1
.gitignore View File

@ -29,7 +29,7 @@ nosetests.xml
.testrepository
.venv
.log
!.stestr.conf
# Translations
*.mo


+ 3
- 0
.stestr.conf View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./karbor/tests/unit}
top_dir=./

+ 5
- 5
karbor/tests/contrib/post_test_hook.sh View File

@ -23,11 +23,11 @@ function generate_test_logs {
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u "$owner" chmod o+rw .
sudo -H -u "$owner" chmod o+rw -R .testrepository
if [[ -f ".testrepository/0" ]] ; then
".tox/$venv/bin/subunit-1to2" < .testrepository/0 > ./testrepository.subunit
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
sudo -H -u "$owner" chmod o+rw -R .stestr
if [[ -f ".stestr/0" ]] ; then
".tox/$venv/bin/subunit-1to2" < .stestr/0 > ./stestr.subunit
$SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html
gzip -9 ./stestr.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi


+ 1
- 1
lower-constraints.txt View File

@ -133,11 +133,11 @@ sqlalchemy-migrate==0.11.0
SQLAlchemy==1.0.10
sqlparse==0.2.4
statsd==3.2.2
stestr==2.0.0
stevedore==1.20.0
taskflow==2.16.0
Tempita==0.5.2
tenacity==4.9.0
testrepository==0.0.20
testresources==2.0.1
testscenarios==0.4
testtools==2.2.0


+ 2
- 2
playbooks/legacy/karbor-dsvm-fullstack/post.yaml View File

@ -35,7 +35,7 @@
copy_links: true
verify_host: true
rsync_opts:
- --include=/.testrepository/tmp*
- --include=/.stestr/tmp*
- --include=*/
- --exclude=*
- --prune-empty-dirs
@ -48,7 +48,7 @@
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testrepository.subunit.gz
- --include=**/*stestr.subunit.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs


+ 1
- 0
test-requirements.txt View File

@ -9,6 +9,7 @@ croniter>=0.3.4 # MIT License
python-subunit>=1.0.0 # Apache-2.0/BSD
sphinx!=1.6.6,>=1.6.2 # BSD
oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
taskflow>=2.16.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT


+ 19
- 11
tox.ini View File

@ -1,5 +1,5 @@
[tox]
minversion = 1.6
minversion = 2.0
envlist = py35,py27,pypy,pep8
skipsdist = True
@ -13,10 +13,11 @@ setenv =
LANGUAGE=en_US
LC_ALL=en_US.utf-8
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = rm
whitelist_externals = sh /bin/rm
commands =
rm -f .testrepository/times.dbm
python setup.py test --slowest --testr-args='{posargs}'
/bin/rm -f .testrepository/times.dbm
stestr run {posargs}
stestr slowest
[testenv:fullstack]
basepython = python2.7
@ -24,7 +25,8 @@ setenv = OS_TEST_PATH=./karbor/tests/fullstack
OS_TEST_TIMEOUT=3600
commands =
oslo-config-generator --config-file etc/oslo-config-generator/karbor.conf --output-file etc/karbor.conf
python setup.py test --slowest --testr-args="--concurrency=4 {posargs}"
stestr --test-path=./karbor/tests/fullstack run '--concurrency=4 {posargs}'
stestr slowest
[testenv:pep8]
basepython = python3
@ -36,15 +38,21 @@ commands = {posargs}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source karbor --parallel-mode
commands =
python setup.py test --coverage --testr-args='{posargs}'
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs]
basepython = python3
whitelist_externals = rm
commands = rm -rf doc/build
rm -rf doc/source/contributor/api
whitelist_externals = sh /bin/rm
commands = /bin/rm -rf doc/build
/bin/rm -rf doc/source/contributor/api
python setup.py build_sphinx
[testenv:debug]
@ -55,10 +63,10 @@ commands = oslo_debug_helper -t karbor/tests/unit {posargs}
basepython = python3
# This environment is called from CI scripts to test and publish
# the API Ref to developer.openstack.org.
whitelist_externals = rm
whitelist_externals = sh /bin/rm
deps = -r{toxinidir}/test-requirements.txt
commands =
rm -rf api-ref/build
/bin/rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/
[testenv:releasenotes]


Loading…
Cancel
Save