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
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
Commits
95afd1c9
Commit
95afd1c9
authored
Jul 01, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: Add resilient instantiation tests
parent
ae63fd23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
12 deletions
+64
-12
software/theia/test/test.py
software/theia/test/test.py
+64
-12
No files found.
software/theia/test/test.py
View file @
95afd1c9
...
@@ -26,31 +26,28 @@
...
@@ -26,31 +26,28 @@
##############################################################################
##############################################################################
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
os
import
json
import
textwrap
import
logging
import
logging
import
os
import
re
import
subprocess
import
subprocess
import
tempfile
import
time
import
time
import
re
import
json
from
six.moves.urllib.parse
import
urlparse
,
urljoin
import
pexpect
import
pexpect
import
psutil
import
psutil
import
requests
import
requests
import
sqlite3
import
six
import
six
from
six.moves.urllib.parse
import
urlparse
,
urljoin
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.grid.svcbackend
import
getSupervisorRPC
from
slapos.grid.svcbackend
import
getSupervisorRPC
,
_getSupervisordSocketPath
from
slapos.grid.svcbackend
import
_getSupervisordSocketPath
software_cfg
=
'software%s.cfg'
%
(
'-py3'
if
six
.
PY3
else
''
)
software_cfg
=
'software%s.cfg'
%
(
'-py3'
if
six
.
PY3
else
''
)
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
theia_software_release_url
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
software_cfg
))
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
software_cfg
))
)
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
theia_software_release_url
)
class
TheiaTestCase
(
SlapOSInstanceTestCase
):
class
TheiaTestCase
(
SlapOSInstanceTestCase
):
...
@@ -352,3 +349,58 @@ class TestTheiaEnv(TheiaTestCase):
...
@@ -352,3 +349,58 @@ class TestTheiaEnv(TheiaTestCase):
# Cleanup the theia shell process
# Cleanup the theia shell process
theia_shell_process
.
terminate
()
theia_shell_process
.
terminate
()
theia_shell_process
.
wait
()
theia_shell_process
.
wait
()
class
ResilientTheiaMixin
(
object
):
@
classmethod
def
setUpClass
(
cls
):
super
(
ResilientTheiaMixin
,
cls
).
setUpClass
()
# Add resiliency files to snapshot patterns
cls
.
_save_instance_file_pattern_list
+=
(
'*/srv/export-exitcode-file'
,
'*/srv/export-errormessage-file'
,
'*/srv/import-exitcode-file'
,
'*/srv/import-errormessage-file'
,
)
@
classmethod
def
_getPartition
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
for
computer_partition
in
cls
.
slap
.
computer
.
getComputerPartitionList
():
partition_url
=
computer_partition
.
getSoftwareRelease
().
_software_release
partition_type
=
computer_partition
.
getType
()
if
partition_url
==
software_url
and
partition_type
==
software_type
:
return
computer_partition
raise
Exception
(
"Theia %s partition not found"
%
software_type
)
@
classmethod
def
_getPartitionId
(
cls
,
software_type
):
return
cls
.
_getPartition
(
software_type
).
getId
()
@
classmethod
def
_getPartitionPath
(
cls
,
software_type
,
*
paths
):
return
os
.
path
.
join
(
cls
.
slap
.
_instance_root
,
cls
.
_getPartitionId
(
software_type
),
*
paths
)
@
classmethod
def
_getSlapos
(
cls
,
software_type
=
'export'
):
return
cls
.
_getPartitionPath
(
software_type
,
'srv'
,
'runner'
,
'bin'
,
'slapos'
)
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'resilient'
class
TestTheiaResilientInterface
(
ResilientTheiaMixin
,
TestTheia
):
@
classmethod
def
setUpClass
(
cls
):
super
(
TestTheiaResilientInterface
,
cls
).
setUpClass
()
# Patch the computer root path to that of the export theia instance
cls
.
computer_partition_root_path
=
cls
.
_getPartitionPath
(
'export'
)
class
TestTheiaResilientWithSR
(
ResilientTheiaMixin
,
TestTheiaWithSR
):
@
classmethod
def
setUpClass
(
cls
):
super
(
TestTheiaResilientWithSR
,
cls
).
setUpClass
()
# Patch the computer root path to that of the export theia instance
cls
.
computer_partition_root_path
=
cls
.
_getPartitionPath
(
'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