Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
1c492ab2
Commit
1c492ab2
authored
Apr 01, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos-master/test: use slapos.testing
/reviewed-on
nexedi/slapos!635
parent
e1e605bd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
361 deletions
+29
-361
software/slapos-master/test/README.md
software/slapos-master/test/README.md
+1
-1
software/slapos-master/test/test/__init__.py
software/slapos-master/test/test/__init__.py
+18
-9
software/slapos-master/test/test/test_erp5.py
software/slapos-master/test/test/test_erp5.py
+10
-20
software/slapos-master/test/utils.py
software/slapos-master/test/utils.py
+0
-331
No files found.
software/slapos-master/test/README.md
View file @
1c492ab2
Tests for
ERP5
software release
Tests for
Slapos Master
software release
software/slapos-master/test/test/__init__.py
View file @
1c492ab2
...
...
@@ -25,15 +25,24 @@
#
##############################################################################
import
json
import
os
import
unittest
import
logging
if
os
.
environ
.
get
(
'DEBUG'
):
raise
ValueError
(
"Don't set DEBUG - it breaks postfix compilation - set SLAPOS_TEST_DEBUG instead."
)
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
debug_mode
=
os
.
environ
.
get
(
'SLAPOS_TEST_DEBUG'
)
# for development: debugging logs and install Ctrl+C handler
if
debug_mode
:
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
unittest
.
installHandler
()
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
,
'software.cfg'
)))
class
ERP5InstanceTestCase
(
SlapOSInstanceTestCase
):
"""ERP5 base test case
"""
# ERP5 instanciation needs to run several times before being ready, as
# the root instance request more instances.
instance_max_retry
=
7
# XXX how many times ?
def
getRootPartitionConnectionParameterDict
(
self
):
"""Return the output paramters from the root partition"""
return
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
])
software/slapos-master/test/test/test_erp5.py
View file @
1c492ab2
...
...
@@ -29,26 +29,15 @@ import os
import
json
import
glob
import
urlparse
import
logging
import
socket
import
time
import
psutil
import
requests
from
utils
import
SlapOSInstanceTestCase
class
ERP5TestCase
(
SlapOSInstanceTestCase
):
"""Test the remote driver on a minimal web server.
"""
logger
=
logging
.
getLogger
(
__name__
)
@
classmethod
def
getSoftwareURLList
(
cls
):
return
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
,
'software.cfg'
)),
)
def
getRootPartitionConnectionParameterDict
(
self
):
"""Return the output paramters from the root partition"""
return
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
])
from
.
import
ERP5InstanceTestCase
from
.
import
setUpModule
setUpModule
# pyflakes
class
TestPublishedURLIsReachableMixin
(
object
):
...
...
@@ -61,9 +50,10 @@ class TestPublishedURLIsReachableMixin(object):
# with 503 Service Unavailable.
# If we can move the "create site" in slapos node instance, then this retry loop
# would not be necessary.
for
i
in
range
(
1
,
2
0
):
for
i
in
range
(
1
,
6
0
):
r
=
requests
.
get
(
url
,
verify
=
False
)
# XXX can we get CA from caucase already ?
if
r
.
status_code
==
requests
.
codes
.
service_unavailable
:
if
r
.
status_code
in
(
requests
.
codes
.
service_unavailable
,
requests
.
codes
.
not_found
):
delay
=
i
*
2
self
.
logger
.
warn
(
"ERP5 was not available, sleeping for %ds and retrying"
,
delay
)
time
.
sleep
(
delay
)
...
...
@@ -89,13 +79,13 @@ class TestPublishedURLIsReachableMixin(object):
urlparse
.
urljoin
(
param_dict
[
'family-default'
],
param_dict
[
'site-id'
]))
class
TestDefaultParameters
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
class
TestDefaultParameters
(
ERP5
Instance
TestCase
,
TestPublishedURLIsReachableMixin
):
"""Test ERP5 can be instanciated with no parameters
"""
__partition_reference__
=
'defp'
class
TestDisableTestRunner
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
class
TestDisableTestRunner
(
ERP5
Instance
TestCase
,
TestPublishedURLIsReachableMixin
):
"""Test ERP5 can be instanciated without test runner.
"""
__partition_reference__
=
'distr'
...
...
software/slapos-master/test/utils.py
deleted
100644 → 0
View file @
e1e605bd
This diff is collapsed.
Click to expand it.
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