-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not clean up containers by execute DockerCmd(self, 'rm', "container_name").execute() #99
Comments
however it works with below method in other test case, don't know what the difference: |
This is a python-language "feature" where strings are iterable sequences of characters. In other words, containing the string inside a list is key, so:
Both satisfy the "iterable" condition, and because "duck-typing" is used, see http://en.wikipedia.org/wiki/Duck_typing both are accepted as an "iterable". Here's the docstring (which I see is not properly rendered into documentation): https://github.com/autotest/autotest-docker/blob/master/dockertest/dockercmd.py#L29 BTW: I have run into this exact same problem before. Since you've now hit it, it must be more common than I assumed. I'm open if you @ouyanggh have ideas, but I think there are at least two simple solutions here:
|
Here's where the parameter docs are not rendering properly, it's an issue across all of our code with a cut-paste fix: @Lorquas would you mind looking into #1 and #2 above (and any additional ideas you have) for the @jzupka Could you help fix the same documentation (#1) problem in the @ldoktor Could you help fix I'll pick up the remaining modules. Let me know if anyone has questions. |
Documentation fix PR: #100 |
I will use it in a list so far. |
Closing this since fix is in |
it extent the "container_name" into a list ['c', 'o', 'n', 't', 'a', 'i', 'n', 'e', 'r', '_', 'n', 'a', 'm', 'e']:
$ tail -n 7 workdir.py
$ ./autotest-local run docker --args=docker_cli/workdir
17:59:45 INFO | Writing results to /var/www/html/autotest/client/results/default
17:59:46 INFO | START ---- ---- timestamp=1398333586 localtime=Apr 24 17:59:46
17:59:46 INFO | START docker/subtests/docker_cli/workdir.test_1-of-1 docker/subtests/docker_cli/workdir.test_1-of-1 timestamp=1398333586 timeout=600 localtime=Apr 24 17:59:46
17:59:46 INFO | RUNNING ---- ---- timestamp=1398333586 localtime=Apr 24 17:59:46 INFO: initialize()
17:59:46 INFO | RUNNING ---- ---- timestamp=1398333586 localtime=Apr 24 17:59:46 INFO: run_once() iteration 1 of 1
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: postprocess_iteration(), iteration #1
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: postprocess()
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: Commands: /usr/bin/docker -D run --workdir=/var/log --name=exist_dir fedora:20 pwd
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: workdir /var/log set successful for container
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: Commands: /usr/bin/docker -D run --workdir=/tmp/mdAhsaPSTVxC --name=nonexist_dir fedora:20 pwd
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: workdir /tmp/mdAhsaPSTVxC set successful for container
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: Commands: /usr/bin/docker -D run --workdir=tmp/mdAhsaPSTVxC --name=invalid_dir fedora:20 pwd
17:59:50 ERROR| RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 ERROR: Intend to fail:
2014/04/24 17:59:49 The working directory is invalid. It needs to be an absolute path.
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: Commands: /usr/bin/docker -D run --workdir=/etc/hosts --name=file_as_dir fedora:20 pwd
17:59:50 ERROR| RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 ERROR: Intend to fail:
[debug] utils.go:267 [hijack] End of stdout
[debug] commands.go:1905 End of CmdRun(), Waiting for hijack to finish.
2014/04/24 17:59:50 Error: Cannot start container e8f5283749b462491372cfa838ba62be0bcf2d91b1d141b001b0a3cbdc3e82f6: Cannot mkdir: /etc/hosts is not a directory
17:59:50 INFO | RUNNING ---- ---- timestamp=1398333590 localtime=Apr 24 17:59:50 INFO: cleanup()
17:59:50 INFO | * Command:
17:59:50 INFO | /usr/bin/docker -D rm e x i s t _ d i r
17:59:50 INFO | Exit status: 1
17:59:50 INFO | Duration: 0.019348859787
17:59:50 INFO |
17:59:50 INFO | stderr:
17:59:50 INFO | Error: No such container: e
17:59:50 INFO | Error: No such container: x
17:59:50 INFO | Error: No such container: i
17:59:50 INFO | Error: No such container: s
17:59:50 INFO | Error: No such container: t
17:59:50 INFO | Error: No such container: _
17:59:50 INFO | Error: No such container: d
17:59:50 INFO | Error: No such container: i
17:59:50 INFO | Error: No such container: r
17:59:50 INFO | 2014/04/24 17:59:50 Error: failed to remove one or more containers
17:59:52 INFO | GOOD docker/subtests/docker_cli/workdir.test_1-of-1 docker/subtests/docker_cli/workdir.test_1-of-1 timestamp=1398333592 localtime=Apr 24 17:59:52 completed successfully
17:59:52 INFO | END GOOD docker/subtests/docker_cli/workdir.test_1-of-1 docker/subtests/docker_cli/workdir.test_1-of-1 timestamp=1398333592 localtime=Apr 24 17:59:52
17:59:52 INFO | END GOOD ---- ---- timestamp=1398333592 localtime=Apr 24 17:59:52
17:59:52 INFO | Report successfully generated at /var/www/html/autotest/client/results/default/job_report.html
The text was updated successfully, but these errors were encountered: