2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-17 13:24:49 +00:00
Commit Graph

43 Commits

Author SHA1 Message Date
JINMEI Tatuya
878c361337 [2617] treat ECONNRESET on recv as error unconditionally with detailed notes 2013-01-31 10:49:57 -08:00
JINMEI Tatuya
8431fb8b25 [2617] reorder log message; some more comments and doc 2013-01-30 22:16:58 -08:00
JINMEI Tatuya
ac23914ba6 [2617] separated real recv error and close-on-recv; treat the latter as debug. 2013-01-30 21:24:37 -08:00
JINMEI Tatuya
2a1e4152da [2617] make sure FD handling is performed only when it's still valid.
This eliminates the possibility of hitting MSGQ_READ_UNKNOWN_FD, and, in fact,
we can even deprecate this message.   And then, process_socket() becomes
a 2-line function called only by _process_fd() and can be integrated into
the latter.  so it's done, too.
2013-01-30 20:27:14 -08:00
JINMEI Tatuya
73ca6b06d1 [2617] log EPIPE at the warn level. added more detailed tests for send_data. 2013-01-30 18:01:48 -08:00
Mukund Sivaraman
8a33bc3ac5 [2623] Fix test failures in msgq_test.py under Python 3.3 2013-01-28 04:44:30 +05:30
Michal 'vorner' Vaner
b0a6e5fff9 [2582] Lettuce tests for msgq logging
This way we check the logging works to the correct place and that the
configuration is handled. It is better checked by lettuce than unit
tests, since there's a lot of inter-module communication in it.
2013-01-15 13:38:15 +01:00
Michal 'vorner' Vaner
275a72e95d [2582] Synchronisation when the config manager connects 2013-01-15 11:15:31 +01:00
Michal 'vorner' Vaner
8d31e215ff [2582] Signal connection of config manager
Let the config manager call a function when the config manager
subscribes. The function is empty in this commit, but it'll be used
later on.
2013-01-15 10:26:54 +01:00
Michal 'vorner' Vaner
84a994f8ef [2582] Run the MSGQ poller in separate thread
This will be needed in the following work. If we run in the same thread
and tried to connect to self by the cc library, it would deadlock, since
the library blocks waiting for answer.

Also, small cleanup of shutdown is included.

No functional change should be observable.
2013-01-14 19:09:07 +01:00
Michal 'vorner' Vaner
774a4996da [1190] Make the tests work
Do the initialization in tests too (the executable script initializes it
only when run separately, to know the correct parameters).

