Commit Graph

114 Commits

Author SHA1 Message Date
3c8e934faf 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>
Upstream-commit: a83a76934787a20e96389d33bd56a09369f9b808
Component: engine
2015-07-30 11:48:08 -07:00
c3325b7678 Merge pull request #15045 from cpuguy83/fix_dockercmdwitherror
Don't pass check.C to dockerCmdWithError
Upstream-commit: 8c9cd0418d1baa5ceddec58e3a4873607e9cafcd
Component: engine
2015-07-27 16:04:16 -04:00
6e14356132 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 693ba98cb9118bf15caaabc69ca281c0ce604226
Component: engine
2015-07-27 14:33:32 -04:00
083f0a374e [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)
Upstream-commit: d06ffd0a5f5d55dacc369fc6560316e9f17e2cac
Component: engine
2015-07-27 11:30:38 -07:00
6f66e6db3b Merge pull request #14899 from mountkin/fix-exec-resize-panic
fix the panic caused by resizing a starting exec
Upstream-commit: 70842ea942326b2a3be3b504a7f5038ba68f07f1
Component: engine
2015-07-27 10:27:29 -07:00
937cba2db1 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 268fa5af4768f7b1df32501d5f7ba0daba2c2da1
Component: engine
2015-07-24 16:31:18 -07:00
97834446bf 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)
Upstream-commit: 871d2b96ed5cf234c41a5e731a34fc9deda4e9f1
Component: engine
2015-07-24 16:31:12 -07:00
b82ed8bb95 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)
Upstream-commit: 58a1de9b59594948df152f0003e759b77bcaa56a
Component: engine
2015-07-24 14:08:20 -07:00
a1d7796250 fix the panic caused by resizing a starting exec
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: ba5e0980527d3477cb85925e07eecb28dfe50e08
Component: engine
2015-07-24 20:43:07 +08:00
4f814a612a 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>
Upstream-commit: e7fc632147e40f5a243158e8378082c51a3d952e
Component: engine
2015-07-23 20:31:43 -04:00
caa155ce8e Stop SIGSEGV on test dial not reachable
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 09b86c46b82e3d116840f3327a1f995b904ecfa4
Component: engine
2015-07-22 18:44:04 -07:00
6aa4de764e Fix golint warnings for integration-cli
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: 6b3c928140193f911b73f87bb8b07f54bba5a63a
Component: engine
2015-07-22 14:03:50 +01:00
2d8d0361a7 Merge pull request #13711 from calavera/version_volumes_inspect
Expose new mount points structs in inspect.
Upstream-commit: 50d2597e490c4636ee8cacabf34bb9ed3e21d3fc
Component: engine
2015-07-22 09:02:00 +02:00
b821d19c27 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>
Upstream-commit: 1c3cb2d31ea722e2c174bf78eda62fec6949fb8b
Component: engine
2015-07-21 15:33:05 -07:00
Lei
4c5a8b7b16 Add dockerCmdWithStdoutStderr function
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: c6cde91b7d2cb3671dc55cafc5ab693f9cb17cc8
Component: engine
2015-07-18 10:48:28 +08:00
a95d0e254d Add dockerCmdWithError
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4290bdefabc46d6faada968ef7ddba1d3c21dcca
Component: engine
2015-07-14 08:35:06 +02:00
9c6eed3d0d Fix file leak in integration-cli
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: d28b0ba115f44f7a49cfc442d5eff146e57c3167
Component: engine
2015-07-09 18:52:18 +08:00
eb72177bf2 fix the goroutine leak in the stats API if the container is not running
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: 1cbf5a54dae86e34d8e65508c5640b17cda0eed8
Component: engine
2015-06-23 19:38:15 +08:00
265055473c Support downloading remote tarball contexts in builder jobs.
Signed-off-by: Moysés Borges <moysesb@gmail.com>
Upstream-commit: d48bface59ef28aedc692c1f7c51a7ddde94a7fe
Component: engine
2015-06-19 16:35:00 -03:00
42682fb818 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>
Upstream-commit: 54ac3d9c76df3bbbb54b85b58a503cc1d6155f01
Component: engine
2015-06-07 22:32:29 +02:00
0fb31101e8 Merge pull request #12838 from fntlnz/test-cmd
Using dockerCmd when possible
Upstream-commit: 6c42b3947a6ad91fc487ba34fec634e9f5c48aea
Component: engine
2015-06-02 14:12:22 -07:00
d2b122f94a lol 108 chars ETOOMANY
Signed-off-by: Jessica Frazelle <princess@docker.com>
Upstream-commit: a1ea562b20b36345be2048ea24130b48cf4ec734
Component: engine
2015-05-22 10:10:17 -07:00
15949eba4d Using dockerCmd when possible
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
Upstream-commit: a2787469ac45085cc28a56f67b7c0a50bead893f
Component: engine
2015-05-19 20:33:59 +02:00
f08d29d6d6 Merge pull request #12278 from duglin/12267-Wildcards
Fix for Daemon crashing when wildcards are used for COPY/ADD
Upstream-commit: d0bc0153c637f0e61207fa90b0346174cd5e92e3
Component: engine
2015-05-07 17:01:16 -07:00
afd229a538 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>
Upstream-commit: 44de5fecce9dd194fade1b696e9297ac5c985754
Component: engine
2015-05-04 16:07:51 -07:00
0976611d84 Integration Tests for --icc=false & container Linking using --expose
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: dd0666e64f17329355c77aae1a2ac0fe2fe43402
Component: engine
2015-04-29 10:16:31 -07:00
2a71cc5aaf Integration tests for --bridge daemon flag
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: f3f5ff9d837eecb97eeeb878f0bd416b6ab57cf2
Component: engine
2015-04-29 09:55:25 -07:00
741aa30caf 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>
Upstream-commit: 82daa43844556953101b201bc5983aed4fbe6233
Component: engine
2015-04-27 19:09:57 -07:00
d1facd32fc Expose whole Response struct in sockRequestRaw
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: bb1c576eb3024f7fb4242d76dc835b7c4dd85c5b
Component: engine
2015-04-27 18:49:00 +02:00
8d345fadf2 Merge pull request #12765 from LK4D4/registry_suite
Implement DockerRegistrySuite in integration-cli
Upstream-commit: 6e9a6f53963137e21ba790ab79501a7cd8ed5b96
Component: engine
2015-04-24 23:05:29 -04:00
a2a6303a84 Implement DockerRegistrySuite in integration-cli
To avoid manually creating and destroying registrys in tests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: f696b1071a296bee1f4ac7cafa807ce337fb9f2c
Component: engine
2015-04-24 14:17:00 -07:00
54dc746ae6 Not protect dangling images for integration-cli
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 9bea123bddb9d2ce8b2aa517c2a2a4b269ed39bc
Component: engine
2015-04-24 13:16:51 -07:00
9fc945a9c1 Merge pull request #12755 from LK4D4/use_f_for_remove
Use -f for rm instead of kill before
Upstream-commit: b76bbae4138e7b66022092631d6afb7cfc88a486
Component: engine
2015-04-24 15:34:38 -04:00
785df704ce Use -f for rm instead of kill before
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 887ad57cfa46df542001a1bb4e3ab052ce5f5ed9
Component: engine
2015-04-24 11:55:54 -07:00
c48fdf0abd Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a9688cdca5577d6db65d76f38bcbe4c1e6f5994f
Component: engine
2015-04-24 10:37:21 -07:00
74db1507f9 Fixing statusCode checks for sockRequest
Signed-off-by: Megan Kostick <mkostick@us.ibm.com>
Upstream-commit: c7845e27ee2b0462b01d043caeb771f21d5e4ac7
Component: engine
2015-04-23 15:35:56 -07:00
c2fd04b393 Merge pull request #12575 from brahmaroutu/integration_test7_12255
Move https tests as unit tests under client
Upstream-commit: 59ae92d55c4b074db31698c1bc05e2114dc3106c
Component: engine
2015-04-23 13:17:54 -07:00
68210d0ad0 Merge pull request #12692 from cpuguy83/fix_commit_test
Fix race with TestContainerApiCommit
Upstream-commit: 59acccb6f2dae4659797636196dfde7263789923
Component: engine
2015-04-23 11:31:27 -07:00
ab3ddde4ab Move https integration tests as unit tests under client
Addresses #12255
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 05013f1250dc141ed43f987dd8b6a650d0e47ac9
Component: engine
2015-04-23 15:40:46 +00:00
a10a6cc648 Fix race with TestContainerApiCommit
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 563708d78d42afe89374d5819fdb671ed72c2dad
Component: engine
2015-04-23 09:45:06 -04:00
fdf9a8d629 Remove job from container_inspect
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 4b9fe9c298c8778855c1d14e978c791496dd7c42
Component: engine
2015-04-23 00:58:13 +02:00
1884ef3b9b 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>
Upstream-commit: dc944ea7e48d11a2906e751d3e61daf08faee054
Component: engine
2015-04-21 10:28:52 -07:00
5e15f55a29 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>
Upstream-commit: 621b601b3c602aab5ef0f07903fdf413881bb261
Component: engine
2015-04-17 09:11:14 -07:00
6688a2d031 Move TestPostJsonVerify to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 5dc02a2fa8819b3a61bcd5a6fedcfb1a5e64cba5
Component: engine
2015-04-16 13:49:28 -04:00
c48f58ea6d Make sockRequestRaw return reader, not []byte
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 8232cc777e329a47e123dbdc42411dae65288a80
Component: engine
2015-04-16 13:40:49 -04:00
b3c5a7d38d Remove job from logs
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 91bfed604959c591a076c2e330cb3ded7443f504
Component: engine
2015-04-13 08:25:31 +02:00
cbe9a536c0 add TestContainerApiPause case
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Upstream-commit: 8636a219911536123decb547dab9bf50ebb2c8f8
Component: engine
2015-04-10 09:14:01 +08:00
0d1c1d0efa cleanup/fix integration-cli for overlay in overlay
Signed-off-by: Jessica Frazelle <jess@docker.com>
Upstream-commit: 255b84444a86201995d8f688d71b83822f146c3e
Component: engine
2015-04-08 16:59:36 -07:00
ab9a366f0e Remove stripTrailingCharacters from tests
This was just an alias to `strings.TrimSpace`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 475c65319b4663d630711519e18d0b134c42c7f1
Component: engine
2015-04-06 09:21:18 -04:00
8f2d65bf21 Fix vet warning
Signed-off-by: Paul Mou <ppymou@gmail.com>
Upstream-commit: c5bf2145f172a264d3d8fc63d6717826b95b5ee2
Component: engine
2015-03-25 20:31:02 -07:00