Skip to main content

Service orchestration library for the Hitch testing framework.

Project description

HitchServe
==========

HitchServe is a UNIX service orchestration library for the Hitch testing
framework.

Use
===

Install like so::

$ hitch install hitchserve

.. code-block:: python

import hitchtest

# Gets the directory above the file that this code is written in
PROJECT_DIRECTORY = path.join(path.dirname(__file__), '..')

# Specify an environment using HitchEnvironment_.
import hitchenvironment
environment = hitchenvironment.Environment("linux2", 64, False)

# Create a service bundle
self.services = hitchserve.ServiceBundle(
project_directory=PROJECT_DIRECTORY,
environment=environment,
startup_timeout=15.0, # How long to wait for all of the services to startup
shutdown_timeout=5.0, # How long to wait for all of the services to shutdown before killing
)

# [ DO SERVICE DEFINITIONS HERE ]
# See below for an example.

# Start services (use interactive=True if you run this command from IPython).
self.services.startup(interactive=True)

# Use interactive=False if you run this command in a test (this aggregate and output service logs):
self.services.startup(interactive=False)

# You can log a message to the logs
self.services.log("Message")

# You can stop the logging and switch to a more interactive mode for debugging
self.services.stop_interactive_mode()

# Launch into ipython...
hitchtest.ipython_embed()

# ...and start it back up again.
self.services.start_interactive_mode()

# You can log a warning message to the logs
self.serviecs.warn("Warning!")

# You can also make the services think that the system time has changed
self.services.time_travel(minutes=30)
self.services.time_travel(hours=30)
self.services.time_travel(days=30)

# Stop services when you are done
self.services.shutdown()


Available prewritten services
=============================

* HitchCron_
* HitchSelenium_
* HitchRedis_
* HitchDjango_
* HitchPostgres_
* HitchCelery_


Features
========

* Starts services in parallel and abstracts away the difficulties of writing multiprocess code.
* Creates an easy way to 'listen' to the logs and trigger events.
* Lets you interact with services and inspect their processes.
* Handles all of the thorny UNIX process handling.
* Aggregates the output of services and logs it all together for easy reading.


Caveats and Known issues
========================

* Faketime does not currently work with Firefox, node.js and Java services.

* HitchServe has not been tested on Windows, Mac OS, BSD or Linux distributions
other than Ubuntu 14.04.2 LTS (kernel version : 3.13.0-49.81). Please
report any issues you have on your specific OS.

* The stacktrace printed after an exception in a test (before showing ipython)
does not contain the full error.

* The code is missing a lot of docstrings.

* Won't run with nosetests/py.test yet.

* Only works on python 2.


Thanks
======

Thanks to Wolfgang Hommel for the libfaketime library, which is used by
HitchServe.


.. _HitchEnvironment: https://github.com/hitchtest/hitchenvironment
.. _HitchSMTP: https://github.com/hitchtest/hitchsmtp
.. _HitchCron: https://github.com/hitchtest/hitchcron
.. _HitchSelenium: https://github.com/hitchtest/hitchselenium
.. _HitchRedis: https://github.com/hitchtest/hitchredis
.. _HitchDjango: https://github.com/hitchtest/hitchdjango
.. _HitchCelery: https://github.com/hitchtest/hitchcelery

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hitchserve-0.3.6.tar.gz (15.4 kB view details)

Uploaded Source

File details

Details for the file hitchserve-0.3.6.tar.gz.

File metadata

  • Download URL: hitchserve-0.3.6.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hitchserve-0.3.6.tar.gz
Algorithm Hash digest
SHA256 778dc669663cf99e2572388eefc69f009bd8feabe6e5173419aae3371e147629
MD5 f07e4fa57f426b75d184bab76c59bfe7
BLAKE2b-256 6f990249bd600f0dd6d06b68aea6d2c8e56e7e17ec65ebb3a75241c78127fbbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page