Mercurial > kallithea
annotate Jenkinsfile @ 7277:0cf121eae2fe
tests: fix caching issue in test_ip_restriction_git
Following test failure is observed in
TestVCSOperations.test_ip_restriction_git:
―――――――――――――― TestVCSOperations.test_ip_restriction_git ――――――――――――――――――
kallithea/tests/other/test_vcs_operations.py:584: in test_ip_restriction_git
assert re.search(r'\b403\b', stderr)
E assert None
E + where None = <function search at 0x7fb9772da578>('\\b403\\b', "Cloning into '/tmp/kallithea-test-SZhXDz/vcs_operations-krPNvZ'...\n")
E + where <function search at 0x7fb9772da578> = re.search
------------------------- Captured stdout call ----------------------------
*** CMD git clone http://test_admin:test12@127.0.0.1:45291/vcs_test_git /tmp/kallithea-test-SZhXDz/vcs_operations-krPNvZ ***
stderr: "Cloning into '/tmp/kallithea-test-SZhXDz/vcs_operations-krPNvZ'...\n"
The test is setting up IP restrictions, verifying that access is no longer
possible, then clears the restriction. There already were sleeps after
clearing the restrictions, in order for the cache to expire and have the
setting take effect.
But there was no sleep on the enabling of the IP restriction, allowing
situations where the code would still run without restriction, and thus
allow the access, failing the test.
The failure has only been observed on test_ip_restriction_git, but the
change is also made for test_ip_restriction_hg.
The existing sleeps after restriction clearing are moved up to the 'finally'
clause to make it clear to which code they belong.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 06 May 2018 21:30:09 +0200 |
parents | 58713c2ebfff |
children | d9e37f7fd35b |
rev | line source |
---|---|
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
1 def createvirtualenv = '' |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
2 def activatevirtualenv = '' |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
3 |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
4 node { |
6925
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
5 properties([[$class: 'BuildDiscarderProperty', |
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
6 strategy: [$class: 'LogRotator', |
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
7 artifactDaysToKeepStr: '', |
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
8 artifactNumToKeepStr: '10', |
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
9 daysToKeepStr: '', |
58713c2ebfff
jenkinsfile: only keep the artifacts (test result xml files) of the last 10 builds
domruf <dominikruf@gmail.com>
parents:
6924
diff
changeset
|
10 numToKeepStr: '']]]); |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
11 if (isUnix()) { |
6550
ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
domruf <dominikruf@gmail.com>
parents:
6549
diff
changeset
|
12 createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME' |
ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
domruf <dominikruf@gmail.com>
parents:
6549
diff
changeset
|
13 activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
14 } else { |
6550
ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
domruf <dominikruf@gmail.com>
parents:
6549
diff
changeset
|
15 createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && virtualenv %JENKINS_HOME%\\venv\\%JOB_NAME%' |
ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
domruf <dominikruf@gmail.com>
parents:
6549
diff
changeset
|
16 activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
17 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
18 |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
19 stage('checkout') { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
20 checkout scm |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
21 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
22 sh 'hg --config extensions.purge= purge --all' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
23 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
24 bat 'hg --config extensions.purge= purge --all' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
25 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
26 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
27 stage('virtual env') { |
6550
ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
domruf <dominikruf@gmail.com>
parents:
6549
diff
changeset
|
28 def virtualenvscript = """$createvirtualenv |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
29 $activatevirtualenv |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
30 python -m pip install --upgrade pip |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
31 pip install --upgrade setuptools |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
32 pip install --upgrade pylint |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
33 pip install --upgrade pytest-cov |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
34 """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
35 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
36 virtualenvscript += """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
37 pip install --upgrade python-ldap |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
38 pip install --upgrade python-pam |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
39 """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
40 sh virtualenvscript |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
41 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
42 bat virtualenvscript |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
43 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
44 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
45 stage('setup') { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
46 def virtualenvscript = """$activatevirtualenv |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
47 pip install --upgrade -e . |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
48 pip install -r dev_requirements.txt |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
49 python setup.py compile_catalog |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
50 """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
51 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
52 sh virtualenvscript |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
53 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
54 bat virtualenvscript |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
55 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
56 stash name: 'kallithea', useDefaultExcludes: false |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
57 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
58 stage('pylint') { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
59 sh script: """$activatevirtualenv |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
60 pylint -j 0 --disable=C -f parseable kallithea > pylint.out |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
61 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
62 archiveArtifacts 'pylint.out' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
63 try { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
64 step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: 'pylint.out']], unHealthy: '']) |
6551
bc1b11a5d548
jenkinsfile: catch the correct exception if jenkins plugin is not available
domruf <dominikruf@gmail.com>
parents:
6550
diff
changeset
|
65 } catch (java.lang.IllegalArgumentException exc) { |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
66 echo "You need to install the 'Warnings Plug-in' to display the pylint report." |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
67 currentBuild.result = 'UNSTABLE' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
68 echo "Caught: ${exc}" |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
69 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
70 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
71 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
72 |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
73 def pytests = [:] |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
74 pytests['sqlite'] = { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
75 node { |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
76 ws { |
6552
15a12f2a47b4
jenkinsfile: delete all old files in the workspace
domruf <dominikruf@gmail.com>
parents:
6551
diff
changeset
|
77 deleteDir() |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
78 unstash name: 'kallithea' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
79 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
80 sh script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
81 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
82 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
83 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
84 bat script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
85 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
86 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
87 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
88 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
89 archiveArtifacts 'pytest_sqlite.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
90 junit 'pytest_sqlite.xml' |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
91 writeFile(file: '.coverage.sqlite', text: readFile('.coverage')) |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
92 stash name: 'coverage.sqlite', includes: '.coverage.sqlite' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
93 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
94 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
95 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
96 |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
97 pytests['de'] = { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
98 node { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
99 if (isUnix()) { |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
100 ws { |
6552
15a12f2a47b4
jenkinsfile: delete all old files in the workspace
domruf <dominikruf@gmail.com>
parents:
6551
diff
changeset
|
101 deleteDir() |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
102 unstash name: 'kallithea' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
103 withEnv(['LANG=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
104 'LANGUAGE=de', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
105 'LC_ADDRESS=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
106 'LC_IDENTIFICATION=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
107 'LC_MEASUREMENT=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
108 'LC_MONETARY=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
109 'LC_NAME=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
110 'LC_NUMERIC=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
111 'LC_PAPER=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
112 'LC_TELEPHONE=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
113 'LC_TIME=de_DE.UTF-8', |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
114 ]) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
115 sh script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
116 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
117 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
118 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
119 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
120 archiveArtifacts 'pytest_de.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
121 junit 'pytest_de.xml' |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
122 writeFile(file: '.coverage.de', text: readFile('.coverage')) |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
123 stash name: 'coverage.de', includes: '.coverage.de' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
124 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
125 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
126 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
127 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
128 pytests['mysql'] = { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
129 node { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
130 if (isUnix()) { |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
131 ws { |
6552
15a12f2a47b4
jenkinsfile: delete all old files in the workspace
domruf <dominikruf@gmail.com>
parents:
6551
diff
changeset
|
132 deleteDir() |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
133 unstash name: 'kallithea' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
134 sh """$activatevirtualenv |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
135 pip install --upgrade MySQL-python |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
136 """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
137 withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
138 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
139 sh script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
140 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
141 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
142 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
143 bat script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
144 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
145 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
146 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
147 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
148 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
149 archiveArtifacts 'pytest_mysql.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
150 junit 'pytest_mysql.xml' |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
151 writeFile(file: '.coverage.mysql', text: readFile('.coverage')) |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
152 stash name: 'coverage.mysql', includes: '.coverage.mysql' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
153 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
154 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
155 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
156 } |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
157 pytests['postgresql'] = { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
158 node { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
159 if (isUnix()) { |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
160 ws { |
6552
15a12f2a47b4
jenkinsfile: delete all old files in the workspace
domruf <dominikruf@gmail.com>
parents:
6551
diff
changeset
|
161 deleteDir() |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
162 unstash name: 'kallithea' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
163 sh """$activatevirtualenv |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
164 pip install --upgrade psycopg2 |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
165 """ |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
166 withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
167 if (isUnix()) { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
168 sh script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
169 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
170 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
171 } else { |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
172 bat script: """$activatevirtualenv |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
173 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
174 """, returnStatus: true |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
175 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
176 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
177 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
178 archiveArtifacts 'pytest_postgresql.xml' |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
179 junit 'pytest_postgresql.xml' |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
180 writeFile(file: '.coverage.postgresql', text: readFile('.coverage')) |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
181 stash name: 'coverage.postgresql', includes: '.coverage.postgresql' |
6536
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
182 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
183 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
184 } |
8d788789b38a
tests: add Jenkinsfile for automatic creation of Jenkins projects for testing Kallithea itself
domruf <dominikruf@gmail.com>
parents:
diff
changeset
|
185 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
186 stage('Tests') { |
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
187 parallel pytests |
6924
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
188 node { |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
189 unstash 'coverage.sqlite' |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
190 unstash 'coverage.de' |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
191 unstash 'coverage.mysql' |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
192 unstash 'coverage.postgresql' |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
193 if (isUnix()) { |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
194 sh script: """$activatevirtualenv |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
195 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
196 coverage xml |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
197 """, returnStatus: true |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
198 } else { |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
199 bat script: """$activatevirtualenv |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
200 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
201 coverage xml |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
202 """, returnStatus: true |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
203 } |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
204 try { |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
205 step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false]) |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
206 } catch (java.lang.IllegalArgumentException exc) { |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
207 echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report." |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
208 currentBuild.result = 'UNSTABLE' |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
209 echo "Caught: ${exc}" |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
210 } |
0acb46763886
jenkinsfile: combine coverage files from different DB runs
domruf <dominikruf@gmail.com>
parents:
6583
diff
changeset
|
211 } |
6583
8a60eb2b7603
Jenkinsfile: run each py.test on a separate executor
domruf <dominikruf@gmail.com>
parents:
6552
diff
changeset
|
212 } |