Commit Graph

70 Commits

Author SHA1 Message Date
David Wilson f1660d5011 tests: initial first_stage_test. 2017-10-16 20:51:23 +05:30
David Wilson 2e8ed68609 Merge branch 'pr/50' 2017-10-16 17:16:29 +05:30
Alex Willmer fe2bf7111a ssh_test: Correct hostname in SShTest.test_stream_name()
I presume that `u1704` is a relic of a bygone container/host.
2017-10-15 20:33:59 +01:00
Alex Willmer a0fbe99be0 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
2017-10-15 20:31:10 +01:00
Alex Willmer cae6989932 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)")
```
2017-10-09 22:05:02 +01:00
David Wilson 492777f61b tests: stop responder_test spamming the logs 2017-10-08 19:14:52 +05:30
David Wilson 9e884d3d8b tests: stop fakessh spamming the logs 2017-10-08 19:14:21 +05:30
David Wilson c83d86f050 importer: Delete _get_module_via_parent entirely
Can't figure out what it's supposed to do any more, and can't find a
version of Ansible before August 2016 (when I wrote that code) that
seems to need it.

Add some more mitigations to avoid sending dylibs.
2017-10-08 16:33:04 +05:30
David Wilson 397ff50a58 Try to be compatible with older Docker daemons; (hopefully) closes #46 2017-10-05 05:03:57 +05:30
David Wilson 8439e889ed core: More robust shutdown
Now there is a separate SHUTDOWN message that relies only on being
received by the broker thread, the main thread can be hung horribly and
the process will still eventually receive a SIGTERM.
2017-10-03 16:35:12 +05:30
David Wilson 1784f3c83a Add test that hangs the main thread during shutdown. 2017-10-03 16:09:35 +05:30
David Wilson fa9def91f2 Implement test_aborted_on_local_context_disconnect 2017-10-03 15:54:55 +05:30
David Wilson e3b51de6b1 Handle docker running on localhost. 2017-10-02 15:22:00 +05:30
David Wilson d7c15859bf Let utils_test run directly too. 2017-10-02 14:36:36 +05:30
David Wilson eac5daf28d Fix select_test failure, remove crap old timing_test. 2017-10-02 14:35:27 +05:30
David Wilson 291a44dc34 Remove proxy_test (duplicates sudo_test) 2017-10-02 13:56:33 +05:30
David Wilson 1f73c32d4c frameworkize nested_test. 2017-10-02 13:56:02 +05:30
David Wilson eb6afee514 Beginnings of module_finder_test 2017-10-02 13:54:01 +05:30
David Wilson fccf1b1cab Fix importer_test constructor signature. 2017-10-01 15:30:43 +05:30
David Wilson e6795a5c43 core: loosen assertion to allow fakessh_test to succeed. 2017-10-01 15:29:04 +05:30
David Wilson 2ed39c411f Allow call_function_test to succeed depite testlib import. 2017-09-30 20:58:05 +05:30
David Wilson 2659cf0ae0 Use enhanced assertRaises in call_function_test.py. 2017-09-30 20:57:14 +05:30
David Wilson b0e13fefdd Fix 2 call_function_test failures. 2017-09-30 15:09:05 +05:30
David Wilson 909937cc21 Simple scan_code_imports test. 2017-09-30 13:55:41 +05:30
David Wilson f57a12b3f9 Fix context naming for sudo and via=. 2017-09-29 16:04:09 +05:30
David Wilson 1a48e37981 Allow running responder_test with unittest. 2017-09-28 14:37:27 +05:30
David Wilson 839a1cbeb1 receiver: only permit one notify callback
There is no point spamming a list for every function call, there is no
use case where multiple notify callbacks would be useful.
2017-09-28 10:58:57 +05:30
David Wilson 031c0f3cf4 issue #20: TestCase subclass with a nicer assertRaises 2017-09-27 13:56:19 +05:30
David Wilson 186d823600 issue #20: tests and fixes for mitogen.master.Select(). 2017-09-27 13:47:14 +05:30
David Wilson 0db472c97b Fix up importer_test. 2017-09-25 05:20:50 +05:30
David Wilson 55bdb50d4f Add README.md to tests subdir. 2017-09-22 23:46:35 +05:30
David Wilson d553295135 Syntax error. 2017-09-22 13:37:50 +05:30
Alex Willmer a8d216eeab Update lingering references to with_broker & run_with_broker
A previous commit renamed run_with_broker() and with_broker() to
run_with_router() and with_router() respctively. Some references were
missed.
2017-09-21 19:59:53 +01:00
David Wilson c585f1bc5a fakessh: Add integration test for inter-child rsync. 2017-09-21 16:46:30 +05:30
David Wilson 5da8dc0cdc Allow running without py.test. 2017-09-21 16:45:36 +05:30
David Wilson 959af50c1f Make log_to_file accept string level rather than logging package constant
Saves an import, pain in the ass to type all the time.
2017-09-21 16:36:44 +05:30
David Wilson 729356b5f0 master: make write_all() handle O_NONBLOCK and deadlines. 2017-09-21 15:57:32 +05:30
David Wilson 16950a1620 core: Make iter_read() handle deadline (and non-blocking IO) properly 2017-09-21 15:28:02 +05:30
David Wilson aa5bc53f6d Update test. 2017-09-21 13:41:47 +05:30
David Wilson d6d83b3fac fakessh: cleanup master test. 2017-09-21 13:06:59 +05:30
David Wilson d84b4bf72a Keep allocate_id() in the enhanced router class. 2017-09-18 17:03:30 +05:30
David Wilson 491b5ab575 core: add ALLOCATE_ID message for fakessh. 2017-09-18 15:37:21 +05:30
David Wilson 3e020ddd09 Fix Channel constructor and add simple test; closes #32 2017-09-18 14:34:05 +05:30
David Wilson d9bf091e6f Simple working fakessh_test. 2017-09-17 21:19:06 +05:30
David Wilson bd2c613b9c Fix up a few more ssh_tests, stop sending 400 modules over network.
Defining functions in the current module was causing the entirety of
py.test and all dependencies to be sucked in.
2017-09-17 21:09:03 +05:30
David Wilson cffaa92fc4 Add rsync and git to build_docker_image too. 2017-09-17 21:07:32 +05:30
David Wilson a89c20e54e Fixup some more tests. 2017-09-17 20:33:43 +05:30
David Wilson cf506dfdf2 First handful of functional tests for SSH against Docker. 2017-09-17 18:11:48 +05:30
David Wilson 22c9f82c46 Import Docker build script for integration tests 2017-09-17 17:30:48 +05:30
David Wilson bc437733e5 Working DockerMixin for tests. 2017-09-17 05:27:33 +05:30