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
7
Merge Requests
7
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
nexedi
slapos.toolbox
Commits
6cf02ddb
Commit
6cf02ddb
authored
Nov 21, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm resiliency test: test two times the takeover if we have only one clone.
parent
a2da4fde
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
79 deletions
+93
-79
slapos/resiliencytest/suites/kvm.py
slapos/resiliencytest/suites/kvm.py
+93
-79
No files found.
slapos/resiliencytest/suites/kvm.py
View file @
6cf02ddb
...
@@ -103,7 +103,7 @@ def runTestSuite(server_url, key_file, cert_file,
...
@@ -103,7 +103,7 @@ def runTestSuite(server_url, key_file, cert_file,
computer_id
,
partition_id
,
software
,
computer_id
,
partition_id
,
software
,
namebase
,
kvm_rootinstance_name
,
namebase
,
kvm_rootinstance_name
,
# Number of instances: main instance (exporter) + clones (importer).
# Number of instances: main instance (exporter) + clones (importer).
total_instance_count
=
"
3
"
,
total_instance_count
=
"
2
"
,
type
=
None
):
type
=
None
):
"""
"""
Run KVM Resiliency Test.
Run KVM Resiliency Test.
...
@@ -171,6 +171,10 @@ def runTestSuite(server_url, key_file, cert_file,
...
@@ -171,6 +171,10 @@ def runTestSuite(server_url, key_file, cert_file,
update-rc.d io defaults
update-rc.d io defaults
"""
"""
if
type
==
'UnitTest'
:
global
SLEEP_TIME
SLEEP_TIME
=
UNIT_TEST_SLEEP_TYPE
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
slap
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
slap
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
partition
=
slap
.
registerComputerPartition
(
partition
=
slap
.
registerComputerPartition
(
...
@@ -184,18 +188,33 @@ def runTestSuite(server_url, key_file, cert_file,
...
@@ -184,18 +188,33 @@ def runTestSuite(server_url, key_file, cert_file,
# In resilient stack, main instance (example with KVM) is named "kvm0",
# In resilient stack, main instance (example with KVM) is named "kvm0",
# clones are named "kvm1", "kvm2", ...
# clones are named "kvm1", "kvm2", ...
clone_count
=
int
(
total_instance_count
)
-
1
clone_count
=
int
(
total_instance_count
)
-
1
# In case we have only one clone: test the takeover twice
# so that we test the reconstruction of a new clone.
if
clone_count
==
1
:
for
i
in
range
(
2
):
ip
=
testClone
(
1
,
ip
,
server_url
,
key_file
,
cert_file
,
computer_id
,
partition_id
,
software
,
namebase
,
partition
,
kvm_rootinstance_name
,
type
)
# In case we have more than one clone: test each clone one time.
else
:
# So first clone starts from 1.
# So first clone starts from 1.
current_clone
=
1
current_clone
=
1
# Test each clone
while
current_clone
<=
clone_count
:
while
current_clone
<=
clone_count
:
ip
=
testClone
(
current_clone
,
ip
,
server_url
,
key_file
,
cert_file
,
computer_id
,
partition_id
,
software
,
namebase
,
partition
,
kvm_rootinstance_name
,
type
)
current_clone
=
current_clone
+
1
# All clones have been successfully tested: success.
return
True
def
testClone
(
current_clone
,
ip
,
server_url
,
key_file
,
cert_file
,
computer_id
,
partition_id
,
software
,
namebase
,
partition
,
kvm_rootinstance_name
,
test_type
):
logger
.
info
(
'Testing kvm%s.'
%
current_clone
)
logger
.
info
(
'Testing kvm%s.'
%
current_clone
)
key
=
setRandomKey
(
ip
)
key
=
setRandomKey
(
ip
)
logger
.
info
(
'Key set for test in current KVM: %s.'
%
key
)
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
)
logger
.
info
(
'Sleeping for %s seconds.'
%
SLEEP_TIME
)
time
.
sleep
(
SLEEP_TIME
)
time
.
sleep
(
SLEEP_TIME
)
...
@@ -222,7 +241,7 @@ def runTestSuite(server_url, key_file, cert_file,
...
@@ -222,7 +241,7 @@ def runTestSuite(server_url, key_file, cert_file,
time
.
sleep
(
10
)
time
.
sleep
(
10
)
logger
.
info
(
'Done.'
)
logger
.
info
(
'Done.'
)
if
type
==
'UnitTest'
:
# Run by classical erp5testnode using slapproxy
if
test_
type
==
'UnitTest'
:
# Run by classical erp5testnode using slapproxy
# Run slapos node instance
# Run slapos node instance
# XXX hardcoded
# XXX hardcoded
slapos_configuration_file_path
=
os
.
path
.
join
(
slapos_configuration_file_path
=
os
.
path
.
join
(
...
@@ -260,9 +279,4 @@ def runTestSuite(server_url, key_file, cert_file,
...
@@ -260,9 +279,4 @@ def runTestSuite(server_url, key_file, cert_file,
# Setup "new old ip" for next clone, so that it will test it is different
# Setup "new old ip" for next clone, so that it will test it is different
# from current clone
# from current clone
ip
=
new_ip
return
new_ip
current_clone
=
current_clone
+
1
# All clones have been successfully tested: success.
return
True
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