Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caucase
Commits
e72324c6
Commit
e72324c6
authored
Sep 21, 2018
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Directly raise on timeout in UntilEvent.wait .
parent
67cbbda7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
caucase/test.py
caucase/test.py
+7
-8
No files found.
caucase/test.py
View file @
e72324c6
...
@@ -189,10 +189,9 @@ class UntilEvent(object):
...
@@ -189,10 +189,9 @@ class UntilEvent(object):
timeout (float)
timeout (float)
Maximum number of seconds to wait for.
Maximum number of seconds to wait for.
"""
"""
result
=
self
.
_wait_event
.
wait
(
timeout
)
if
not
self
.
_wait_event
.
wait
(
timeout
):
# pragma: no cover
if
result
:
raise
AssertionError
(
'Timeout reached'
)
self
.
_wait_event
.
clear
()
self
.
_wait_event
.
clear
()
return
result
def
__call__
(
self
,
deadline
):
def
__call__
(
self
,
deadline
):
"""
"""
...
@@ -1953,7 +1952,7 @@ class CaucaseTest(unittest.TestCase):
...
@@ -1953,7 +1952,7 @@ class CaucaseTest(unittest.TestCase):
updater_thread
.
daemon
=
True
updater_thread
.
daemon
=
True
updater_thread
.
start
()
updater_thread
.
start
()
try
:
try
:
self
.
assertTrue
(
until_updater
.
wait
()
)
until_updater
.
wait
(
)
# CSR must have been submitted
# CSR must have been submitted
csr_line_list
=
self
.
_runClient
(
csr_line_list
=
self
.
_runClient
(
'--user-key'
,
user_key_path
,
'--user-key'
,
user_key_path
,
...
@@ -1969,7 +1968,7 @@ class CaucaseTest(unittest.TestCase):
...
@@ -1969,7 +1968,7 @@ class CaucaseTest(unittest.TestCase):
until_updater
.
action
=
ON_EVENT_EXPIRE
until_updater
.
action
=
ON_EVENT_EXPIRE
updater_event
.
set
()
updater_event
.
set
()
# Wait for it to call "until()" again
# Wait for it to call "until()" again
self
.
assertTrue
(
until_updater
.
wait
()
)
until_updater
.
wait
(
)
# It must have retrieved the certificate now.
# It must have retrieved the certificate now.
self
.
assertTrue
(
os
.
path
.
exists
(
re_crt_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
re_crt_path
))
finally
:
finally
:
...
@@ -1992,14 +1991,14 @@ class CaucaseTest(unittest.TestCase):
...
@@ -1992,14 +1991,14 @@ class CaucaseTest(unittest.TestCase):
443
if
parsed_url
.
port
==
80
else
parsed_url
.
port
+
1
,
443
if
parsed_url
.
port
==
80
else
parsed_url
.
port
+
1
,
)
)
# Wait for server to sleep, and clear.
# Wait for server to sleep, and clear.
self
.
assertTrue
(
self
.
_server_until
.
wait
()
)
self
.
_server_until
.
wait
(
)
# Pull certificate.
# Pull certificate.
before
=
ssl
.
get_server_certificate
(
address
)
before
=
ssl
.
get_server_certificate
(
address
)
# Wake server so it renews certificate.
# Wake server so it renews certificate.
self
.
_server_until
.
action
=
ON_EVENT_EXPIRE
self
.
_server_until
.
action
=
ON_EVENT_EXPIRE
self
.
_server_event
.
set
()
self
.
_server_event
.
set
()
# Wait for it to be back to sleep.
# Wait for it to be back to sleep.
self
.
assertTrue
(
self
.
_server_until
.
wait
()
)
self
.
_server_until
.
wait
(
)
# Verify renewal happened.
# Verify renewal happened.
after
=
ssl
.
get_server_certificate
(
address
)
after
=
ssl
.
get_server_certificate
(
address
)
self
.
assertNotEqual
(
before
,
after
)
self
.
assertNotEqual
(
before
,
after
)
...
...
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