Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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.core
Commits
083d5998
Commit
083d5998
authored
Feb 06, 2019
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid.promise: do no write execution timestamp if running testless or anomalyless promise
parent
d75813e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
slapos/grid/promise/__init__.py
slapos/grid/promise/__init__.py
+4
-1
slapos/tests/test_promise.py
slapos/tests/test_promise.py
+44
-0
No files found.
slapos/grid/promise/__init__.py
View file @
083d5998
...
@@ -146,7 +146,6 @@ class PromiseProcess(Process):
...
@@ -146,7 +146,6 @@ class PromiseProcess(Process):
"""
"""
try
:
try
:
os
.
chdir
(
self
.
partition_folder
)
os
.
chdir
(
self
.
partition_folder
)
self
.
setPromiseStartTimestamp
()
if
self
.
uid
and
self
.
gid
:
if
self
.
uid
and
self
.
gid
:
dropPrivileges
(
self
.
uid
,
self
.
gid
,
logger
=
self
.
logger
)
dropPrivileges
(
self
.
uid
,
self
.
gid
,
logger
=
self
.
logger
)
...
@@ -157,6 +156,10 @@ class PromiseProcess(Process):
...
@@ -157,6 +156,10 @@ class PromiseProcess(Process):
promise_module
=
self
.
_loadPromiseModule
()
promise_module
=
self
.
_loadPromiseModule
()
promise_instance
=
promise_module
.
RunPromise
(
self
.
argument_dict
)
promise_instance
=
promise_module
.
RunPromise
(
self
.
argument_dict
)
if
(
promise_instance
.
isAnomalyDetected
()
and
self
.
check_anomaly
)
or
\
(
promise_instance
.
isTested
()
and
not
self
.
check_anomaly
):
# if the promise will run, we save execution timestamp
self
.
setPromiseStartTimestamp
()
promise_instance
.
run
(
self
.
check_anomaly
,
self
.
allow_bang
)
promise_instance
.
run
(
self
.
check_anomaly
,
self
.
allow_bang
)
except
Exception
:
except
Exception
:
self
.
logger
.
error
(
traceback
.
format_exc
())
self
.
logger
.
error
(
traceback
.
format_exc
())
...
...
slapos/tests/test_promise.py
View file @
083d5998
...
@@ -1148,6 +1148,50 @@ exit 1
...
@@ -1148,6 +1148,50 @@ exit 1
# promise result is saved
# promise result is saved
self
.
assertTrue
(
self
.
called
)
self
.
assertTrue
(
self
.
called
)
def
test_runpromise_not_tested_will_not_change_periodicity
(
self
):
promise_name
=
'my_promise.py'
def
test_method
(
result
):
self
.
called
=
True
self
.
called
=
False
self
.
configureLauncher
(
save_method
=
test_method
,
timeout
=
5
,
enable_anomaly
=
False
)
self
.
generatePromiseScript
(
promise_name
,
success
=
True
,
periodicity
=
5
,
is_tested
=
False
,)
# will not run the promise in test mode
self
.
launcher
.
run
()
self
.
assertFalse
(
self
.
called
)
self
.
configureLauncher
(
save_method
=
test_method
,
timeout
=
5
,
enable_anomaly
=
True
)
# will not run immediately anomaly
self
.
launcher
.
run
()
# no result returned by the promise
self
.
assertTrue
(
self
.
called
)
def
test_runpromise_without_anomaly_no_change_periodicity
(
self
):
promise_name
=
'my_promise.py'
def
test_method
(
result
):
self
.
called
=
True
self
.
called
=
False
self
.
configureLauncher
(
save_method
=
test_method
,
timeout
=
5
,
enable_anomaly
=
True
)
self
.
generatePromiseScript
(
promise_name
,
success
=
True
,
periodicity
=
5
,
with_anomaly
=
False
,)
# will not run the promise in anomaly mode
self
.
launcher
.
run
()
self
.
assertFalse
(
self
.
called
)
self
.
configureLauncher
(
save_method
=
test_method
,
timeout
=
5
,
enable_anomaly
=
False
)
# will not run immediately anomaly (periodicity didn't change)
self
.
launcher
.
run
()
# no result returned by the promise
self
.
assertTrue
(
self
.
called
)
def
test_runpromise_not_tested_without_anomaly_fail
(
self
):
def
test_runpromise_not_tested_without_anomaly_fail
(
self
):
promise_name
=
'my_promise.py'
promise_name
=
'my_promise.py'
...
...
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