tests: use a random number in database name and tox environment path (#74787)
gitea/passerelle/pipeline/head This commit looks good Details

This commit is contained in:
Emmanuel Cazenave 2023-02-23 11:28:33 +01:00
parent bc8479c489
commit d1583a99de
3 changed files with 8 additions and 5 deletions

6
Jenkinsfile vendored
View File

@ -6,10 +6,14 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
timeout(time: 30, unit: 'MINUTES') timeout(time: 30, unit: 'MINUTES')
} }
environment {
max = 100000
RAND_TEST = "${Math.abs(new Random().nextInt(max+1))}"
}
stages { stages {
stage('Unit Tests') { stage('Unit Tests') {
steps { steps {
sh 'NUMPROCESSES=6 tox -rv ' sh "NUMPROCESSES=6 RAND_TEST=${env.RAND_TEST} tox -rv"
} }
post { post {
always { always {

View File

@ -65,7 +65,7 @@ DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'TEST': { 'TEST': {
'NAME': ('passerelle-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'))[:58], 'NAME': ('passerelle-test-%s' % os.environ.get("RAND_TEST", "")),
}, },
} }
} }

View File

@ -1,5 +1,5 @@
[tox] [tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:} toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:RAND_TEST:}
envlist = py3-django32-xmlschema14-codestyle-coverage,py3-django22-xmlschema10,pylint envlist = py3-django32-xmlschema14-codestyle-coverage,py3-django22-xmlschema10,pylint
[testenv] [testenv]
@ -7,7 +7,7 @@ usedevelop = True
setenv = setenv =
DJANGO_SETTINGS_MODULE=passerelle.settings DJANGO_SETTINGS_MODULE=passerelle.settings
PASSERELLE_SETTINGS_FILE=tests/settings.py PASSERELLE_SETTINGS_FILE=tests/settings.py
BRANCH_NAME={env:BRANCH_NAME:} RAND_TEST={env:RAND_TEST:}
WCSCTL=wcs/wcsctl.py WCSCTL=wcs/wcsctl.py
SETUPTOOLS_USE_DISTUTILS=stdlib SETUPTOOLS_USE_DISTUTILS=stdlib
NUMPROCESSES={env:NUMPROCESSES:1} NUMPROCESSES={env:NUMPROCESSES:1}
@ -69,7 +69,6 @@ filterwarnings = default
setenv = setenv =
DJANGO_SETTINGS_MODULE=passerelle.settings DJANGO_SETTINGS_MODULE=passerelle.settings
PASSERELLE_SETTINGS_FILE=tests/settings.py PASSERELLE_SETTINGS_FILE=tests/settings.py
BRANCH_NAME={env:BRANCH_NAME:}
SETUPTOOLS_USE_DISTUTILS=stdlib SETUPTOOLS_USE_DISTUTILS=stdlib
NUMPROCESSES={env:NUMPROCESSES:6} NUMPROCESSES={env:NUMPROCESSES:6}
deps = deps =