Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.core
Commits
65d5d08a
Commit
65d5d08a
authored
Apr 16, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Fix conflicts on certificate when run parallel tests
parent
4faf1cfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
16 deletions
+31
-16
master/product/SlapOS/tests/testSlapOSMixin.py
master/product/SlapOS/tests/testSlapOSMixin.py
+31
-12
master/tests/__init__.py
master/tests/__init__.py
+0
-4
No files found.
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
65d5d08a
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.tests.utils import DummyMailHost
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.tests.utils import DummyMailHost
from
Products.ERP5Type.Utils
import
convertToUpperCase
from
Products.ERP5Type.Utils
import
convertToUpperCase
import
os
import
os
import
glob
import
glob
import
shutil
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
setSecurityManager
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
...
@@ -71,28 +72,46 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -71,28 +72,46 @@ class testSlapOSMixin(ERP5TypeTestCase):
def
createCertificateAuthorityFile
(
self
):
def
createCertificateAuthorityFile
(
self
):
"""Sets up portal_certificate_authority"""
"""Sets up portal_certificate_authority"""
ca_path
=
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
self
.
__class__
.
__name__
)
if
os
.
path
.
exists
(
ca_path
):
shutil
.
rmtree
(
ca_path
)
os
.
mkdir
(
ca_path
)
os
.
mkdir
(
os
.
path
.
join
(
ca_path
,
'private'
))
os
.
mkdir
(
os
.
path
.
join
(
ca_path
,
'crl'
))
os
.
mkdir
(
os
.
path
.
join
(
ca_path
,
'certs'
))
shutil
.
copy
(
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'openssl.cnf'
),
os
.
path
.
join
(
ca_path
,
'openssl.cnf'
))
shutil
.
copy
(
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'cacert.pem'
),
os
.
path
.
join
(
ca_path
,
'cacert.pem'
))
# reset test CA to have it always count from 0
# reset test CA to have it always count from 0
open
(
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'serial'
),
'w'
).
write
(
'01'
)
open
(
os
.
path
.
join
(
ca_path
,
'serial'
),
'w'
).
write
(
'01'
)
open
(
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'crlnumber'
),
'w'
).
write
(
open
(
os
.
path
.
join
(
ca_path
,
'crlnumber'
),
'w'
).
write
(
'01'
)
'01'
)
open
(
os
.
path
.
join
(
ca_path
,
'index.txt'
),
'w'
).
write
(
''
)
open
(
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'index.txt'
),
'w'
).
write
(
''
)
private_list
=
glob
.
glob
(
'%s/*.key'
%
os
.
path
.
join
(
ca_path
,
'private'
))
private_list
=
glob
.
glob
(
'%s/*.key'
%
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'private'
))
for
private
in
private_list
:
for
private
in
private_list
:
os
.
remove
(
private
)
os
.
remove
(
private
)
crl_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'crl'
))
crl_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
ca_path
,
'crl'
))
for
crl
in
crl_list
:
for
crl
in
crl_list
:
os
.
remove
(
crl
)
os
.
remove
(
crl
)
certs_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'certs'
))
certs_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
ca_path
,
'certs'
))
for
cert
in
certs_list
:
for
cert
in
certs_list
:
os
.
remove
(
cert
)
os
.
remove
(
cert
)
newcerts_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
os
.
environ
[
'TEST_CA_PATH'
],
'newcerts'
))
newcerts_list
=
glob
.
glob
(
'%s/*'
%
os
.
path
.
join
(
ca_path
,
'newcerts'
))
for
newcert
in
newcerts_list
:
for
newcert
in
newcerts_list
:
os
.
remove
(
newcert
)
os
.
remove
(
newcert
)
self
.
portal
.
portal_certificate_authority
.
manage_editCertificateAuthorityTool
(
certificate_authority_path
=
ca_path
)
def
setupPortalAlarms
(
self
):
def
setupPortalAlarms
(
self
):
if
not
self
.
portal
.
portal_alarms
.
isSubscribed
():
if
not
self
.
portal
.
portal_alarms
.
isSubscribed
():
...
...
master/tests/__init__.py
View file @
65d5d08a
...
@@ -58,7 +58,3 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite):
...
@@ -58,7 +58,3 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite):
test_list
.
append
(
test_case
)
test_list
.
append
(
test_case
)
return
test_list
return
test_list
def
__init__
(
self
,
max_instance_count
=
1
,
*
args
,
**
kw
):
# hardcode number of node, to prevent concurrency issue on certificate
# authority file system storage
super
(
SlapOSCloud
,
self
).
__init__
(
max_instance_count
=
1
,
*
args
,
**
kw
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment