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
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
2048688b
Commit
2048688b
authored
Nov 15, 2019
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: Increase default promise timeout to 20 s
It is the most used value in most scenarios.
parent
4b1de2dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+1
-1
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+8
-8
No files found.
slapos/grid/slapgrid.py
View file @
2048688b
...
...
@@ -79,7 +79,7 @@ COMPUTER_PARTITION_STOPPED_STATE = 'stopped'
SLAPGRID_SUCCESS
=
0
SLAPGRID_FAIL
=
1
SLAPGRID_PROMISE_FAIL
=
2
PROMISE_TIMEOUT
=
3
PROMISE_TIMEOUT
=
20
COMPUTER_PARTITION_TIMESTAMP_FILENAME
=
'.timestamp'
COMPUTER_PARTITION_LATEST_BANG_TIMESTAMP_FILENAME
=
'.slapos_latest_bang_timestamp'
...
...
slapos/tests/test_slapgrid.py
View file @
2048688b
...
...
@@ -2040,7 +2040,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
f
.
write
(
textwrap
.
dedent
(
"""
\
#!/usr/bin/env sh
touch "%s"
sleep 5
sleep
2
5
exit 0"""
%
worked_file
))
os
.
chmod
(
succeed
,
0o777
)
self
.
assertEqual
(
self
.
grid
.
processComputerPartitionList
(),
...
...
@@ -2114,7 +2114,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
then
touch "%(lockfile)s"
else
sleep 5
sleep
2
5
fi
exit 0"""
%
{
'worked_file'
:
worked_file
,
...
...
@@ -3261,7 +3261,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
f.write(textwrap.dedent("""
\
#!/usr/bin/env sh
touch "
%
s
"
sleep 5
sleep
2
5
exit 0""" % worked_file))
os.chmod(succeed, 0o777)
self.assertEqual(self.grid.processPromiseList(),
...
...
@@ -3278,7 +3278,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
with open("
%
s
", 'a'):
os.utime("
%
s
", None)
import time
time.sleep(7)""" % (worked_file, worked_file)
time.sleep(
2
7)""" % (worked_file, worked_file)
instance.setPluginPromise(promise_name='timeout_fail.py', success=True, promise_content=fail)
self.assertEqual(self.grid.processPromiseList(),
slapos.grid.slapgrid.SLAPGRID_PROMISE_FAIL)
...
...
@@ -3286,7 +3286,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
with open(os.path.join(instance.partition_path, "
.
slapgrid
/
promise
/
result
/
timeout_fail
.
status
.
json
"), "r") as f:
result = json.loads(f.read())
self.assertEqual('Error: Promise timed out after
3
seconds',
self.assertEqual('Error: Promise timed out after
20
seconds',
result["
result
"]["
message
"])
def test_two_succeeding_promises(self):
...
...
@@ -3422,7 +3422,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
then
touch "
%
(
lockfile
)
s
"
else
sleep 5
sleep
2
5
fi
exit 0""" % {
'worked_file': worked_file,
...
...
@@ -3450,7 +3450,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
with open("
%
s
", 'a'):
os.utime("
%
s
", None)
import time
time.sleep(7)""" % (timeout_file, timeout_file)
time.sleep(
2
7)""" % (timeout_file, timeout_file)
instance.setPluginPromise(promise_name='timeout_fail.py', success=True, promise_content=fail)
self.assertEqual(self.grid.processPromiseList(),
...
...
@@ -3465,7 +3465,7 @@ class TestSlapgridPromiseWithMaster(MasterMixin, unittest.TestCase):
with open(os.path.join(instance.partition_path, "
.
slapgrid
/
promise
/
result
/
timeout_fail
.
status
.
json
"), "r") as f:
result = json.loads(f.read())
self.assertEqual('Error: Promise timed out after
3
seconds',
self.assertEqual('Error: Promise timed out after
20
seconds',
result["
result
"]["
message
"])
def test_promise_notrun_if_partition_stopped(self):
...
...
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