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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.toolbox
Commits
a2da4fde
Commit
a2da4fde
authored
Nov 20, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm resiliency test suite: adapt for erp5testnode.
parent
47ef1360
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
slapos/resiliencytest/__init__.py
slapos/resiliencytest/__init__.py
+2
-0
slapos/resiliencytest/suites/kvm.py
slapos/resiliencytest/suites/kvm.py
+35
-9
No files found.
slapos/resiliencytest/__init__.py
View file @
a2da4fde
...
...
@@ -241,6 +241,8 @@ def runUnitTest():
test_line
=
test_result
.
start
()
start_time
=
time
.
time
()
args
.
additional_arguments
.
append
(
'type=UnitTest'
)
success
=
runTestSuite
(
args
.
test_suite
,
args
.
additional_arguments
,
...
...
slapos/resiliencytest/suites/kvm.py
View file @
a2da4fde
...
...
@@ -35,9 +35,13 @@ from slapos.recipe.addresiliency.takeover import takeover
import
slapos.slap
import
logging
import
os
import
random
import
string
import
subprocess
import
sys
import
time
import
traceback
import
urllib
logger
=
logging
.
getLogger
(
'KVMResiliencyTest'
)
...
...
@@ -45,6 +49,8 @@ logger = logging.getLogger('KVMResiliencyTest')
# Wait for 2 hours before renaming, so that replication of data is done
# (~1GB of data to backup)
SLEEP_TIME
=
2
*
60
*
60
# In case of unittest testnode (not scalability testnode), everything is local
UNIT_TEST_SLEEP_TYPE
=
900
def
fetchMainInstanceIP
(
current_partition
,
software_release
,
instance_name
):
return
current_partition
.
request
(
...
...
@@ -97,7 +103,8 @@ def runTestSuite(server_url, key_file, cert_file,
computer_id
,
partition_id
,
software
,
namebase
,
kvm_rootinstance_name
,
# Number of instances: main instance (exporter) + clones (importer).
total_instance_count
=
"3"
):
total_instance_count
=
"3"
,
type
=
None
):
"""
Run KVM Resiliency Test.
Requires a specific KVM environment (virtual hard drive), see KVM SR for more
...
...
@@ -187,6 +194,8 @@ def runTestSuite(server_url, key_file, cert_file,
key
=
setRandomKey
(
ip
)
logger
.
info
(
'Key set for test in current KVM: %s.'
%
key
)
if
type
==
'UnitTest'
:
SLEEP_TIME
=
UNIT_TEST_SLEEP_TYPE
logger
.
info
(
'Sleeping for %s seconds.'
%
SLEEP_TIME
)
time
.
sleep
(
SLEEP_TIME
)
...
...
@@ -213,14 +222,31 @@ def runTestSuite(server_url, key_file, cert_file,
time
.
sleep
(
10
)
logger
.
info
(
'Done.'
)
# Wait for the new IP (of old-clone new-main instance) to appear.
logger
.
info
(
'Waiting for new main instance to be ready...'
)
new_ip
=
None
while
not
new_ip
or
new_ip
==
'None'
or
new_ip
==
ip
:
logger
.
info
(
'Not ready yet. SlapOS says main IP is %s'
%
new_ip
)
time
.
sleep
(
60
)
new_ip
=
fetchMainInstanceIP
(
partition
,
software
,
kvm_rootinstance_name
)
logger
.
info
(
'New IP of instance is %s'
%
new_ip
)
if
type
==
'UnitTest'
:
# Run by classical erp5testnode using slapproxy
# Run slapos node instance
# XXX hardcoded
slapos_configuration_file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
'..'
,
'..'
,
'..'
,
'slapos.cfg'
)
print
slapos_configuration_file_path
command
=
[
'/opt/slapos/bin/slapos'
,
'node'
,
'instance'
,
'--cfg=%s'
%
slapos_configuration_file_path
,
'--pidfile=slapos.pid'
]
subprocess
.
Popen
(
command
).
wait
()
subprocess
.
Popen
(
command
).
wait
()
subprocess
.
Popen
(
command
).
wait
()
new_ip
=
ip
else
:
# ScalabilityTest
# Wait for the new IP (of old-clone new-main instance) to appear.
logger
.
info
(
'Waiting for new main instance to be ready...'
)
new_ip
=
None
while
not
new_ip
or
new_ip
==
'None'
or
new_ip
==
ip
:
logger
.
info
(
'Not ready yet. SlapOS says main IP is %s'
%
new_ip
)
time
.
sleep
(
60
)
new_ip
=
fetchMainInstanceIP
(
partition
,
software
,
kvm_rootinstance_name
)
logger
.
info
(
'New IP of instance is %s'
%
new_ip
)
new_key
=
fetchKey
(
new_ip
)
logger
.
info
(
'Key on this new instance is %s'
%
new_key
)
...
...
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