Commit graph

35 commits

Author SHA1 Message Date
Sebastiaan van Stijn
ecf889816c Fix restartpolicy max-retry validation
the restart policy validation was moved from
the client to the daemon in 94e95e4711

As part of that change, retry-counts < 1
were marked as "invalid".

However, the default is 0 (unlimited), causing

    docker run -d --restart=on-failure nginx

To fail.

This changes the validation to only invalidate
retry-counts < 0.

A test was added, and other tests renamed
to allow running just these tests :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9db5d649ae)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2016-12-02 13:40:40 -08:00
Zhang Wei
da6609ccdc Fix typo
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-09 09:42:23 +08:00
Zhang Wei
3c2886d8a4 Move --rm to daemon side
`--rm` is a client side flag which caused lots of problems:
1. if client lost connection to daemon, including client crash or be
killed, there's no way to clean garbage container.
2. if docker stop a `--rm` container, this container won't be
autoremoved.
3. if docker daemon restart, container is also left over.
4. bug: `docker run --rm busybox fakecmd` will exit without cleanup.

In a word, client side `--rm` flag isn't sufficient for garbage
collection. Move the `--rm` flag to daemon will be more reasonable.

What this commit do is:
1. implement a `--rm` on daemon side, adding one flag `AutoRemove` into
HostConfig.
2. Allow `run --rm -d`, no conflicting `--rm` and `-d` any more,
auto-remove can work on detach mode.
3. `docker restart` a `--rm` container will succeed, the container won't
be autoremoved.

This commit will help a lot for daemon to do garbage collection for
temporary containers.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-08 22:46:53 +08:00
Zhang Wei
a7eecd2b61 Fix test case
"TestRestartContainerwithRestartPolicy" contains some codes that could be
flaky, it's supposed to be fixed in #22256.

This commit removes unnecessary code, make the test case cleaner.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-04-26 19:22:48 +08:00
Zhang Wei
a705e166cf Fix critical bug: can't restart a restarting container
When user try to restart a restarting container, docker client report
error: "container is already active", and container will be stopped
instead be restarted which is seriously wrong.

What's more critical is that when user try to start this container
again, it will always fail.

This error can also be reproduced with a `docker stop`+`docker start`.

And this commit will fix the bug.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-04-08 22:02:30 +08:00
Tonis Tiigi
20390f65c4 Fix restart monitor stopping on manual restart
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-04-07 16:12:05 -07:00
Yong Tang
48ccdd46ae Fix flaky test of TestRestartStoppedContainer (#21211).
This fix addressed the issue of test TestRestartStoppedContainer
in #21211. Inside the test, a `docker restart` command is
followed by a `docker logs` command. However, `docker restart`
returns immediately so there is no guarantee that `docker logs`
will wait until the restarted container completes the command
`echo foobar`.

This fix use the check of `{{.State.Running}} = false` to make
sure that the restarted container has already finished, before
invoking the `docker logs` command. The timeout is set to 20s
to make sure it passes WindowsTP4 check.

This fixes #21211.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-03-18 05:50:23 +00:00
Antonio Murdaca
e44689139d integration-cli: remove not necessary -d again
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-02-28 13:48:15 +01:00
John Howard
281c1ced6d Windows CI: Port docker_cli_restart_test.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-24 15:21:56 -08:00
Zhang Wei
62a856e912 Assert error in body of function inspectField*
1. Replace raw `docker inspect -f xxx` with `inspectField`, to make code
cleaner and more consistent
2. assert the error in function `inspectField*` so we don't need to
assert the return value of it every time, this will make inspect easier.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-01-29 23:39:07 +08:00
Stefan Scherer
4f339570cb Skip failing tests on ARM to get red/green feedback from Jenkins
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
2016-01-18 17:00:15 +01:00
Madhu Venugopal
7481961009 IT for restart-policy and DNS based SD in user-defined networks
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-14 11:03:26 -08:00
Jessica Frazelle
f91115e3a2
fix consistetly failing TestContainerRestartSuccess on windows it looks up pids and does unixy things
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-11-25 13:04:59 -08:00
Madhu Venugopal
be9b7a2459 Adding a restart test to make sure #16887 doesnt happens again
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-11-18 23:29:25 -08:00
weiyan
196af472a6 use of checkers on docker_cli_restart_test.go
Signed-off-by: weiyan <weiyan3@huawei.com>
2015-10-15 16:35:03 +08:00
John Howard
8a5ab83df8 Windows: First part of CI tests (docker run)
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-22 10:24:03 -07:00
John Howard
f9a3558a9d Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-04 12:32:40 -07:00
Vincent Demeester
799d9605d6 Remove/Comment time.Sleep in integration tests
Remove what seems unnecessary time.Sleep (1 second even) and comment the
ones that seemed necessary.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-08-18 20:36:08 +02:00
Sebastiaan van Stijn
50d2597e49 Merge pull request #13711 from calavera/version_volumes_inspect
Expose new mount points structs in inspect.
2015-07-22 09:02:00 +02:00
Hu Keping
012b67c3ea CI: use dockerCmd in integration-cli when possible
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-07-22 17:55:41 +08:00
David Calavera
1c3cb2d31e Expose new mount points structs in inspect.
Keep old hashes around for old api version calls.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-21 15:33:05 -07:00
Hu Keping
71868228c7 Refactor : Use dockerCmd in integration-cli tests
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-07-17 04:07:12 +08:00
Alexander Morozov
67058e388b Remove prefix dots from inspects in tests
Dots prepended to key in inspectField function

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-08 12:41:05 -07:00
Qiang Huang
74f8a4eca4 Use inspectField to simplify code
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-18 10:06:13 +08:00
Alexander Morozov
dc944ea7e4 Use suite for integration-cli
It prints test name and duration for each test.
Also performs deleteAllContainers after each test.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-21 10:28:52 -07:00
Brian Goff
475c65319b Remove stripTrailingCharacters from tests
This was just an alias to `strings.TrimSpace`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-06 09:21:18 -04:00
Yuan Sun
f5310f403d Verify MaximumRetryCount=0 if the restart policy is always.
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
2015-03-30 09:08:33 +08:00
s00318865
1339831906 add TestContainerRestartwithGoodContainer test case
Signed-off-by: s00318865 <sunyuan3@huawei.com>
2015-03-19 20:20:04 +08:00
Ahmet Alp Balkan
70407ce40c Better test cleanup with defer
This fixes a few misuses of `deleteAllContainers()` cleanup
method in integration-cli suite by moving call to the
beginning of the method and guaranteeing their execution
(including panics) with `defer`s.

Also added some forgotten cleanup calls while I'm at it.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-20 14:04:36 -08:00
Tibor Vass
752a0d6f34 integration-cli: Fix race in restart loop
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2015-01-22 14:06:24 -05:00
HuKeping
c3ed49dcdb restart: add test for recording restart policy name
Add test for recording restart policy name on
- restart=no
- restart=always
- restart=on-failure

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-01-16 17:58:26 +08:00
Jessica Frazelle
9f52d8e6e7 Cleanup errorOut resp restart tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Alexandr Morozov
1ddd013b19 Use prefix naming for restart tests
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-19 22:11:54 +04:00
Erik Hollensbe
5931669343 fix docker integration-cli restart test race
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-07-28 23:46:14 -07:00
Fabio Falci
9da6c80533 Move docker restart tests to integration cli
Docker-DCO-1.1-Signed-off-by: Fabio Falci <fabiofalci@gmail.com> (github: fabiofalci)
2014-07-02 21:56:19 +01:00