Commit graph

114 commits

Author SHA1 Message Date
Kir Kolyshkin
a83a769347 Simplify and fix os.MkdirAll() usage
TL;DR: check for IsExist(err) after a failed MkdirAll() is both
redundant and wrong -- so two reasons to remove it.

Quoting MkdirAll documentation:

> MkdirAll creates a directory named path, along with any necessary
> parents, and returns nil, or else returns an error. If path
> is already a directory, MkdirAll does nothing and returns nil.

This means two things:

1. If a directory to be created already exists, no error is returned.

2. If the error returned is IsExist (EEXIST), it means there exists
a non-directory with the same name as MkdirAll need to use for
directory. Example: we want to MkdirAll("a/b"), but file "a"
(or "a/b") already exists, so MkdirAll fails.

The above is a theory, based on quoted documentation and my UNIX
knowledge.

3. In practice, though, current MkdirAll implementation [1] returns
ENOTDIR in most of cases described in #2, with the exception when
there is a race between MkdirAll and someone else creating the
last component of MkdirAll argument as a file. In this very case
MkdirAll() will indeed return EEXIST.

Because of #1, IsExist check after MkdirAll is not needed.

Because of #2 and #3, ignoring IsExist error is just plain wrong,
as directory we require is not created. It's cleaner to report
the error now.

Note this error is all over the tree, I guess due to copy-paste,
or trying to follow the same usage pattern as for Mkdir(),
or some not quite correct examples on the Internet.

[v2: a separate aufs commit is merged into this one]

[1] https://github.com/golang/go/blob/f9ed2f75/src/os/path.go

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2015-07-30 11:48:08 -07:00
Doug Davis
8c9cd0418d Merge pull request #15045 from cpuguy83/fix_dockercmdwitherror
Don't pass check.C to dockerCmdWithError
2015-07-27 16:04:16 -04:00
Brian Goff
693ba98cb9 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-27 14:33:32 -04:00
Josh Hawn
d06ffd0a5f [integration-cli] fix windows build test cases
Use the same IP as the DOCKER_HOST when making a remote file server.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-07-27 11:30:38 -07:00
Jessie Frazelle
70842ea942 Merge pull request #14899 from mountkin/fix-exec-resize-panic
fix the panic caused by resizing a starting exec
2015-07-27 10:27:29 -07:00
Nathan McCauley
268fa5af47 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-24 16:31:18 -07:00
Derek McGowan
871d2b96ed Add build integration cli tests
Clean up tests to remove duplicate code

Add tests which run pull and create in an isolated configuration directory.
Add build test for untrusted tag

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-24 16:31:12 -07:00
Derek McGowan
58a1de9b59 Add integration cli trust tests
Added notary server to docker base image.
Created trust suite which runs trust server for running trusted commands.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-24 14:08:20 -07:00
Shijiang Wei
ba5e098052 fix the panic caused by resizing a starting exec
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-07-24 20:43:07 +08:00
Shishir Mahajan
e7fc632147 Add and modify tests for legacy and new daemon invokations
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-23 20:31:43 -04:00
John Howard
09b86c46b8 Stop SIGSEGV on test dial not reachable
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-22 18:44:04 -07:00
Ben Firshman
6b3c928140 Fix golint warnings for integration-cli
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-07-22 14:03:50 +01: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
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
Lei
c6cde91b7d Add dockerCmdWithStdoutStderr function
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-07-18 10:48:28 +08:00
Vincent Demeester
4290bdefab Add dockerCmdWithError
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-14 08:35:06 +02:00
Qiang Huang
d28b0ba115 Fix file leak in integration-cli
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-07-09 18:52:18 +08:00
Shijiang Wei
1cbf5a54da fix the goroutine leak in the stats API if the container is not running
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-06-23 19:38:15 +08:00
Moysés Borges
d48bface59 Support downloading remote tarball contexts in builder jobs.
Signed-off-by: Moysés Borges <moysesb@gmail.com>
2015-06-19 16:35:00 -03:00
Michael Käufl
54ac3d9c76 Made doc consistent with code
The name of the folder was shortened in a1ea562

