Commit Graph

89 Commits

Author SHA1 Message Date
Daniel Nephin b6b9b002e5 Merge pull request #2254 from mnowster/1756-dont-display-output-from-previous-runs
1756 dont display output from previous runs
2015-10-27 18:45:47 -04:00
Mazz Mosley bee063c07d Fix tests
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 17:12:18 +00:00
Daniel Nephin 7878d38dee Fix running one-off containers with --x-networking by disabling linking to self.
docker create fails if networking and links are used together.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-27 11:11:15 -04:00
mnowster 5d60fbe31e Merge pull request #1659 from viranch/hostip-random-port
Allow scaling services that have port binding of the form `host_ip::container_port`
2015-10-23 17:11:28 +01:00
Daniel Nephin b1f8ed84a3 Cleanup some unit tests and whitespace.
Remove some unnecessary newlines.
Remove a unittest that was attempting to test behaviour that was removed a while ago, so isn't testing anything.
Updated some unit tests to use mocks instead of a custom fake.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-20 14:23:56 -04:00
Viranch Mehta 258c8bc54d Fix specifies_host_port() to handle port binding with host IP but no host port
Signed-off-by: Viranch Mehta <viranch.mehta@gmail.com>
2015-10-18 00:40:51 +05:30
Aanand Prasad d5f5eb1924 Enable use of Docker networking with the --x-networking flag
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-14 11:19:43 -04:00
Mazz Mosley ca36628a0e Test cgroup_parent option is being sent.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-14 15:02:42 +01:00
Mohit Soni f4efa29377 Added support for cgroup_parent
This change adds cgroup-parent support to compose project. It allows
each service to specify a 'cgroup_parent' option.

Signed-off-by: Mohit Soni <mosoni@paypal.com>
2015-10-14 15:02:42 +01:00
Mazz Mosley f9028703f4 Pick the first container
Rather than inefficiently looping through all the containers that a
service has and overriding each volumes_from value, pick the first
one and return that.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Mazz Mosley 467c731869 address PR feedback
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Vincent Demeester 5b55a08846 Add support for ro option in volumes_from
Fixes #1188

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-10-06 13:12:55 +01:00
Mazz Mosley af8032a5f4 Fix incorrect test name
I'd written relative, when I meant absolute. D'oh.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Mazz Mosley 2276326d7e volume path compatibility with engine
An expanded windows path of c:\shiny\thing:\shiny:rw
needs to be changed to be linux style path, including the drive,
like /c/shiny/thing /shiny
to be mounted successfully by the engine.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Mazz Mosley f4cd5b1d45 Handle windows volume paths
When a relative path is expanded and we're on a windows platform,
it expands to include the drive, eg C:\ , which was causing a ConfigError
as we split on ":" in parse_volume_spec and that was giving too many parts.

Use os.path.splitdrive instead of manually calculating the drive.

This should help us deal with windows drives as part of the volume
path better than us doing it manually.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-01 16:06:57 +01:00
Daniel Nephin 78c0734cbd Disable some tests in windows for now.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-23 10:42:57 -04:00
Mazz Mosley 39ba2c5a7c Fix leaky tests
It was mocking self.client but relying on the call to
utils.create_host_config which was not mocked. So now that function
has moved to also be on self.client we need to redefine the test
boundary, up to where we would call docker-py, not the result of
docker-py.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Mazz Mosley 6f6c04b5c9 Test what we are sending, not what we get
This is a unit test and we are mocking the client. The method to get
the create_config_host now lives on the client, so we mock that too.

