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
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
e95f1e0c
Commit
e95f1e0c
authored
May 17, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: Add resiliency test
Test that takeover of theia with an initial embedded instance succeeds.
parent
1aa17677
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
software/theia/test/test.py
software/theia/test/test.py
+4
-0
software/theia/test/test_resiliency.py
software/theia/test/test_resiliency.py
+51
-2
No files found.
software/theia/test/test.py
View file @
e95f1e0c
...
...
@@ -538,6 +538,10 @@ class ResilientTheiaMixin(object):
def
getPartitionPath
(
cls
,
instance_type
=
'export'
,
*
paths
):
return
os
.
path
.
join
(
cls
.
slap
.
_instance_root
,
cls
.
getPartitionId
(
instance_type
),
*
paths
)
@
classmethod
def
getPath
(
cls
,
*
components
):
# patch getPath
return
cls
.
getPartitionPath
(
'export'
,
*
components
)
@
classmethod
def
_getSlapos
(
cls
,
instance_type
=
'export'
):
return
cls
.
getPartitionPath
(
instance_type
,
'srv'
,
'runner'
,
'bin'
,
'slapos'
)
...
...
software/theia/test/test_resiliency.py
View file @
e95f1e0c
...
...
@@ -27,6 +27,7 @@
from
__future__
import
unicode_literals
import
errno
import
json
import
os
import
re
import
shutil
...
...
@@ -38,11 +39,15 @@ import requests
from
slapos.proxy.db_version
import
DB_VERSION
from
slapos.slap.slap
import
DEFAULT_SOFTWARE_TYPE
from
slapos.testing.testcase
import
SlapOSNodeCommandError
,
installSoftwareUrlList
import
test
from
test
import
TheiaTestCase
,
ResilientTheiaMixin
,
theia_software_release_url
dummy_software_url
=
os
.
path
.
abspath
(
os
.
path
.
join
(
'resilience_dummy'
,
'software.cfg'
))
...
...
@@ -82,8 +87,7 @@ class ResilientTheiaTestCase(ResilientTheiaMixin, TheiaTestCase):
cls
.
checkSlapos
(
'node'
,
'instance'
,
instance_type
=
instance_type
)
@
classmethod
def
_deployEmbeddedSoftware
(
cls
,
software_url
,
instance_name
,
retries
=
0
,
instance_type
=
'export'
):
cls
.
callSlapos
(
'supply'
,
software_url
,
'slaprunner'
,
instance_type
=
instance_type
)
def
_processEmbeddedSoftware
(
cls
,
retries
=
0
,
instance_type
=
'export'
):
for
_
in
range
(
retries
):
try
:
output
=
cls
.
captureSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
,
stderr
=
subprocess
.
STDOUT
)
...
...
@@ -96,6 +100,11 @@ class ResilientTheiaTestCase(ResilientTheiaMixin, TheiaTestCase):
print
(
"Wait before running slapos node software one last time"
)
time
.
sleep
(
120
)
cls
.
checkSlapos
(
'node'
,
'software'
,
instance_type
=
instance_type
)
@
classmethod
def
_deployEmbeddedSoftware
(
cls
,
software_url
,
instance_name
,
retries
=
0
,
instance_type
=
'export'
):
cls
.
callSlapos
(
'supply'
,
software_url
,
'slaprunner'
,
instance_type
=
instance_type
)
cls
.
_processEmbeddedSoftware
(
retries
,
instance_type
)
cls
.
callSlapos
(
'request'
,
instance_name
,
software_url
,
instance_type
=
instance_type
)
cls
.
_processEmbeddedInstance
(
retries
,
instance_type
)
...
...
@@ -602,3 +611,43 @@ class TestTheiaFrontendForwarding(TheiaSyncMixin, ResilientTheiaTestCase):
def
_doTakeover
(
self
):
# do nothing
pass
class
TestTheiaResilienceWithInitialInstance
(
TestTheiaResilience
,
test
.
TestTheiaWithEmbeddedInstance
):
backup_max_tries
=
70
backup_wait_interval
=
10
sr_url
=
dummy_software_url
sr_type
=
DEFAULT_SOFTWARE_TYPE
sr_config
=
{}
@
classmethod
def
getInstanceParameterDict
(
cls
,
sr_url
=
None
,
sr_type
=
None
,
sr_config
=
None
):
d
=
test
.
TestTheiaWithEmbeddedInstance
.
getInstanceParameterDict
.
__func__
(
cls
,
sr_url
,
sr_type
,
sr_config
)
d
.
update
(
autorun
=
'stopped'
)
return
d
def
_prepareExport
(
self
):
# Check that there is an export and import instance and get their partition IDs
self
.
export_id
=
self
.
getPartitionId
(
'export'
)
self
.
import_id
=
self
.
getPartitionId
(
'import'
)
# Remember content of ~/etc in the import theia
self
.
etc_listdir
=
os
.
listdir
(
self
.
getPartitionPath
(
'import'
,
'etc'
))
# Check initial embedded instance
test
.
TestTheiaWithEmbeddedInstance
.
test
(
self
)
self
.
_processEmbeddedSoftware
()
self
.
_processEmbeddedInstance
()
def
_checkTakeover
(
self
):
# Check takeover
TestTheiaResilience
.
_checkTakeover
(
self
)
# Check that embedded instance still exists
test
.
TestTheiaWithEmbeddedInstance
.
test
(
self
)
self
.
_processEmbeddedSoftware
()
self
.
_processEmbeddedInstance
()
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