BIND 10 #353: Move function 'check_port()' and 'check_addr()' to one library
BIND 10 Development
do-not-reply at isc.org
Fri Oct 15 14:50:52 UTC 2010
#353: Move function 'check_port()' and 'check_addr()' to one library
-------------------------------+--------------------------------------------
Reporter: zhanglikun | Owner: vorner
Type: enhancement | Status: reviewing
Priority: major | Milestone:
Component: Unclassified | Resolution:
Keywords: | Sensitive: 0
Estimatedhours: 0.0 | Hours: 0
Billable: 1 | Totalhours: 0
Internal: 0 |
-------------------------------+--------------------------------------------
Changes (by jinmei):
* owner: jinmei => vorner
Comment:
I've not seen anything obviously wrong, but one test failed for me:
{{{
FAIL: test_fail (__main__.TestCheckIP)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/Users/jinmei/src/isc/git/bind10-trac353/src/lib/python/isc/net/tests/check_test.py",
line 53, in test_fail
self.assertRaises(ValueError, addr_check, "0000.0.0.0")
AssertionError: ValueError not raised by addr_check
}}}
This is strange. Maybe the inet_ntop() implementation on MacOS X (it's
BSD-derived as far as I know) is buggy. But we'll have to work around it.
(All other tests passed)
I also have following minor comments. I'd leave it to you whether and how
to address these points.
- port_check()/addr_check() may not be a good name (and in that sense
check.py, too) because xxx_check() sounds like performing a check only and
it's not intuitive for it to return something (other than OK/NG). But I
also saw these functions are sometimes used just for checking, so maybe
it's okay as a compromise.
- it's not clear that IPAddr() raises socket.error against an invalid
input (unless you read the source code, and has knowledge that inet_pton()
raises that exception on failure). Please at least describe it in the
function description, and it's probably better to use a user-defined
specific exception.
- in check_test.py, you assume specific output of inet_ntop(), but as far
as I know it's implementation dependent (although we may expect a
"canonical form" with future implementation due to RFC5952).
--
Ticket URL: <http://bind10.isc.org/ticket/353#comment:5>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list