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
Labels
Merge Requests
2
Merge Requests
2
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
caucase
Commits
aa090b76
Commit
aa090b76
authored
Nov 08, 2021
by
Boxiang Sun
Committed by
Vincent Pelletier
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caucase.test: CAUCASE_NETLOC should not contain literal IP addresses
parent
4e2c2fe9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
caucase/test.py
caucase/test.py
+21
-2
No files found.
caucase/test.py
View file @
aa090b76
...
...
@@ -388,6 +388,14 @@ class CaucaseTest(TestCase):
)
self
.
_caucase_url
=
'http://'
+
netloc
parsed_url
=
urllib_parse
.
urlparse
(
self
.
_caucase_url
)
try
:
ipaddress
.
ip_address
(
parsed_url
.
hostname
)
except
ValueError
:
pass
# parsed_url.hostname is a hostname as expected
else
:
# pragma: no cover
raise
AssertionError
(
'CAUCASE_NETLOC should not contains literal IP'
)
self
.
assertFalse
(
canConnect
((
parsed_url
.
hostname
,
parsed_url
.
port
)),
'Something else is already listening on %r, define CAUCASE_NETLOC '
...
...
@@ -3795,10 +3803,21 @@ class CaucaseShellTest(TestCase):
"""
Run caucase.sh's embedded testsuite.
"""
self
.
_run
(
'--test'
,
os
.
getenv
(
netloc
=
os
.
getenv
(
'CAUCASE_NETLOC'
,
'localhost:8000'
,
))
)
caucase_url
=
'http://'
+
netloc
parsed_url
=
urllib_parse
.
urlparse
(
caucase_url
)
try
:
ipaddress
.
ip_address
(
parsed_url
.
hostname
)
except
ValueError
:
pass
# parsed_url.hostname is a hostname as expected
else
:
# pragma: no cover
raise
AssertionError
(
'CAUCASE_NETLOC should not contains literal IP'
)
self
.
_run
(
'--test'
,
netloc
)
if
__name__
==
'__main__'
:
# pragma: no cover
unittest
.
main
()
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