Signed-off-by: Michael Käufl <docker@c.michael-kaeufl.de>
2015-06-07 22:32:29 +02:00
David Calavera
6c42b3947a Merge pull request #12838 from fntlnz/test-cmd
Using dockerCmd when possible
2015-06-02 14:12:22 -07:00
Jessica Frazelle
a1ea562b20 lol 108 chars ETOOMANY
Signed-off-by: Jessica Frazelle <princess@docker.com>
2015-05-22 10:10:17 -07:00
Lorenzo Fontana
a2787469ac Using dockerCmd when possible
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
2015-05-19 20:33:59 +02:00
Jessie Frazelle
d0bc0153c6 Merge pull request #12278 from duglin/12267-Wildcards
Fix for Daemon crashing when wildcards are used for COPY/ADD
2015-05-07 17:01:16 -07:00
Arnaud Porterie
44de5fecce Add DOCKER_USERLANDPROXY test variable
Add an convenient way to switch --userland-proxy on and off in
integration tests.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-05-04 16:07:51 -07:00
Madhu Venugopal
dd0666e64f Integration Tests for --icc=false & container Linking using --expose
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-04-29 10:16:31 -07:00
Madhu Venugopal
f3f5ff9d83 Integration tests for --bridge daemon flag
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-04-29 09:55:25 -07:00
Doug Davis
82daa43844 Fix for Daemon crashing when wildcards are used for COPY/ADD
in the filename and the command itself

Closes #12267

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-27 19:09:57 -07:00
Antonio Murdaca
bb1c576eb3 Expose whole Response struct in sockRequestRaw
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-27 18:49:00 +02:00
Phil Estes
6e9a6f5396 Merge pull request #12765 from LK4D4/registry_suite
Implement DockerRegistrySuite in integration-cli
2015-04-24 23:05:29 -04:00
Alexander Morozov
f696b1071a Implement DockerRegistrySuite in integration-cli
To avoid manually creating and destroying registrys in tests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 14:17:00 -07:00
Alexander Morozov
9bea123bdd Not protect dangling images for integration-cli
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 13:16:51 -07:00
Brian Goff
b76bbae413 Merge pull request #12755 from LK4D4/use_f_for_remove
Use -f for rm instead of kill before
2015-04-24 15:34:38 -04:00
Alexander Morozov
887ad57cfa Use -f for rm instead of kill before
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 11:55:54 -07:00
Alexander Morozov
a9688cdca5 Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 10:37:21 -07:00
Megan Kostick
c7845e27ee Fixing statusCode checks for sockRequest
Signed-off-by: Megan Kostick <mkostick@us.ibm.com>
2015-04-23 15:35:56 -07:00
Jessie Frazelle
59ae92d55c Merge pull request #12575 from brahmaroutu/integration_test7_12255
Move https tests as unit tests under client
2015-04-23 13:17:54 -07:00
Jessie Frazelle
59acccb6f2 Merge pull request #12692 from cpuguy83/fix_commit_test
Fix race with TestContainerApiCommit
2015-04-23 11:31:27 -07:00
Srini Brahmaroutu
05013f1250 Move https integration tests as unit tests under client
Addresses #12255
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-04-23 15:40:46 +00:00
Brian Goff
563708d78d Fix race with TestContainerApiCommit
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-23 09:45:06 -04:00
Antonio Murdaca
4b9fe9c298 Remove job from container_inspect
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-23 00:58:13 +02: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
bobby abbott
621b601b3c Removed unnecessary error output from dockerCmd
Changed method declaration. Fixed all calls to dockerCmd
method to reflect the change.

resolves #12355

Signed-off-by: bobby abbott <ttobbaybbob@gmail.com>
2015-04-17 09:11:14 -07:00
Brian Goff
5dc02a2fa8 Move TestPostJsonVerify to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:49:28 -04:00
Brian Goff
8232cc777e Make sockRequestRaw return reader, not []byte
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:40:49 -04:00
Antonio Murdaca
91bfed6049 Remove job from logs
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-13 08:25:31 +02:00
Yuan Sun
8636a21991 add TestContainerApiPause case
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
2015-04-10 09:14:01 +08:00
Jessica Frazelle
255b84444a cleanup/fix integration-cli for overlay in overlay
Signed-off-by: Jessica Frazelle <jess@docker.com>
2015-04-08 16:59:36 -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
paul
c5bf2145f1 Fix vet warning
Signed-off-by: Paul Mou <ppymou@gmail.com>
2015-03-25 20:31:02 -07:00