Commit Graph

271 Commits

Author SHA1 Message Date
Aanand Prasad 262efce43e Fix test regression introduced in ed80576236
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-24 11:47:39 -07:00
Mark Steve Samson 7f06d46827 Add test for building with --no-cache
Signed-off-by: Mark Steve Samson <hello@marksteve.com>
2014-07-22 11:40:44 +08:00
Aanand Prasad 140ced6a3b Fix and document `dns:` option
Closes #240.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-17 18:11:50 -07:00
Daniel Nephin 779f4bda01 Fix cli for python 2.6
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-07-15 13:07:46 -07:00
Aanand Prasad 91fe414522 Fix regression of default behaviour in Command.project_name
Needed an `os.abspath` in there. Added more tests, too.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-14 11:32:10 -07:00
Ben Firshman 7fb43cc85f Merge pull request #283 from d11wtq/feature/optional-command
Make fig run COMMAND parameter optional.
2014-07-14 18:33:18 +01:00
Ryan Brainard e9c2f2c5fb Default project_name to dirname of fig.yml
Signed-off-by: Ryan Brainard <brainard@heroku.com>
2014-07-12 23:38:20 -07:00
Chris Corbyn ef2fb77c1d Make fig run COMMAND parameter optional.
This behaves more like the native docker client, where the absence of a
command means docker runs the CMD in the Dockerfile. If a command is
defined in fig.yml this is used instead.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-07-12 02:30:34 +00:00
Aanand Prasad 89341013a0 Fix volumes_from container
Closes #311.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-11 16:39:23 -07:00
Ben Firshman b573b87a92 Fix race condition in recreate containers
Container might have stopped between checking `is_running` and
calling `stop()`, which then threw an exception.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-07-11 14:53:46 -07:00
Ryan Brainard 44a91e6ba8 Resolve environment without values to values on host
For parity with the Docker CLI, allow environment variables without
values to be automatically resolved to their values on the host.

Signed-off-by: Ryan Brainard <brainard@heroku.com>

Conflicts:
	tests/integration/service_test.py
2014-07-11 10:18:05 -07:00
Sam Hanes 699bbe9ca2 Split the domainname out of qualified hostnames.
Docker doesn't like it when a fully qualified hostname is passed in
the `hostname` parameter. When an FQDN is provided with `-h` the
official CLI puts the first component in `hostname` and the rest in
`domainname`. This change replicates that behavior when the user
specifies an FQDN in `hostname` in their `fig.yml`.

Signed-off-by: Sam Hanes <sam@maltera.com>
2014-07-10 20:18:09 -07:00
Alexey Lebedeff d83bdd5164 Change working dir through fig.yml
Closes #144

