Commit Graph

48 Commits

Author SHA1 Message Date
David Wilson 83aff538b3 issue #477: testlib: Py2.4 did not have BaseException. 2019-01-24 03:40:59 +00:00
David Wilson 4388e794ce issue #477: Py2.4: enumerate() may return stopped threads. 2019-01-23 21:28:50 +00:00
David Wilson 2ead451277 issue #477: Python 2.4 lacked str.partition. 2019-01-23 16:37:35 +00:00
David Wilson 2ec19f2374 issue #477: Python 2.4 lacked Thread.name. 2019-01-23 16:37:22 +00:00
David Wilson 2f016b5c7b issue #477: Python 2.4 lacked context managers. 2019-01-23 16:37:00 +00:00
David Wilson 9da6e6a9a8 tests: don't call Router.shutdown() twice.
Due to 497234e7 / issue #456.
2019-01-19 06:19:55 +00:00
David Wilson 3206d59c87 issue #426: teach DockerMixin to allow selecting interpreter 2018-11-07 00:38:47 +00:00
David Wilson 4b61e5af02 tests: run FD and thread checks on every test case.
Trying to hunt down weirdness on Azure.
2018-11-06 01:50:11 +00:00
David Wilson 27a4001f4f tests: handle NameError when faulthandler is not installed. 2018-11-04 19:49:17 +00:00
David Wilson e01c8f2891 issue #406: 3.x syntax fixes. 2018-11-04 11:57:50 +00:00
David Wilson 3da4b1a420 tests: verify only main/watcher threads exist at teardown 2018-11-03 20:13:11 +00:00
David Wilson b0dd628f07 issue #406: parent_test fixes, NameError in log_fd_calls(). 2018-11-03 19:49:13 +00:00
David Wilson 6ff1e001da issue #406: log socketpair calls too. 2018-11-03 15:48:31 +00:00
David Wilson 9b3cb55a8b issue #4096: import log_fd_calls() helper. 2018-11-03 15:01:45 +00:00
David Wilson 8a0b343760 issue #406: test for FD leak after every TestCase 2018-11-03 13:28:37 +00:00
David Wilson 53d882dcbd tests: activate faulthandler if available 2018-10-29 15:25:15 +00:00
David Wilson 592d6fc8d3 tests: fix CaptureStreamHandler on 2.6. 2018-10-26 13:22:33 +01:00
David Wilson 9d070541d9 ansible: try to create tempdir if missing.
Closes #358.
2018-10-02 21:06:00 +01:00
David Wilson 46ec0ffcaf tests: log original traceback in assertRaises(). 2018-07-07 14:55:47 +01:00
David Wilson 6cbf34d5fe tests: another smattering of 3.x type/API fixes. 2018-07-07 14:55:47 +01:00
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
2018-07-07 14:55:47 +01:00
David Wilson 6e0883f369 issue #275: tests: fix bug in 2.6 compat check_output(), ignore it for >2.6. 2018-06-25 01:36:33 +01:00
David Wilson 3b1cc3676c issue #275: ssh_debug_level=3 for tests 2018-06-25 01:36:04 +01:00
David Wilson 38d69a6ecd issue #275: tests: drop docker client dep, doesn't run on 2.6. 2018-06-24 21:12:34 +01:00
David Wilson 7d9b7eec0c tests: must wrap log_to_file() in is_master
Without it, end up with a billion loggers attached in some tests
2018-05-08 14:32:32 +01:00
David Wilson 6109de51a0 tests: Ansible SSH timeout test
Also change Docker image to new 'mitogen' organization.
2018-05-03 18:19:40 +01:00
David Wilson d4d4f46006 tests: update check_host_keys parameter style in testlib. 2018-05-02 17:59:23 +01:00
David Wilson f203a91e1a tests: support CentOS Docker images.
- namespace & document test accounts in README.md
- standardize the password format everywhere, and ensure the passwords
  differ everywhere.
- Add MITOGEN_TEST_DISTRO environment variable.
2018-04-16 14:24:39 +01:00
David Wilson 35fdd97f9a issue #164: utility to print Docker hostname for use from shell scripts. 2018-04-05 20:24:11 +01:00
David Wilson 40b978c9b7 core: Fix source verification.
Previously:

* src_id could be spoofed
* auth_id was checked but the message was still delivered!
2018-03-29 20:24:54 +05:45
David Wilson 1ff27ada49 Add maximum message size checks. Closes #151. 2018-03-29 18:54:55 +05:45
David Wilson 03fcf057dd tests: just call log_to_file() from testlib
Now we can run test.sh with MITOGEN_LOG_LEVEL=debug and things just
work.
2018-03-29 07:25:11 +00:00
David Wilson ec1de4b4b9 tests: ensure strace is available in the docker image..
..and enable privileged=True since that's needed for ptrace()
2018-03-19 21:58:28 +05:45
Alex Willmer 7e01c5bed5 Import and use unittest2 without aliasing it 2018-03-19 21:58:28 +05:45
Alex Willmer df9556d1d9 Replace custom assertContains() with unitest2 assertIn() 2018-03-19 21:58:27 +05:45
Alex Willmer 17da6e9998 Use unittest2 in all tests
This allows using features such as TestCase,assertIsInstance on Python
2.6 and earlier.
2018-03-19 21:58:27 +05:45
R W H Bricheno df61f6ab4d Prevent MacOS exception on shutdown of closed socket. 2018-03-19 21:58:27 +05:45
David Wilson 65defaa354 tests: initial first_stage_test. 2018-03-19 21:58:27 +05:45
Alex Willmer 8dcfb1b7f7 testlib: Auto negotiate Docker API version
Ubuntu 17.04 provides Docker 1.12.6, which has API version 1.24.
`dev_requirements.txt` specifies the docker-py 2.5.1, which by default
requests API version 1.30.

Hence when the SSH unit tests try to run the container specified in
`DockerizedSshDaemon` an error occurs

```
APIError: 400 Client Error: Bad Request ("client is newer than server
(client API version: 1.30, server API version: 1.24)")
```
2018-03-19 21:58:27 +05:45
Alex Willmer dfc7b85504 testlib: Wait for sshd before running tests
On Ubuntu 17.10 something (probably Docker) appears to be accepting
connections, before sshd is fully ready. This results in a race
condition, and hence connection errors for the first few tests (2-3 on
my laptop).

testlib.wait_for_port() checks not only that the port can be connected
to, but also something resembling the sshd banner is sent.

Fixes #51
2018-03-19 21:58:27 +05:45
David Wilson 17a05dc14f Try to be compatible with older Docker daemons; (hopefully) closes #46 2018-03-19 21:35:37 +05:45
David Wilson dfe68b33d6 Handle docker running on localhost. 2018-03-19 21:35:37 +05:45
David Wilson bc801bc2ed Allow call_function_test to succeed depite testlib import. 2018-03-19 21:35:37 +05:45
David Wilson bcae62c682 issue #20: TestCase subclass with a nicer assertRaises 2018-03-19 21:35:36 +05:45
David Wilson 3a0f03183c Simple working fakessh_test. 2018-03-19 21:35:35 +05:45
David Wilson e2d3ac9b6a Fixup some more tests. 2018-03-19 21:35:35 +05:45
David Wilson b51e41edb5 Working DockerMixin for tests. 2018-03-19 21:35:17 +05:45
David Wilson e7ff6259a3 Initial commit. 2018-03-19 21:35:13 +05:45