Commit Graph

802 Commits (0c1d8825473d4f8b7a9fe29b2d6366dbedccd558)

Author SHA1 Message Date
David Wilson 86c9978e09 Ensure mod.__file__ is set; closes #210. 7 years ago
David Wilson e63ae4768e core: support Receiver.get(thread_dead=False)
For tests.
7 years ago
David Wilson 6541779dd6 tests: import Ansible file transfer benchmark 7 years ago
David Wilson 7c88e4d013 Move _DEAD into header, autogenerate dead messages
This change blocks off 2 common scenarios where a race condition is
upgraded to a hang, when the library could internally do better.

* Since we don't know whether the receiver of a `reply_to` is expecting
  a raw or pickled message, and since in the case of a raw reply, there
  is no way to signal "dead" to the receiver, override the reply_to
  field to explicitly mark a message as dead using a special handle.

  This replaces the serialized _DEAD sentinel value with a slightly
  neater interface, in the form of the reserved IS_DEAD handle, and
  enables an important subsequent change: when a context cannot route a
  message, it can send a generic 'dead' reply back towards the message
  source, ensuring any sleeping thread is woken with ChannelError.

  The use of this field could potentially be extended later on if
  additional flags are needed, but for now this seems to suffice.

* Teach Router._invoke() to reply with a dead message when it receives a
  message for an invalid local handle.

* Teach Router._async_route() to reply with a dead message when it
  receives an unroutable message.
7 years ago
David Wilson 8c3b1fcf15 ansible: disable script interpreter processing for new-style
Re: #199
7 years ago
David Wilson 2f02b5c0b1 ansible: prevent Unicode strings leaking into sys.argv
The module name comes from YAML via Jinja2.. it's always Unicode. Mixing
it into a temporary directory name produces a Unicode tempdir name,
which ends up in sys.argv via TemporaryArgv.
7 years ago
David Wilson e56608ab91 parent: don't wait for SIGTERM to complete. 7 years ago
David Wilson dc4433ace6 issue #202: ansible: forget all dependent contexts on Stream disconnect
This is a partial fix, there are still at least 2 cases needing covered:

- In-progress connections must have CallError or similar sent to any
  waiters
- Once connection delegation exists, it is possible for other worker
  processes to be active (and in any step in the process), trying to
  communicate with a context that we know can no longer be communicated
  with. The solution to that isn't clear yet.

Additionally ensure root has /bin/bash shell in both Docker images.
7 years ago
David Wilson 9fe14e841c parent: reap the child process if connection fails
For example if no response is received in :attr:`connect_timeout`
seconds, the child would be left running.
7 years ago
David Wilson e7831a801f issue #195: handle non-ASCII scripts in runner.py. 7 years ago
David Wilson 85e1f5f515 ansible: remove JobResultService, more compatible async jobs; closes #191.
And by "compatible" I mean "terrible". This does not implement async job
timeouts, but I'm not going to bother, upstream async implementation is
so buggy and inconsistent it resists even having its behaviour captured
in tests.
7 years ago
David Wilson 6ad18b6719 issue #191: move async tests to their own category 7 years ago
David Wilson e43c6c531b Mostly implement hybrid TTY/socket mode for sudo and SSH.
Presently there is still no mechanism to add :attr:`tty_stream` to the
multiplexer after connection is successful, but for now it's not
expected that anything will be logged to it anyway.