So we can test to the boundary that the method is called with the
arguments we expect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Daniel Nephin 187ad4ce26 Refactor network_mode logic out of Service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 13:02:46 -04:00
Daniel Nephin c183e52502 Fixes #1757 - include all service properties in the config_dict()
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin d264c2e33a Resolves #1804
Fix mutation of service.options when a label or environment variable is specified in the config.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-27 18:05:21 -04:00
Daniel Nephin d2718bed99 Allow setting a one-off container name
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 13:33:03 -04:00
Daniel Nephin bdec7e6b52 Cleanup some test case, remove unused mock return values, and use standard single underscore for unused variable
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 13:32:49 -04:00
Daniel Nephin 71ff872e8e Update unit tests for stream_output to match the behaviour of a docker-py response.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:48:48 -04:00
Daniel Nephin feaa4a5f1a Unit tests passing again.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:47:06 -04:00
Daniel Nephin 2943ac6812 Cleanup requirements.txt so we don't have to maintain separate copies for py2 and py3.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:46:08 -04:00
Daniel Nephin 809443d6d0 Support python 3
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:37:29 -04:00
Daniel Nephin 59d4f304ee Run pre-commit on all files
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-24 17:04:50 -04:00
Joel Hansson 61936f6b88 log_opt: change address to syslog-address
Signed-off-by: Joel Hansson <joel.hansson@ecraft.com>
2015-08-20 16:46:06 +02:00
Karol Duleba 56f03bc20a Allow to specify image by digest. Fixes #1670
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-19 21:13:34 +01:00
Aanand Prasad ed31673069 Merge pull request #1827 from mnowster/port-ranges
Port ranges
2015-08-12 11:17:22 +01:00
Aanand Prasad fb4c9fbb8b Merge pull request #1808 from mnowster/129-validate-compose-yml
129 validate compose yml
2015-08-12 11:15:47 +01:00
Aanand Prasad 982a845635 Fix mem_limit and memswap_limit regression
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-11 14:17:30 +01:00
Aanand Prasad dfa4bf4452 Ignore containers that don't have a name
If a container is in the process of being removed, or removal has
failed, it can sometimes appear in the output of GET /containers/json
but not have a 'Name' key. In that case, rather than crashing, we can
ignore it.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-10 16:29:12 +01:00
Yuval Kohavi 0fdd977b06 fixed merge issue from previous commit
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
2015-08-07 16:22:39 +01:00
Yuval Kohavi 297941e460 rebasing port range changes
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
2015-08-07 16:22:39 +01:00
Mazz Mosley 76e6029f21 Replace service tests with config tests
We validate the config against our schema before a service is created
so checking whether a service name is valid at time of instantiation of
the Service class is not needed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley da36ee7cbc Perform schema validation
Define a schema that we can pass to jsonschema to validate against the
config a user has supplied. This will help catch a wide variety of common
errors that occur.

If the config does not pass schema validation then it raises an exception
and prints out human readable reasons.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Aanand Prasad 04a773f1c8 Deprecate --allow-insecure-ssl
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-23 10:56:21 +01:00
Aanand Prasad 89f6caf871 Allow any volume mode to be specified
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 16:14:09 +01:00
Aanand Prasad 8b033d3946 Merge pull request #1665 from mnowster/1648-support-log-opt
1648 support log opt
2015-07-07 17:08:04 +01:00
Mazz Mosley 6f31e8ebe9 Add support for log_opt
When specifying a log_driver you want to specify some options for
the logger as per the docker run --log-opt option. The logger
options are key value pairs.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-07 16:26:43 +01:00
Aanand Prasad 531265bc84 Fix smart recreate when 'image' is changed to something nonexistent
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-07 16:01:44 +01:00
Mazz Mosley fc26982132 Add in memswap_limit run option
By allowing the memswap_limit option to be defined we also need to
check that mem_limit is set, you can't have swap without a limit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-06 17:08:57 +01:00
Mazz Mosley f33f673b49 Allow _.- chars in service names
As VALID_CHARS is shared with project names, these chars are also
now allowed within project names.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Mazz Mosley 8cf84ea552 Fix missing image names
These tests were indeed raising a config error, but not for the reason
intended/tested for. I've added in the image name so the config error
raise is correctly testing the Service name.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Aanand Prasad bef0926c58 Explicitly set pull=False when building
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 17:43:16 -07:00
Daniel Nephin 06db577105 Move converge() to a test module, and use a short timeout for tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 17:18:27 -04:00
Travis Thieman c24d5380e6 Extend up -t to pass timeout to stop running containers
Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
2015-06-14 16:45:28 -04:00
Aanand Prasad 08bc4b830b Fix volume binds de-duplication
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-12 16:57:22 -04:00