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
18
Merge Requests
18
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
5a0cb363
Commit
5a0cb363
authored
Dec 16, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_grid_utils: Relax timeout tests for SlapPopen
parent
eecff7ec
Pipeline
#25642
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
slapos/tests/test_grid_utils.py
slapos/tests/test_grid_utils.py
+12
-12
No files found.
slapos/tests/test_grid_utils.py
View file @
5a0cb363
...
...
@@ -228,7 +228,7 @@ class SlapPopenTestCase(unittest.TestCase):
for i in $(seq 100)
do
echo .
sleep 0.
1
sleep 0.
5
done
"""
).
encode
())
self
.
script
.
close
()
...
...
@@ -238,13 +238,13 @@ class SlapPopenTestCase(unittest.TestCase):
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
self
.
script
.
name
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
# the timeout was respected
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.
\
n
'
*
10
)
...
...
@@ -258,7 +258,7 @@ class SlapPopenTestCase(unittest.TestCase):
for i in $(seq 100)
do
echo -n .
sleep 0.
1
sleep 0.
5
done
"""
).
encode
())
self
.
script
.
close
()
...
...
@@ -268,13 +268,13 @@ class SlapPopenTestCase(unittest.TestCase):
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
self
.
script
.
name
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
# the timeout was respected
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.'
*
10
)
...
...
@@ -289,7 +289,7 @@ class SlapPopenTestCase(unittest.TestCase):
do
>&2 echo -n -
echo -n .
sleep 0.
1
sleep 0.
5
done
"""
).
encode
())
self
.
script
.
close
()
...
...
@@ -301,13 +301,13 @@ class SlapPopenTestCase(unittest.TestCase):
self
.
script
.
name
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
# the timeout was respected
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.'
*
10
)
...
...
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