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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.toolbox
Commits
bd2edb77
Commit
bd2edb77
authored
Aug 25, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner resiliencytest: update script to match changes on recovery-code
parent
f660bb5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
36 deletions
+11
-36
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+11
-36
No files found.
slapos/resiliencytest/suites/slaprunner.py
View file @
bd2edb77
...
@@ -148,6 +148,9 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -148,6 +148,9 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
while
limit
>
0
and
status
!=
'1'
:
while
limit
>
0
and
status
!=
'1'
:
status
=
getSRStatus
()
status
=
getSRStatus
()
limit
-=
1
limit
-=
1
if
status
==
'0'
:
self
.
logger
.
info
(
'Software release is Failing to Build. Sleeping...'
)
else
:
self
.
logger
.
info
(
'Software release is still building. Sleeping...'
)
self
.
logger
.
info
(
'Software release is still building. Sleeping...'
)
time
.
sleep
(
60
)
time
.
sleep
(
60
)
...
@@ -197,28 +200,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -197,28 +200,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
data
=
'path=workspace/slapos/software/%s/'
%
software_name
data
=
'path=workspace/slapos/software/%s/'
%
software_name
)
)
def
_getRcode
(
self
):
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
monitoring_password
=
"insecure"
monitor_url
=
self
.
monitor_url
+
"/private/monitor.global.json"
monitor_url
=
monitor_url
.
replace
(
'https://'
,
'https://admin:%s@'
%
monitoring_password
)
result
=
urllib
.
urlopen
(
monitor_url
)
if
result
.
getcode
()
is
not
200
:
raise
NotHttpOkException
(
result
.
getcode
())
monitor_json
=
json
.
loads
(
result
.
read
())
for
parameter
in
monitor_json
[
'parameters'
]:
if
parameter
[
'title'
]
==
'recovery-code'
:
return
parameter
[
'value'
]
def
generateData
(
self
):
def
generateData
(
self
):
self
.
slaprunner_password
=
''
.
join
(
"""
random
.
SystemRandom
().
sample
(
string
.
ascii_lowercase
,
8
)
Generate Data for slaprunner
)
"""
self
.
slaprunner_user
=
'slapos'
self
.
logger
.
info
(
'Generated slaprunner user is: %s'
%
self
.
slaprunner_user
)
self
.
logger
.
info
(
'Generated slaprunner password is: %s'
%
self
.
slaprunner_password
)
def
pushDataOnMainInstance
(
self
):
def
pushDataOnMainInstance
(
self
):
"""
"""
...
@@ -231,20 +216,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -231,20 +216,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
"""
"""
self
.
logger
.
debug
(
'Getting the backend URL and recovery code...'
)
self
.
logger
.
debug
(
'Getting the backend URL and recovery code...'
)
parameter_dict
=
self
.
_getPartitionParameterDict
()
parameter_dict
=
self
.
_getPartitionParameterDict
()
self
.
slaprunner_backend_url
=
parameter_dict
[
'backend
_
url'
]
self
.
slaprunner_backend_url
=
parameter_dict
[
'backend
-
url'
]
self
.
logger
.
info
(
'backend_url is %s.'
%
self
.
slaprunner_backend_url
)
self
.
logger
.
info
(
'backend_url is %s.'
%
self
.
slaprunner_backend_url
)
self
.
monitor_url
=
parameter_dict
[
'monitor-base-url'
]
self
.
slaprunner_user
=
parameter_dict
[
'init-user'
]
slaprunner_recovery_code
=
self
.
_getRcode
()
self
.
slaprunner_password
=
parameter_dict
[
'init-password'
]
self
.
logger
.
debug
(
'Creating the slaprunner account...'
)
self
.
_connectToSlaprunner
(
resource
=
'configAccount'
,
data
=
'name=slapos&username=%s&email=slapos@slapos.org&password=%s&rcode=%s'
%
(
self
.
slaprunner_user
,
self
.
slaprunner_password
,
slaprunner_recovery_code
)
)
self
.
_login
()
self
.
_login
()
...
@@ -269,7 +244,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
...
@@ -269,7 +244,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
# XXX: does the promise wait for the software to be built and the instance to be ready?
# XXX: does the promise wait for the software to be built and the instance to be ready?
old_slaprunner_backend_url
=
self
.
slaprunner_backend_url
old_slaprunner_backend_url
=
self
.
slaprunner_backend_url
self
.
slaprunner_backend_url
=
self
.
_returnNewInstanceParameter
(
self
.
slaprunner_backend_url
=
self
.
_returnNewInstanceParameter
(
parameter_key
=
'backend
_
url'
,
parameter_key
=
'backend
-
url'
,
old_parameter_value
=
old_slaprunner_backend_url
old_parameter_value
=
old_slaprunner_backend_url
)
)
self
.
_login
()
self
.
_login
()
...
...
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