Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
67b4e200
Commit
67b4e200
authored
Nov 03, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
theia/test/{project_tests,test_resiliency}: log output, don't print
and small import cleanups
parent
b33c2ae8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
software/theia/test/project_tests.py
software/theia/test/project_tests.py
+3
-4
software/theia/test/test_resiliency.py
software/theia/test/test_resiliency.py
+16
-8
No files found.
software/theia/test/project_tests.py
View file @
67b4e200
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
from
__future__
import
unicode_literals
import
gzip
import
gzip
import
json
import
json
...
@@ -32,13 +31,12 @@ import os
...
@@ -32,13 +31,12 @@ import os
import
re
import
re
import
subprocess
import
subprocess
import
time
import
time
import
unittest
import
shutil
import
shutil
import
requests
import
requests
import
tempfile
import
tempfile
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
six.moves.
urllib.parse
import
urljoin
from
urllib.parse
import
urljoin
from
mimetypes
import
guess_type
from
mimetypes
import
guess_type
from
json.decoder
import
JSONDecodeError
from
json.decoder
import
JSONDecodeError
...
@@ -448,6 +446,7 @@ class TestTheiaResiliencePeertube(test_resiliency.TestTheiaResilience):
...
@@ -448,6 +446,7 @@ class TestTheiaResiliencePeertube(test_resiliency.TestTheiaResilience):
return
self
.
getPartitionPath
(
return
self
.
getPartitionPath
(
instance_type
,
'srv'
,
'runner'
,
'instance'
,
partition
,
*
paths
)
instance_type
,
'srv'
,
'runner'
,
'instance'
,
partition
,
*
paths
)
class
TestTheiaResilienceGitlab
(
test_resiliency
.
TestTheiaResilience
):
class
TestTheiaResilienceGitlab
(
test_resiliency
.
TestTheiaResilience
):
test_instance_max_retries
=
50
# puma takes time to be ready
test_instance_max_retries
=
50
# puma takes time to be ready
backup_max_tries
=
480
backup_max_tries
=
480
...
@@ -467,7 +466,7 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -467,7 +466,7 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
text
=
True
,
text
=
True
,
)
)
print
(
out
)
self
.
logger
.
info
(
"_getGitlabConnectionParameters output: %s"
,
out
)
return
json
.
loads
(
self
.
_connection_parameters_regex
.
search
(
out
).
group
(
0
).
replace
(
"'"
,
'"'
))
return
json
.
loads
(
self
.
_connection_parameters_regex
.
search
(
out
).
group
(
0
).
replace
(
"'"
,
'"'
))
def
test_twice
(
self
):
def
test_twice
(
self
):
...
...
software/theia/test/test_resiliency.py
View file @
67b4e200
...
@@ -72,34 +72,42 @@ def setUpModule():
...
@@ -72,34 +72,42 @@ def setUpModule():
class
ResilientTheiaTestCase
(
ResilientTheiaMixin
,
TheiaTestCase
):
class
ResilientTheiaTestCase
(
ResilientTheiaMixin
,
TheiaTestCase
):
@
classmethod
@
classmethod
def
_processEmbeddedInstance
(
cls
,
retries
=
0
,
instance_type
=
'export'
):
def
_processEmbeddedInstance
(
cls
,
retries
=
0
,
instance_type
=
'export'
):
for
_
in
range
(
retries
):
for
retry
in
range
(
retries
):
try
:
try
:
output
=
cls
.
captureSlapos
(
'node'
,
'instance'
,
instance_type
=
instance_type
,
stderr
=
subprocess
.
STDOUT
)
output
=
cls
.
captureSlapos
(
'node'
,
'instance'
,
instance_type
=
instance_type
,
stderr
=
subprocess
.
STDOUT
,
text
=
True
)
except
subprocess
.
CalledProcessError
:
except
subprocess
.
CalledProcessError
:
continue
continue
print
(
output
)
cls
.
logger
.
info
(
"_processEmbeddedInstance retry=%s output=%s"
,
retry
,
output
)
break
break
else
:
else
:
if
retries
:
if
retries
:
# Sleep a bit as an attempt to workaround monitoring boostrap not being ready
# Sleep a bit as an attempt to workaround monitoring boostrap not being ready
print
(
"Wait before running slapos node instance one last time"
)
print
(
"Wait before running slapos node instance one last time"
)
time
.
sleep
(
120
)
time
.
sleep
(
120
)
cls
.
checkSlapos
(
'node'
,
'instance'
,
instance_type
=
instance_type
)
try
:
cls
.
checkSlapos
(
'node'
,
'instance'
,
instance_type
=
instance_type
,
text
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
cls
.
logger
.
error
(
e
.
output
,
exc_info
=
True
)
raise
@
classmethod
@
classmethod
def
_processEmbeddedSoftware
(
cls
,
retries
=
0
,
instance_type
=
'export'
):
def
_processEmbeddedSoftware
(
cls
,
retries
=
0
,
instance_type
=
'export'
):
for
_
in
range
(
retries
):
for
retry
in
range
(
retries
):
try
:
try
:
output
=
cls
.
captureSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
,
stderr
=
subprocess
.
STDOUT
)
output
=
cls
.
captureSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
,
stderr
=
subprocess
.
STDOUT
,
text
=
True
)
except
subprocess
.
CalledProcessError
:
except
subprocess
.
CalledProcessError
:
continue
continue
print
(
output
)
cls
.
logger
.
info
(
"_processEmbeddedSoftware retry=%s output=%s"
,
retry
,
output
)
break
break
else
:
else
:
if
retries
:
if
retries
:
print
(
"Wait before running slapos node software one last time"
)
print
(
"Wait before running slapos node software one last time"
)
time
.
sleep
(
120
)
time
.
sleep
(
120
)
cls
.
checkSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
)
try
:
cls
.
checkSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
,
text
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
cls
.
logger
.
error
(
e
.
output
,
exc_info
=
True
)
raise
@
classmethod
@
classmethod
def
_deployEmbeddedSoftware
(
cls
,
software_url
,
instance_name
,
retries
=
0
,
instance_type
=
'export'
):
def
_deployEmbeddedSoftware
(
cls
,
software_url
,
instance_name
,
retries
=
0
,
instance_type
=
'export'
):
...
...
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