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
Léo-Paul Géneau
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
Changes
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):
...
@@ -228,7 +228,7 @@ class SlapPopenTestCase(unittest.TestCase):
for i in $(seq 100)
for i in $(seq 100)
do
do
echo .
echo .
sleep 0.
1
sleep 0.
5
done
done
"""
).
encode
())
"""
).
encode
())
self
.
script
.
close
()
self
.
script
.
close
()
...
@@ -238,13 +238,13 @@ class SlapPopenTestCase(unittest.TestCase):
...
@@ -238,13 +238,13 @@ class SlapPopenTestCase(unittest.TestCase):
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
self
.
script
.
name
,
self
.
script
.
name
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
logger
=
logger
)
# the timeout was respected
# the timeout was respected
elapsed
=
time
.
time
()
-
start
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.
\
n
'
*
10
)
self
.
assertEqual
(
cm
.
exception
.
output
,
'.
\
n
'
*
10
)
...
@@ -258,7 +258,7 @@ class SlapPopenTestCase(unittest.TestCase):
...
@@ -258,7 +258,7 @@ class SlapPopenTestCase(unittest.TestCase):
for i in $(seq 100)
for i in $(seq 100)
do
do
echo -n .
echo -n .
sleep 0.
1
sleep 0.
5
done
done
"""
).
encode
())
"""
).
encode
())
self
.
script
.
close
()
self
.
script
.
close
()
...
@@ -268,13 +268,13 @@ class SlapPopenTestCase(unittest.TestCase):
...
@@ -268,13 +268,13 @@ class SlapPopenTestCase(unittest.TestCase):
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
with
self
.
assertRaises
(
subprocess
.
TimeoutExpired
)
as
cm
:
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
program
=
slapos
.
grid
.
utils
.
SlapPopen
(
self
.
script
.
name
,
self
.
script
.
name
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
logger
=
logger
)
# the timeout was respected
# the timeout was respected
elapsed
=
time
.
time
()
-
start
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.'
*
10
)
self
.
assertEqual
(
cm
.
exception
.
output
,
'.'
*
10
)
...
@@ -289,7 +289,7 @@ class SlapPopenTestCase(unittest.TestCase):
...
@@ -289,7 +289,7 @@ class SlapPopenTestCase(unittest.TestCase):
do
do
>&2 echo -n -
>&2 echo -n -
echo -n .
echo -n .
sleep 0.
1
sleep 0.
5
done
done
"""
).
encode
())
"""
).
encode
())
self
.
script
.
close
()
self
.
script
.
close
()
...
@@ -301,13 +301,13 @@ class SlapPopenTestCase(unittest.TestCase):
...
@@ -301,13 +301,13 @@ class SlapPopenTestCase(unittest.TestCase):
self
.
script
.
name
,
self
.
script
.
name
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
timeout
=
1
,
timeout
=
5
,
logger
=
logger
)
logger
=
logger
)
# the timeout was respected
# the timeout was respected
elapsed
=
time
.
time
()
-
start
elapsed
=
time
.
time
()
-
start
self
.
assertLess
(
elapsed
,
5
)
self
.
assertLess
(
elapsed
,
10
)
self
.
assertGreaterEqual
(
elapsed
,
1
)
self
.
assertGreaterEqual
(
elapsed
,
5
)
# the output before timeout is captured
# the output before timeout is captured
self
.
assertEqual
(
cm
.
exception
.
output
,
'.'
*
10
)
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