Also, remove deprecated and unused auxiliary script that doesn't and
didn't work.
2012-12-19 13:11:40 +01:00
Michal 'vorner' Vaner
95483cb529 [1190] Put logging into MSGQ
Add the logging calls. Other things need to be tweaked (putting it into
a file, making tests work, etc).
2012-12-19 12:49:05 +01:00
Jelte Jansen
3b408810eb [master] Fix callable() check in unit test
callable() has been removed in Python 3, but was reintroduced in Python 3.2. This fix (check for isinstance(obj, collections.Callable) should make the test work with 3.1 and older versions of 3.

(acked on jabber)
2012-11-29 18:13:22 +01:00
Jelte Jansen
af81d77242 [2398] Unify two sending methods a bit
By moving the error-checking into __send_data(), both send_prepared_msg() and __process_write() now only need to check the return value
2012-11-27 14:09:20 +01:00
Jelte Jansen
8e6846495d [2398] Add second control socket pair to test msgq
And remove internal timeouts in msgq again; actions are now only triggered by available data, as in the original
2012-11-27 12:00:52 +01:00
Jelte Jansen
65962eeed6 [2398] update doc and comments 2012-11-23 16:03:07 +01:00
Jelte Jansen
553dfb31fc [2398] Test and catch more socket errors 2012-11-23 15:38:36 +01:00
Jelte Jansen
0ce073c9aa [2398] Introduce stop mechanism in msgqM
Introduced a lowlevel mechanism into msgq to stop it (other than ye olde SIGTERM); a lowlevel message 'stop' will cause it to stop listening and shut down. Needed to add timeouts to poll() and control() for that, but chose them relatively high (their loop should simply reloop if they time out)

This allows the threaded msgq testing code to be more reliable (and not having to daemonize and arbitrarily kill threads except in the case of major failures, in which case the test itself will fail)
2012-11-23 14:58:39 +01:00
Jelte Jansen
5378e305cb [2398] Add test setup for sending messages in msgq
Test setup raising arbitrary exceptions from the write socket.

We can extend this to do the same for reading I think.

Also added tests; some for things that worked already (EAGAIN, EWOULDBLOCK), but also for the SIGPIPE that is the problem in #2398
2012-11-21 16:32:49 +01:00
Mukund Sivaraman
c4b20d7ad5 [1828] Add comments about the close() calls 2012-06-15 02:41:51 +05:30
Mukund Sivaraman
d96e91d14a [1828] Close MsgQ socket in except block 2012-06-14 12:35:17 +05:30
Mukund Sivaraman
6725498ecb [1828] Close open handles when done using them (contd.) 2012-04-16 18:48:22 +05:30
Mukund Sivaraman
eae421b481 [1828] Close open handles when done using them (contd.) 2012-04-05 16:38:14 +05:30
Jeremy C. Reed
fe5549bb7e [master]Revert "[master] Show testnames when running Python unit tests"
This reverts commit 6a9dbeff7d.

Most builder systems use Python 3.1.

This verbosity feature was added in Python 3.2.
2012-03-29 10:14:35 -05:00
Mukund Sivaraman
6a9dbeff7d [master] Show testnames when running Python unit tests 2012-03-29 18:48:41 +05:30
Shane Kerr
3303478b6f Use os._exit() when exiting from a forked() child process, not sys.exit() 2011-05-17 11:43:10 +02:00
Shane Kerr
83717978e3 Fix for msgq tests on Python 3.2
The behavior of the unittest module was changed in the face of a
test exiting, so we need to use os._exit() instead of sys.exit()
to terminate.
2011-05-05 09:06:29 +02:00
JINMEI Tatuya
782a56fbd2 [master] use larger failsafe timeouts for slower machines.
discussed on jabber, going to push it directory.  I think this is very minor,
so won't bother to increase the changelog size for this.
2011-03-17 15:56:25 -07:00
Naoki Kambe
47e5334355 [trac573] Fixed failure of termination of msgq_test.py in python3 coverage(3.3.1) 2011-02-14 21:49:27 +09:00
Michal 'vorner' Vaner
6f6f589204 [trac420] Fix some portability issues
* kqueue maybe doesn't survive fork on MacOS
* add_kqueue_socket wanted socket, not fileno
* Some systems don't have MSG_DONTWAIT, so we set the socket nonblocking
2011-01-25 22:35:13 +01:00
Michal 'vorner' Vaner
acc6a3ab37 [trac420] Try not to timeout on slow machines
Some of our built machines time out, for two possible reasons:
* They have long buffer before they start blocking. Therefore the amount
  of data sent is increased.
* They have clock with low precision, so if now - last_sent > 0.1:
  happens after a long time. So the timeout waiting for that was
  increased.
2011-01-25 17:24:45 +01:00
Michal 'vorner' Vaner
4b4813d587 [trac420] Make sure the subprocess doesn't outlive
It could happen in rare occasions that the subprocess survived death of
the tests, mostly when exceptions happened in the parent process and it
didn't kill it. So there's a finally now and the subprocess has a
limited life length just in case it still slipped somehow without kill.
2011-01-25 12:38:41 +01:00
Michal 'vorner' Vaner
ed69c4be96 [trac420] Check the returned data
The tests only received data, but did not check it is correct. Now it is
checked.
2011-01-25 11:01:09 +01:00
Michal 'vorner' Vaner
6ed7ca08bb Test cleanup 2011-01-20 19:41:27 +01:00
Michal 'vorner' Vaner
395bbc3393 Let the sending tests run for longer
At last longer than is the dead-socket timer, to see the socket is not
considered dead even when it is read.
2011-01-20 12:52:11 +01:00
Michal 'vorner' Vaner
7a8bfbdd24 Buffer management
Also, fix a small bug that could lead to resource leak (but probably
wouldn't)
2011-01-20 12:47:11 +01:00
Michal 'vorner' Vaner
d0a9b15c2c Test with large data as well
* Added a ping command to msgq, for testing purposes
* Sending large and small data around from the test
2011-01-20 11:30:26 +01:00
Michal 'vorner' Vaner
a1210be107 Tests for non-blocking msgq
* Tests that try sending data and expect to time out.
* Test that tries to repeatedly send a command to msgq and expects it to
  be answered (to see that the sending does not only timeout, but works
  when the data are read as well).
2011-01-19 21:34:37 +01:00
JINMEI Tatuya
706d99cc13 merged the proposed patch in trac #297: making msgq tests runnable in parallel with an installed version of BIND 10. Typo identified via review was fixed.
(not plan to spam changelog for this change)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3371 e5f2f494-b856-4b98-b285-d166d9295462
2010-10-27 10:08:28 +00:00
Jelte Jansen
1306183eb7 some changes inspired by jinmei's review
git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac183@1933 e5f2f494-b856-4b98-b285-d166d9295462
2010-05-26 09:48:08 +00:00
Jelte Jansen
3ef6ad200f use unix domain socket instead of localhost:9912
on the msgq and python side, the socket file is either:

- what is speficied as an argument to the constructor, OR
- environment variable BIND10_MSGQ_SOCKET_FILE, OR
- default (@localstatedir@/msgq_socket)

in that order.

two open items:

TODO: run_X scripts should set a local file in BIND10_MSGQ_SOCKET_FILE (so if installed dirs don't exist run from source fails right now)
TODO: the c++ boost::asio version has no 'manual override', only environment variable or default. (which is better than what it was before, only hardcoded port 9912), fixing this would mean an API change somewhere


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac183@1901 e5f2f494-b856-4b98-b285-d166d9295462
2010-05-21 14:50:17 +00:00
Jelte Jansen
91923a0d65 TDD: created tests first :)
git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac183@1900 e5f2f494-b856-4b98-b285-d166d9295462
2010-05-21 12:35:32 +00:00
Jeremy C. Reed
5c10d34b68 This is for ticket #153.
Moved msgq tests to own directory.

Added targets for all known python unittests.
Note this is for those that use the unittest module.
Other tests are ignored for now.

These tests are ran using "make check" even if not built
with gtest.

Some of these tests fail. I will comment them out in later commit.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac153@1753 e5f2f494-b856-4b98-b285-d166d9295462
2010-04-20 17:54:47 +00:00