Signed-off-by: Alexey Lebedeff <binarin@gmail.com>
2014-07-10 21:22:45 +04:00
Aanand Prasad 944e15fa65 Stop `fig run` starting everything when a service has no links
This was thanks to the semantics of project.up(), which starts everything
if you pass it an empty list of service names. (That logic should
probably be moved out to main.py.)

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-02 11:51:12 +01:00
Aanand Prasad d04b1724ec Merge pull request #236 from rail44/feature-support-volumes-from
Support volumes_from option
2014-07-02 10:48:11 +01:00
Satoshi Amemiya e5916b2fae Support volumes_from option
Signed-off-by: Satoshi Amemiya <rail.sky@gmail.com>
2014-07-02 13:27:54 +09:00
Mark Steve Samson 4f7cbc3812 Support for host address in port bindings (Closes #267) 2014-06-27 15:07:22 +01:00
Aanand Prasad 3c48884dbb Update dockerpty; stub it out in tests
Its current behaviour occasionally causes tests to hang; until this is
resolved, we'll stub it out. We weren't testing the output of 'run'
anyhow (though we should be).
2014-06-27 14:41:36 +01:00
Aanand Prasad 256dccc554 Merge pull request #268 from orchardup/update-docker-py-0.3.2
Update to docker-py 0.3.2
2014-06-25 14:16:48 +01:00
Ben Firshman d0f65906ed Update to docker-py 0.3.2
From 59ced5700c

Now only supports Docker 1.0.0 / remote API v1.12.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-06-25 11:56:20 +01:00
Ben Firshman 95aa61cfe5 Merge pull request #246 from d11wtq/feature/auto_start
Feature: `fig up` and `fig run` now start linked containers (closes #31).
2014-06-24 14:46:47 +01:00
Chris Corbyn 247691ca44 Remove auto_start option from fig.yml.
This option is redundant now that services can be started along with links.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-21 10:39:36 +00:00
Chris Corbyn 0fc9cc65d1 Rename '--only' => '--no-deps'
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-21 10:30:36 +00:00
j0hnsmith 6b8044e92c add net param support
Signed-off-by: Peter Flood <info@whywouldwe.com>
2014-06-19 11:57:55 +01:00
Aanand Prasad d0b5bcf26a Pass byte strings straight through LogPrinter 2014-06-18 14:51:13 +01:00
Aanand Prasad 262248d8a6 Firm up tests for split_buffer 2014-06-18 14:51:13 +01:00
Chris Corbyn 1b5bf6e12a Merge remote-tracking branch 'upstream/master' into feature/auto_start
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>

Conflicts:
	tests/fixtures/simple-figfile/fig.yml
	tests/unit/project_test.py
2014-06-12 22:05:51 +00:00
d11wtq 6e485df084 Rename --no-links to --only
Signed-off-by: d11wtq <chris@w3style.co.uk>
2014-06-11 10:50:45 +00:00
d11wtq 3a342fb25d Use busybox in fixtures, instead of ubuntu
Signed-off-by: d11wtq <chris@w3style.co.uk>
2014-06-11 10:25:50 +00:00
Chris Corbyn e71e82f8ac Add missing fixture file
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-11 10:09:54 +00:00
d11wtq 1d1e23611b Rename --keep-old to --no-recreate
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:51 +00:00
d11wtq ab1fbc96c3 Move keep_old check up into Project
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:50 +00:00
d11wtq a04143e2a7 Remove unused: from __future__ import unicode_literals.
This is not being used and it confuses the Command class. Rather
than try to fix the Command class, I've taken the pragmatic
approach and removed the trigger that confuses it.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:50 +00:00
d11wtq 6c4299039a Write integration tests for `--keep-old` in the CLI
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 655d347ea2 Write integration tests on new `fig run` linking behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 94a3164248 Re-add missing import for patch
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 18728a64b9 Write tests for --no-links changes to `fig up`
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq d8b0fa294e Add integration tests for Project.up() w/ start_links and keep_old
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq a6c8319b5d Add integration tests for Service.recreate_containers() with keep_old
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq 5d92f12f8e Add unit tests for include_links in get_services()
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq 13a296049b Update cli integration test for 'auto_start' behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:45 +00:00
d11wtq 22c531dea7 Add unit tests for Project.get_services()
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
d11wtq dfc74e2a77 Write integration test for 'auto_start' behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
d11wtq 0c12db06ec Move 'auto_start' option default to Service and add unit tests
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
Ben Firshman 10725136d8 Add tests for names on containers 2014-04-29 09:20:29 +01:00
Ben Firshman ca7151aeb1 Split tests into unit and integration 2014-04-25 22:58:21 +01:00
Aanand Prasad 6e932794f7 Fix regression when mounting volumes
Caused by
77fec67c60
2014-04-25 12:28:00 +01:00
Aanand Prasad 9e1dfcfb37 Update docker-py APIError imports 2014-04-23 18:20:33 +01:00
Aanand Prasad 80991f1521 Set "VolumesFrom" when starting containers
This is necessary when working with Docker 0.10.0 and up. Fortunately,
we can set it both when creating and starting, and retain compatibility
with 0.8.x and 0.9.x.

recreate_containers() is now responsible for starting containers, as
well as creating them. This greatly simplifies usage of the Service
class.
2014-04-23 15:46:26 +01:00
Ben Firshman 2b245bdf9e Update to docker-py 0.3.1
From 7f55a101f8

This now requires Docker 0.9 or greater.
2014-04-15 10:41:06 +01:00
sebastianneubauer 352ad7a38c Scaling down removes containers
Squashed version of #162.
Closes #121.
2014-03-26 18:28:10 +00:00
Kevin van Zonneveld 0f5a56b3c2 Add support for privileged containers #123
This is required for mounting external volumes and
addresses errors such as `mount.nfs: Operation not permitted`

Be gentle, I don't normally use Python :)
2014-03-13 14:31:05 +01:00
Aanand Prasad 13c7380113 Only `fig run` containers link back to the service they're part of
Fixes #107.
2014-03-06 18:59:24 +00:00
Aanand Prasad 2d98071e55 Support 'expose' config option, like docker's --expose
Exposes ports to linked services without publishing them to the world.
2014-03-04 18:06:52 +00:00
Aanand Prasad 6a3d1d06b5 Check NetworkSettings.Ports instead of HostConfig.PortBindings in tests
The latter appears to be unreliable.
2014-03-04 17:58:42 +00:00
Ben Firshman 044c348faf Add test for fig rm 2014-03-04 11:00:09 +00:00
Ben Firshman 465c7d569c Improve CLI test names 2014-03-04 11:00:09 +00:00
Aanand Prasad a00ec9d1f8 Fix: image-defined entrypoint not overridden by intermediate container
This was causing recreation to hang.
2014-03-03 18:06:06 +00:00
Ben Firshman 3e7360c2c6 Improve error when service is not a dict
Fixes #127
2014-03-03 16:21:42 +00:00
Ben Firshman bf47aa97b4 Fix tests importing six 2014-03-03 12:25:38 +00:00
Aanand Prasad c07e96cf2b Merge pull request #120 from marksteve/link-name
Add custom link names (Closes #72)
2014-03-03 11:22:57 +00:00
Mark Steve Samson 193558a4bc Add link names test 2014-03-03 08:54:47 +08:00
Mark Steve Samson e38e866626 Fix links related test 2014-03-02 00:30:33 +08:00
Aanand Prasad 9d1383ba26 Alternate fig file can be specified with -f 2014-03-01 11:29:23 +00:00
Ben Firshman b9c8e3e057 Fix scale not binding ports 2014-02-17 21:33:05 +00:00
Ben Firshman 5d4210ceb3 Fix tests when there is an image with int tag 2014-02-17 21:32:48 +00:00
Barnaby Gray 6431d52a2e Implement topological sort using Cormen/Tarjan algorithm to handle a->b->c dependencies and detect a->b->c->a cycles. 2014-02-12 09:09:55 +00:00
Aanand Prasad edf8f14ac0 Throw an error if you specify an unrecognised option in `fig.yml`
Closes #27.
2014-02-04 17:46:04 -08:00
Ben Firshman 62607f4f04 Merge pull request #67 from orchardup/link-services-to-themselves
Link services to themselves
2014-01-31 02:46:52 -08:00
Ben Firshman e4e9f0bc19 Link services to themselves
E.g. `fig run db ...` will be able to access the db service.
2014-01-30 13:11:23 +00:00
Cameron Maske ae7573b9b8 Fix for #48.
Rework of how services are sorted based on dependencies using a topological sort.
Includes error handling to detect circular/self imports (should raise a DependecyError).
Added in logging to the CLI to log out any DependencyErrors.
Removed the compact module as it is no longer used.
2014-01-29 18:38:25 +00:00
Aanand Prasad ee880ca7be Fix recreate_containers test 2014-01-29 13:57:28 +00:00
Ben Firshman cbdeff99ee Fix broken test on Python 3 2014-01-28 13:45:47 +00:00
Ben Firshman 8b75f7c7d3 Merge pull request #58 from mrchrisadams/load_yaml_as_well_as_yml
Support loading in Figfiles with .yaml extension
2014-01-28 03:35:25 -08:00
Chris Adams 1d18d747a5 Support loading in Figfiles with .yaml extension
Add basic boilerplate text - feel free to change
2014-01-28 00:43:23 +00:00
Ben Firshman 3e7e6e7656 Add link alias without project name
REDIS_1_PORT_6379_TCP_ADDR instead of
FIGTEST_REDIS_1_PORT_6379_TCP_ADDR.

Ref #37
2014-01-27 15:32:16 +00:00
Ben Firshman ddf6819a75 Only pull ubuntu:latest in tests
Might stop Travis running out of disk space.
2014-01-26 20:37:40 +00:00
Ben Firshman ee49e7055b Pull ubuntu image for CLI tests 2014-01-26 20:29:05 +00:00
Ben Firshman ea93c01dfb Remove intermediate containers in recreate test 2014-01-26 19:48:10 +00:00
Ben Firshman cf18a3141f Remove images created by tests 2014-01-26 19:37:35 +00:00
Aanand Prasad e8472be6d5 Fig bug in split_buffer where input was being discarded
Also, write some tests for it.
2014-01-22 17:44:04 +00:00
Aanand Prasad df9f66d437 Allow ports to be specified in '1234/tcp' format 2014-01-22 17:01:10 +00:00
Aanand Prasad ae67d55bf2 Fix bug where too many '/tcp' suffixes were added to port config 2014-01-22 16:52:42 +00:00
Ben Firshman 7abc4fbf3a Improve ps CLI test 2014-01-20 16:50:41 +00:00
Ben Firshman 855a9c623c Remove containers after running CLI tests 2014-01-20 16:47:58 +00:00
Cameron Maske 62bba1684b Updated recreate_containers to attempt to base intermediate container's the previous container's image.
Added in additional functionality to reset any entrypoints for the intermediate container and pull/retry handling if the image does not exist.
Updated test coverage to check if an container is recreated with an entrypoint it is handled correctly.
2014-01-19 18:40:21 +00:00
Ben Firshman 56c6efdfce Add scale command
Closes #9
2014-01-16 18:09:46 +00:00
Ben Firshman 8ed86ed551 Add number to container 2014-01-16 18:05:59 +00:00
Aanand Prasad 21528f08d4 Vendor docker-py
From 9dc03c5737
2014-01-16 13:30:01 +00:00
Aanand Prasad ee0c4bf690 Fix test regression 2014-01-16 12:32:16 +00:00
Aanand Prasad ea4753c49a Use an anonymous intermediate container so that when recreating containers, suffixes always start from 1 2014-01-16 12:32:15 +00:00
Aanand Prasad f5f9357736 Remove project.create_containers(), revamp project.recreate_containers()
`recreate_containers` now returns two lists of old+new containers, along
with their services.
2014-01-16 12:32:15 +00:00
Aanand Prasad bdc6b47e1f service.recreate_containers() no longer removes the old containers
We need to keep them around until the new ones have been started.
2014-01-16 12:32:15 +00:00
Aanand Prasad 3669236aa1 Support volumes in config with an unspecified host path 2014-01-16 12:32:15 +00:00
Aanand Prasad 207e83ac2f Be sure to test that recreate_containers updates config 2014-01-16 12:32:15 +00:00
Ben Firshman 3c5e334d9d Add recreate_containers method to service 2014-01-16 12:32:15 +00:00
Ben Firshman 7a1fb3a8d2 Fix ordering of port mapping 2014-01-16 01:54:05 +00:00
Aanand Prasad 8cab05feb4 Failing (on 2.7, at least) smoke test for 'fig ps'
See #8.
2014-01-09 15:32:50 +00:00
Aanand Prasad 892677a9d3 Very basic CLI smoke test
See #8.
2014-01-09 15:32:24 +00:00
Christopher Grebs 93b9b6fd9f First version with python3 support.
* Moved requirements*.txt files to proper spec definitions in setup.py
 * Added a new fig.compat module to store some compatibility code
2014-01-06 17:58:49 +00:00
Ben Firshman f96a1a0b35 Fix Python 2.6 2014-01-06 17:58:49 +00:00
Ben Firshman ff9fa5661d Fix Python 2.6 2014-01-06 11:22:46 +00:00
Ben Firshman 853d8ad280 Namespace tests inside a project
So it doesn't delete all your containers for every test. Cool.
2014-01-02 15:27:51 +00:00
Aanand Prasad d4f3ed1840 Fix 'fig up' behaviour
- For each service, creates a container if there are none (stopped OR
  started)
- Attaches to all containers (unless -d is passed)
- Starts all containers
- On ^C, kills all containers (unless -d is passed)
2013-12-31 13:02:08 +00:00
Aanand Prasad 9ed6538693 Extract docker URL logic, use it in tests as well 2013-12-31 12:37:17 +00:00
Aanand Prasad 0cafdc9c6c plum -> fig 2013-12-20 20:28:24 +00:00
Aanand Prasad 13a30c327a Container.name strips the leading slash 2013-12-20 19:33:41 +00:00
Aanand Prasad 8291d36eaf Fix stray test regression 2013-12-20 19:30:31 +00:00
Aanand Prasad d3346fa174 up, start, stop, kill and rm all accept a list of services 2013-12-20 18:32:55 +00:00
Aanand Prasad 81093627fe Implement kill and rm 2013-12-20 18:30:59 +00:00
Aanand Prasad a4710fa9e1 'plum up' is now the special magic
'start' and 'stop' are now analogous to their Docker namesakes.
2013-12-20 18:30:59 +00:00
Ben Firshman 507940535f Tag built images and use them when starting
A basic measure to get round the fact that adding isn't cached. Once
Docker supports cached adds, this is probably redundant.
2013-12-20 16:23:40 +00:00
Ben Firshman 326438b170 Pick correct numbers for one off containers 2013-12-20 12:55:45 +00:00
Ben Firshman 2f28265d10 Add support for differentiating one-off containers
This is a basic start, the API is pretty shonky.
2013-12-20 10:46:55 +00:00
Ben Firshman 2d2d81d33f Rename "service collection" to "project" 2013-12-19 16:55:12 +00:00
Ben Firshman c488710625 Add project option to services 2013-12-19 15:16:17 +00:00
Ben Firshman 6c551a200b Do not allow underscores in names 2013-12-19 14:47:43 +00:00
Ben Firshman a5fc880d10 Refactor service to add a container object 2013-12-18 18:37:48 +00:00
Ben Firshman 5e1e4a71e0 Rename ServiceTest 2013-12-18 17:01:50 +00:00
Ben Firshman 87c46e281c Add support for specifying external port 2013-12-18 11:14:34 +00:00
Ben Firshman 772585109d Moved tests to root directory 2013-12-14 16:34:24 +00:00