Closes #148.
7 years ago
David Wilson fca22efe90 tests: enable profile_tasks callback plugin 7 years ago
David Wilson c6284e00e9 Use subprocess to start child processes; closes #185. 7 years ago
David Wilson 1e882a72c0 tests: install virtualenv in the Docker images. 7 years ago
David Wilson b91785c9a1 tests: workaround for issue_109 7 years ago
David Wilson ce260933d9 tests: consistent play naming everywhere 7 years ago
David Wilson d827bdb848 tests: fixes to get regression/ running under vanilla Ansible 7 years ago
David Wilson b882b78d35 tests: clean up remaining reg tests
Delete some that are impossible to detect, fix up the remainder to
detect the condition they describe.
7 years ago
David Wilson aeeba54d96 tests: better regression test for issue #109 7 years ago
David Wilson f4d791662e ansible: better planner logging, try again 7 years ago
David Wilson b4bb1c5a2a tests: fix suspected readdir() ordering issue (!) 7 years ago
David Wilson 0046a3de0b tests: insert debug print for travis :( 7 years ago
David Wilson ef47347cdf tests: raft of fixes for vanilla Ansible 7 years ago
David Wilson 89e11ed25c tests: make osx_setup a little more generic again 7 years ago
David Wilson 2c3d2db4ec tests: fix output checks for Linux 7 years ago
David Wilson 7e49e73683 tests: add perl-JSON to the test images too.
Needed for the runner tests.
7 years ago
David Wilson ac80bf12f0 tests: start making osx_setup.yml more generic 7 years ago
David Wilson 16b5aa2d10 tests: disable host key checking for Paramiko. 7 years ago
David Wilson 41d2661ecb tests: fix sudo rule order. 7 years ago
David Wilson ed915b6e63 tests: magic mitogen_shutdown_all action
LRU tests break when run as part of the whole suite rather than
individually, because LRU stuff is already happening for earlier tests.
7 years ago
David Wilson 6614d17021 tests: explicit sudo rules to require password from sudo_nopw
This account is used on Travis. It needs to be forced to type passwords
in some cases
7 years ago
David Wilson ba8022424b tests: more work to standardize user accounts. 7 years ago
David Wilson ce6fb05d87 tests: 'fix' responder test.
Needs a complete rewrite, but this will do for now.
7 years ago
David Wilson 00aef80fac tests: /bin/bash login shell for all users. 7 years ago
David Wilson 63e2ec6406 tests: expanduser lookup runs locally 7 years ago
David Wilson 472610805f tests: fix remote_tmp test on 2.5.x. 7 years ago
David Wilson e2eac65347 tests: import mitogen_ansible_playbook.sh helper 7 years ago
David Wilson 89676b1257 tests: put unittest.skip() around fakessh tests for the time being 7 years ago
David Wilson 6390e36a4e tests: document selecting a target distribution. 7 years ago
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.
7 years ago
David Wilson 9f94fb78c8 issue #159: make LRU size configurable. 7 years ago
David Wilson 6394226722 issue #159: verify no more than 20 tasks exist on the remote 7 years ago
David Wilson 633cd888a0 issue #182: test for previous commit. 7 years ago
David Wilson 9acca37050 issue #159: lots more test users. 7 years ago
David Wilson 0c803141a7 tests: fix filename. 7 years ago
David Wilson ec720eab1a Merge commit 'refs/pull/178/head' of github.com:dw/mitogen 7 years ago
David Wilson 3682ac6e29 fork: ensure importer handle is installed on the new router. 7 years ago
David Wilson c14f6c98d1 ansible: import osx_setup.yml. 7 years ago
David Wilson 98ee3e177a ansible: tests for sudo behaviour; closes #143. 7 years ago
David Wilson 3613162bc0 ansible: enable forking when requested and for async jobs.
Closes #105.
References #155.

mitogen/service.py:
    Refactor services to support individually exposed methods with
    different security policies for each method.

    - @mitogen.service.expose() to expose a method and set its policy
    - @mitogen.service.arg_spec() to validate input.
    - Require basic service message format to be a tuple of
      `(method, kwargs)`, where kwargs is always a dict.
    - Update DeduplicatingService to match the new scheme.

ansible_mitogen/connection.py:
    - Rename 'method' to 'method_name' to disambiguate it from the
      service.call()'s method= argument.

ansible_mitogen/planner.py:
    - Generate an ID for every job, sync or not, and fetch job results
      from JobResultService rather than via the initiating function
      call's return value.
    - Planner subclasses now get to select whether their Runner should
      run in a forked process. The base implementation requests this if
      the 'mitogen_isolation_mode=fork' task variable is present.

ansible_mitogen/runner.py:
    Teach runners to deliver their result via JobResultService executing
    in their indirect parent mux process.

ansible_mitogen/plugins/actions/mitogen_async_status.py:
    Split the implementation up into methods, and more compatibly
    emulate Ansible's existing output.

ansible_mitogen/process.py:
    Mux processes now host JobResultService.

ansible_mitogen/services.py:
    Update existing services to the new mitogen.service scheme, and
    implement JobResultService:

    * listen() method for synchronous jobs. planner.invoke() registers a
      Sender with the service prior to invoking the job, then sleeps
      waiting for the service to write the job result to the
      corresponding Receiver.

    * Non-blocking get() method for implementing mitogen_async_status
      action.

    * Child-accessible push() method for delivering task results.

ansible_mitogen/target.py:
    New helpers for spawning a virginal subprocess on startup, from
    which asynchronous and mitogen_task_isolation=fork jobs are forked.
    Necessary to avoid a task inheriting potentially
    polluted/monkey-patched parent environment, since remaining jobs
    continue to run in the original child process.

docs/ansible.rst:
    Add/merge/remove some behaviours/risks.

tests/ansible/integration:
    New tests for forking/async.
7 years ago
Alex Willmer 1bc32adad4 Issue #160: Cache minimize_source()
Before

```
python tests/bench/local.py
0 120.245933533
1 119.300842285
2 118.355035782
3 123.839855194
```

After

```
python tests/bench/local.py
0 66.3640499115
1 65.9508705139
2 72.4799633026
3 65.7958984375
```
7 years ago
Alex Willmer dc3f5730a2 Merge branch 'master' into eye-of-the-token-its-the-thrill-of-the-light 7 years ago
David Wilson b247c320d2 issue #164: rename tests for clarity 7 years ago
David Wilson bc4a6b39bf issue #164: teach debops_tests.sh to use SSH
Login with a non-privileged account over SSH rather than just jumping
straight in as root via Docker.
7 years ago
David Wilson 35fdd97f9a issue #164: utility to print Docker hostname for use from shell scripts. 7 years ago
David Wilson b9d4ec57b3 issue #164: some more ActionMixin tests. 7 years ago
David Wilson 29288b236b issue #164: import run_ansible_playbook.sh. 7 years ago
David Wilson db894478f8 issue #164: make become_flags work without FOO=2 env var. 7 years ago
David Wilson e4b49997d6 issue #164: whups, delete checked in binaries. 7 years ago
David Wilson d068a36c1e issue #164: more dir layout contortions.
all.yml slurps in tests from each file/subdir in the CWD.
7 years ago
David Wilson 680dc1bf68 issue #164: basic connection loader tests. 7 years ago
David Wilson 20ecd0af02 issue #164: fix makefile 7 years ago
David Wilson 48a0938d04 issue #164: add action module to return active strategy. 7 years ago
David Wilson 0247561fc7 issue #164: rename lib/modules 7 years ago
David Wilson 6aeb4e9f05 issue #164: precisely emulate Ansible's stdio behaviour.
* Use identical logic to select when stdout/stderr are merged, so
  'stdout', 'stdout_lines', 'stderr', 'stderr_lines' contain the same
  output before/after the extension.

* When stdout/stderr are merged, synthesize carriage returns just like
  the TTY layer.

* Mimic the SSH connection multiplexing message on stderr. Not really
  for user code, but so compare_output_test.sh needs fewer fixups.
7 years ago
David Wilson c5ca2e87ea issue #164: stop tests on first failure 7 years ago
David Wilson 26cc0f2724 issue #164: fix remote_tmp handling on <2.5 7 years ago
David Wilson 3ebe600389 issue #164: convert "examples" into actual tests
- Add new Travis mode, "ansible_tests.sh" that runs
  integrations/all.yml. Slowly build this up over time to cover more of
  the existing junk.

- Add basic assertions on the output of the existing runner__* files.

- Wire up 2.4.3/2.5.0 jobs in Travis.
7 years ago
David Wilson ae75a0ca8c issue #164: rearrange playbooks a little more 7 years ago
David Wilson 563639961d issue #164: dir structure is gross, but at least tab completion works :> 7 years ago
David Wilson 49aa8834b0 issue #164: split "examples" out into regression/integration tests. 7 years ago
David Wilson 4805f3cf36 issue #164: slightly flatten docker image layers 7 years ago
David Wilson 8ca8b43df1 tests/bench: import "slightly more reliable time" script 7 years ago
David Wilson eb402c8bd4 tests/bench: import wrapper script used for blog charts 7 years ago
David Wilson de27fb3a28 issue #174: test all io_op() logic. 7 years ago
Alex Willmer dc60f05a40 tests: Switch to unit2 test runner, with coverage
This means test files are imported as modules, not run as scripts. THey
can still be run individually if so desired. Test coverage is measured,
and an html report generated in htmlcov/. Test cases are automativally
discovered, so they need not be listed twice. An overall
passed/failed/skipped summary is printed, rather than for each file.

Arguments passed to ./test are passed on to unit2. For instance

    ./test -v

will print each test name as it is run.
7 years ago
Alex Willmer 7b8fef5284 tests: Make the tests directory an importable package
Required for test discovery by e.g. unit2, pytest
7 years ago
Alex Willmer a22294dda9 call_function_test: Fix assumption that we run as a script 7 years ago
Alex Willmer 0dcaeb21a2 master_test: Don't assume __file__ points to source code
When run under a test runner the unit tests are imported as modules.
This triggers .pyc generation, after which __file__ resolves to the .pyc
file.
7 years ago
Alex Willmer 841c2b13a1 fakessh_test: Apply timeout decorators to rsync tests
timeoutcontext.timeout uses SIGALRM, hence it will only work on Unix
like operating systems.
7 years ago
Alex Willmer 48623763d6 minimize_source: Implement reindentation 7 years ago
Alex Willmer 556ee2aec6 minimize_source: Handling indentation
In the case that string(s) are replaced, any indent or dedent tags must
be re-inserted after the replacemnts.
7 years ago
Alex Willmer 36c5ff1d05 minimize_source: Make comments test invariant on hashbang/coding handling
strip_comments() currently ignores comments on lines 1 and 2, in order
to preserve lines such as

The comments test had normal comments on those lines, hence it was
failing.
7 years ago
Alex Willmer 3bf61bb311 tests: Clarify which minimize_source samples are the reference 7 years ago
Alex Willmer 35ae4e4227 Issue #160: Add minimize_source testcases 7 years ago
David Wilson bbb0f1bbd8 issue #155: fix double-fork behaviour and test it this time. 7 years ago
David Wilson 4c433dbed1 parent_test: Add explanation. 7 years ago
David Wilson bde1778373 tests: merge tty_create_child() test into parent_test and fix hang 7 years ago
David Wilson 6670cba41c Introduce handler policy functions; closes #138.
Now you can specify a function to add_handler() that authenticates the
message header, with has_parent_authority() and is_immediate_child()
built in.
7 years ago
David Wilson f726ef86de tests: first_stage_test regression due to 1ff27ada49 7 years ago
David Wilson 40b978c9b7 core: Fix source verification.
Previously:

* src_id could be spoofed
* auth_id was checked but the message was still delivered!
7 years ago
David Wilson fe614aa966 core: cleanup handlers on broker crash; closes #112. 7 years ago
David Wilson 1ff27ada49 Add maximum message size checks. Closes #151. 7 years ago
David Wilson 80a97fbc9b core: Rename Sender.put() to Sender.send().
Been annoying me for months.
7 years ago
David Wilson 085b3d21bd core: fix call_function_test regression
Second time in 3 weeks. So stupid. This time write tests.
7 years ago
David Wilson 0f29baa077 core: support pickling senders, Receiver.to_sender()
CC @moreati, in case this impacts you
7 years ago
David Wilson 17aef51e6e tests: Import .local() latency test 7 years ago
David Wilson a8a31728a0 tests: Import Latch soak test 7 years ago
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.
7 years ago
David Wilson 761cd9eaf8 tests: import tty_create_child_test.py. 7 years ago
David Wilson 7b12f84366 core: support CallError(str) for service.py. 7 years ago
David Wilson fccca54068 tests: ensure OpenSSL is initialized prior to test. 7 years ago
David Wilson 4903052f42 fork: reseed Python/SSL PRNGs
Mac's SSL seems to have a pthread_atfork handler or similar that does
this for us, no clue if Linux is the same.
7 years ago
David Wilson 48351a1889 issue #155: parent: support Context.shutdown(), reap children on exit.
This permits graceful shutdown of individual contexts, without tearing
down everything.

Update mitogen.parent.Stream to also wait for the child to exit, to
prevent the buildup of zombie processes. This introduces a blocking wait
for process exit on the Broker thread, let's see if we can get away with
it. Chances are reasonable that it'll cause needless hangs on heavily
loaded machines.
7 years ago
David Wilson 4f93c6823a issue #155: skeletal fork_test. 7 years ago
David Wilson 2d7821b824 tests: test_stream_name: fix non-localhost Docker 7 years ago
David Wilson 23e279b617 tests: get import_test limping back to health. 7 years ago
David Wilson f4ba66e3ee issue #155: allocate child IDs in batches of 1000.
Avoids a roundtrip for every fork.
7 years ago
David Wilson 2132c311b2 tests: mark some tests as skipped 7 years ago
David Wilson 8aada2646c core: support throwing LatchError in every sleeping thread
This is to allow Select() to be used as a generic queueing primitive
that supports graceful shutdown.
7 years ago
Alex Willmer e3b700b553 tests: Fix no such option -o running FakeSsh.test_okay()
Full output of failed test

```
ERROR: test_okay (__main__.FakeSshTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/ssh_test.py", line 16, in test_okay
    ssh_path=testlib.data_path('fakessh.py'),
  File "/home/alex/src/mitogen/mitogen/master.py", line 650, in ssh
    return self.connect('ssh', **kwargs)
  File "/home/alex/src/mitogen/mitogen/parent.py", line 463, in connect
    return self._connect(context_id, klass, name=name, **kwargs)
  File "/home/alex/src/mitogen/mitogen/parent.py", line 449, in _connect
    stream.connect()
  File "/home/alex/src/mitogen/mitogen/ssh.py", line 104, in connect
    super(Stream, self).connect()
  File "/home/alex/src/mitogen/mitogen/parent.py", line 395, in connect
    self._connect_bootstrap()
  File "/home/alex/src/mitogen/mitogen/ssh.py", line 116, in
_connect_bootstrap
    time.time() + 10.0):
  File "/home/alex/src/mitogen/mitogen/parent.py", line 207, in
iter_read
    (''.join(bits)[-300:],)
mitogen.core.StreamError: EOF on stream; last 300 bytes received:
'Usage: fakessh.py [options]\n\nfakessh.py: error: no such option: -o\n'
```
7 years ago
Alex Willmer 0f82f68fee parent: Precompute preamble sizes for first stage
SSH command size: 453 (no change)
Preamble size: 8941 (-5 bytes)
7 years ago
Alex Willmer b433645d11 tests: Fix import error 7 years ago
Alex Willmer c6f3bfd93a tests: Correct path to apply_mode_spec() 7 years ago
David Wilson 23f78ca5a2 README: move testing bits into tests directory. 7 years ago
David Wilson f5b5e4849e tests: import very basic latch_test 7 years ago
David Wilson f6d87faf37 tests: import ansible_helpers_test. 7 years ago
Alex Willmer 4b373c421b core: Standardise type of Importer.whitelist
This seemed a reasonable streamlining, but I'm happy to be overruled.
7 years ago
Alex Willmer 8338caa419 tests: Add mitogen.core.is_blacklisted_import() tests
These test the current behviour, which may not be exactly the intended
behaviour. Refs #98
7 years ago
Alex Willmer 491355548d tests: Fix typo in ResolveRelPathTest 7 years ago
Alex Willmer ef35d55523 tests: Remove jinja2/markupsafe modules from FindRelatedTest
Not sure how they got there, but Django doesn't use Jinja without
explicit configuration.
7 years ago
Alex Willmer eee312a57e tests: Fix expected values FindRelatedTest for Django 1.11.4 7 years ago
Alex Willmer 4424bfbb7a tests: Add new FindRelatedImportsTest 7 years ago
Alex Willmer 9e43f5e6ba tests: Remove module under search from expected results
This matches a tweak made in 8765f761c9
7 years ago
Alex Willmer 0f9bfc1e21 tests: Rename FindRelatedImportsTest -> FindRelatedTest 7 years ago
David Wilson afc8697288 core: Ensure add_handler() callbacks really receive _DEAD on shutdown 7 years ago
David Wilson ccd9c62399 tests: stubs for future whitelist/blacklist tests. 7 years ago
Alex Willmer f4405c6bbc Split IterReadTest & WriteAllTest into test_parent
This matches their respective functions under test, which now reside in
mitogen.parent.
7 years ago
Alex Willmer 4fb1b928b7 Adjust unittest for master -> parent split
Tests should now match changes in
4d31300dd0
7 years ago
Alex Willmer 9ccff0f5d1 Fix TypeError while initiliazing ImporterMixin
Since f44356af32 mitogen.core.Importer()
takes a Router instance.
7 years ago
Alex Willmer fa0f390d4d FIx syntax error in FindRelatedImportsTest.test_django_db_models 7 years ago
David Wilson dd088908df select: clean up API. 7 years ago
David Wilson 219718740b Move django test script into permanent test 7 years ago
David Wilson ec1de4b4b9 tests: ensure strace is available in the docker image..
..and enable privileged=True since that's needed for ptrace()
7 years ago
David Wilson b2909ee5f4 Replace nasty print statements in six_brokenpkg. 7 years ago
Alex Willmer 7e01c5bed5 Import and use unittest2 without aliasing it 7 years ago
Alex Willmer e8e023ce59 Use specific TestCase assertions throughout tests
e.g. assert x == y -> self.assertEqual(x, y);
self.assertTrue(isinstance(x, y)) -> self.assertIsInstance(x, y)

These specific methods give more useful errors in the case of a test
failure.
7 years ago
Alex Willmer df9556d1d9 Replace custom assertContains() with unitest2 assertIn() 7 years ago
Alex Willmer 17da6e9998 Use unittest2 in all tests
This allows using features such as TestCase,assertIsInstance on Python
2.6 and earlier.
7 years ago
Alex Willmer 3831ac360f Replace all calls to file() with open()
Although these are synonyms in Python 2.x, when using MyPy to typecheck
code use of file() causes spurious errors.

This commit also serves as one small step to Python 3.x compatibility,
since 3.x removes the file() builtin.
7 years ago
R W H Bricheno df61f6ab4d Prevent MacOS exception on shutdown of closed socket. 7 years ago
R W H Bricheno 39f325af3e Fix getting the directory path on Mac OS X. 7 years ago
Alex Willmer 026669aa93 tests: Fix GetModuleViaPkgutilTest fetching .pyc
On my laptop (Ubuntu 17.10, Python 2.7.14 in a virtualenv),
`test_regular_mod` fails with

```
AssertionError: "\nimport sys\n\n\ndef say_hi():\n    print 'hi'\n" !=
'\x03\xf3\r\n\xbbW\xd5Yc\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00@\x00\x00\x00s\x19\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00d\x02\x00\x84\x00\x00Z\x01\x00d\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff\xffNc\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\t\x00\x00\x00d\x01\x00GHd\x00\x00S(\x02\x00\x00\x00Nt\x02\x00\x00\x00hi(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x06\x00\x00\x00say_hi\x05\x00\x00\x00s\x02\x00\x00\x00\x00\x01(\x02\x00\x00\x00t\x03\x00\x00\x00sysR\x01\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00sF\x00\x00\x00/home/alex/src/mitogen/tests/data/module_finder_testmod/regular_mod.pyt\x08\x00\x00\x00<module>\x02\x00\x00\x00s\x02\x00\x00\x00\x0c\x03'
```

`__file__` contains the path of the compiled `.pyc`, not the `.py`
source file.
7 years ago
David Wilson 65defaa354 tests: initial first_stage_test. 7 years ago
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)")
```
7 years ago
Alex Willmer 94992940dd ssh_test: Correct hostname in SShTest.test_stream_name()
I presume that `u1704` is a relic of a bygone container/host.
7 years ago
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
7 years ago
David Wilson f8a84616d7 tests: stop responder_test spamming the logs 7 years ago
David Wilson 7389272dc4 tests: stop fakessh spamming the logs 7 years ago
David Wilson 828f60351b 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.
7 years ago
David Wilson 17a05dc14f Try to be compatible with older Docker daemons; (hopefully) closes #46 7 years ago
David Wilson b7a9aa46cf 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.
7 years ago
David Wilson 32d029ed75 Add test that hangs the main thread during shutdown. 7 years ago
David Wilson 3285fc2f75 Implement test_aborted_on_local_context_disconnect 7 years ago
David Wilson dfe68b33d6 Handle docker running on localhost. 7 years ago
David Wilson bee1a86aa1 Let utils_test run directly too. 7 years ago
David Wilson 690ee6dbe2 Fix select_test failure, remove crap old timing_test. 7 years ago
David Wilson 9c8ff7ecf6 Remove proxy_test (duplicates sudo_test) 7 years ago
David Wilson f22d05a7ad frameworkize nested_test. 7 years ago
David Wilson 15bf0f54e2 Beginnings of module_finder_test 7 years ago
David Wilson d17af194b5 Fix importer_test constructor signature. 7 years ago
David Wilson 2454dcc990 core: loosen assertion to allow fakessh_test to succeed. 7 years ago
David Wilson bc801bc2ed Allow call_function_test to succeed depite testlib import. 7 years ago
David Wilson 118fe01be5 Use enhanced assertRaises in call_function_test.py. 7 years ago
David Wilson 9b13a4cc61 Fix 2 call_function_test failures. 7 years ago
David Wilson 236d83418c Simple scan_code_imports test. 7 years ago
David Wilson af6812b458 Fix context naming for sudo and via=. 7 years ago
David Wilson 1449c972eb Allow running responder_test with unittest. 7 years ago
David Wilson 849ccebe04 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.
7 years ago
David Wilson bcae62c682 issue #20: TestCase subclass with a nicer assertRaises 7 years ago
David Wilson f869e088f8 issue #20: tests and fixes for mitogen.master.Select(). 7 years ago
David Wilson ced6d8e404 Fix up importer_test. 7 years ago
David Wilson 40e2e6eb4c Add README.md to tests subdir. 7 years ago
David Wilson 2fed3613e9 Syntax error. 7 years ago
Alex Willmer d706b7d6b8 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.
7 years ago
David Wilson 1510b72a25 fakessh: Add integration test for inter-child rsync. 7 years ago
David Wilson f01e457d70 Allow running without py.test. 7 years ago
David Wilson 750e9fab24 Make log_to_file accept string level rather than logging package constant
Saves an import, pain in the ass to type all the time.
7 years ago
David Wilson 1411790f56 master: make write_all() handle O_NONBLOCK and deadlines. 7 years ago
David Wilson db225638f0 core: Make iter_read() handle deadline (and non-blocking IO) properly 7 years ago
David Wilson 3c8c1f71a6 Update test. 7 years ago
David Wilson 5dff221842 fakessh: cleanup master test. 7 years ago
David Wilson c67119501b Keep allocate_id() in the enhanced router class. 7 years ago
David Wilson 4720eb1c55 core: add ALLOCATE_ID message for fakessh. 7 years ago
David Wilson 502266f115 Fix Channel constructor and add simple test; closes #32 7 years ago
David Wilson 3a0f03183c Simple working fakessh_test. 7 years ago
David Wilson 498f961488 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.
7 years ago
David Wilson f04a503caa Add rsync and git to build_docker_image too. 7 years ago
David Wilson e2d3ac9b6a Fixup some more tests. 7 years ago
David Wilson 2736592c79 First handful of functional tests for SSH against Docker. 7 years ago
David Wilson 91ff12f8d8 Import Docker build script for integration tests 7 years ago
David Wilson b51e41edb5 Working DockerMixin for tests. 7 years ago
David Wilson 1f99dcb435 fix unbelievably dumb variable shadowing 7 years ago
David Wilson 25e4724bac A few more mitogen.slave/master changes 7 years ago
David Wilson bdf4fcfbce Tidy up test. 7 years ago
David Wilson be9e55fe8c pickle: support Context(), use same unpickler everywhere.
* Support passing Context() objects in function calls and return values.
  Now the fakessh demo from the documentation index would work
  correctly.

* Since slaves can communicate with each other now, they should also use
  the same approach to unpickling as the master already used. Collapse
  away all the unpickle extension crap and hard-wire just the 3 types
  that support unpickling.
7 years ago
David Wilson 92ae866271 Import random old test scripts into tests/ dir. 7 years ago
David Wilson 996d847731 Add some broken tests 7 years ago
David Wilson e75f1d8579 Add call_function_test, fix various exception bugs. 7 years ago
David Wilson e7ff6259a3 Initial commit. 7 years ago