Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Guillaume Hervier
slapos.toolbox
Commits
beb86eab
Commit
beb86eab
authored
Nov 30, 2017
by
Hardik Juneja
Committed by
Rafael Monnerat
Dec 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resiliency Tests: Catch errors while requesting to webrunner and Fix tests
/reviewed-on
!24
parent
2e1df74e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
slapos/resiliencytest/__init__.py
slapos/resiliencytest/__init__.py
+1
-1
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+14
-4
No files found.
slapos/resiliencytest/__init__.py
View file @
beb86eab
...
@@ -88,7 +88,7 @@ def parseArguments():
...
@@ -88,7 +88,7 @@ def parseArguments():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
setupLogging
(
log_path
=
None
,
name
=
__name__
):
def
setupLogging
(
name
=
__name__
,
log_path
=
None
):
logger_format
=
'%(asctime)s %(name)-13s: %(levelname)-8s %(message)s'
logger_format
=
'%(asctime)s %(name)-13s: %(levelname)-8s %(message)s'
formatter
=
logging
.
Formatter
(
logger_format
)
formatter
=
logging
.
Formatter
(
logger_format
)
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
logger_format
)
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
logger_format
)
...
...
slapos/resiliencytest/suites/slaprunner.py
View file @
beb86eab
...
@@ -111,7 +111,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -111,7 +111,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
data
=
"file=instance_root/slappart0/var/log/log.log"
data
=
"file=instance_root/slappart0/var/log/log.log"
)
)
try
:
try
:
data
=
json
.
loads
(
data
)[
'result'
]
json_data
=
json
.
loads
(
data
)
if
json_data
[
'code'
]
is
0
:
raise
IOError
(
data
[
'result'
])
data
=
json_data
[
'result'
]
self
.
logger
.
info
(
'Retrieved data are:
\
n
%s'
%
data
)
self
.
logger
.
info
(
'Retrieved data are:
\
n
%s'
%
data
)
except
(
ValueError
,
KeyError
):
except
(
ValueError
,
KeyError
):
if
data
.
find
(
'<'
)
is
not
-
1
:
if
data
.
find
(
'<'
)
is
not
-
1
:
...
@@ -134,7 +137,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -134,7 +137,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
"""
"""
data
=
self
.
_connectToSlaprunner
(
data
=
self
.
_connectToSlaprunner
(
resource
=
'getFileLog'
,
resource
=
'getFileLog'
,
data
=
"filename=software.log&truncate=%s"
%
truncate
)
data
=
"filename=
instance_root/../
software.log&truncate=%s"
%
truncate
)
try
:
try
:
data
=
json
.
loads
(
data
)[
'result'
]
data
=
json
.
loads
(
data
)[
'result'
]
self
.
logger
.
info
(
'Tail of software.log:
\
n
%s'
%
data
)
self
.
logger
.
info
(
'Tail of software.log:
\
n
%s'
%
data
)
...
@@ -199,10 +202,14 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -199,10 +202,14 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def
_gitClone
(
self
):
def
_gitClone
(
self
):
self
.
logger
.
debug
(
'Doing git clone of https://lab.nexedi.com/nexedi/slapos.git..'
)
self
.
logger
.
debug
(
'Doing git clone of https://lab.nexedi.com/nexedi/slapos.git..'
)
try
:
try
:
self
.
_connectToSlaprunner
(
data
=
self
.
_connectToSlaprunner
(
resource
=
'cloneRepository'
,
resource
=
'cloneRepository'
,
data
=
'repo=https://lab.nexedi.com/nexedi/slapos.git&name=workspace/slapos&email=slapos@slapos.org&user=slapos'
data
=
'repo=https://lab.nexedi.com/nexedi/slapos.git&name=workspace/slapos&email=slapos@slapos.org&user=slapos'
)
)
data
=
json
.
loads
(
data
)
if
data
[
'code'
]
is
0
:
self
.
logger
.
warning
(
data
[
'result'
])
except
(
NotHttpOkException
,
urllib2
.
HTTPError
):
except
(
NotHttpOkException
,
urllib2
.
HTTPError
):
# cloning can be very long.
# cloning can be very long.
# XXX: quite dirty way to check.
# XXX: quite dirty way to check.
...
@@ -211,10 +218,13 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -211,10 +218,13 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def
_openSoftwareRelease
(
self
,
software_release
=
'erp5testnode/testsuite/dummy'
):
def
_openSoftwareRelease
(
self
,
software_release
=
'erp5testnode/testsuite/dummy'
):
self
.
logger
.
debug
(
'Opening %s software release...'
%
software_release
)
self
.
logger
.
debug
(
'Opening %s software release...'
%
software_release
)
self
.
_connectToSlaprunner
(
data
=
self
.
_connectToSlaprunner
(
resource
=
'setCurrentProject'
,
resource
=
'setCurrentProject'
,
data
=
'path=workspace/slapos/software/%s/'
%
software_release
data
=
'path=workspace/slapos/software/%s/'
%
software_release
)
)
if
json
.
loads
(
data
)[
'code'
]
is
0
:
self
.
logger
.
warning
(
data
[
'result'
])
raise
IOError
(
data
[
'result'
])
def
generateData
(
self
):
def
generateData
(
self
):
"""
"""
...
...
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