Commit graph

253 commits

Author SHA1 Message Date
Tonis Tiigi
0d88d5b64b Swarm integration tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-06-13 22:16:18 -07:00
Ben Firshman
322e2a7d05 Return remote API errors as JSON
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-06-07 18:45:27 -07:00
Vincent Demeester
428328908d
Deprecate /containers/(id or name)/copy endpoint
This endpoint has been deprecated since 1.8. Return an error starting
from this API version (1.24) in order to make sure it's not used for the
next API version and so that we can remove it some times later.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-03 19:38:03 +02:00
Shijiang Wei
0a8386c8be remove deprecated feature of passing HostConfig at API container start
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-06-01 22:25:17 +08:00
Yong Tang
9d8071a74d Docker http panics caused by container deletion with empty names.
This fix tries to fix the http panics caused by container deletion
with empty names in #22210.

The issue was because when an empty string was passed, `GetByName()`
tried to access the first element of the name string without checking
the length. A length check has been added.

A test case for #22210 has been added.

This fix fixes #22210.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-04-21 07:53:49 -07:00
John Howard
d691b4af18 Windows: Timeout TestContainerApiPostContainerStop
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-12 18:21:54 -07:00
Rodolfo Carvalho
fee7e7c7a3 Fix a typo in hostConfig.ShmSize validation
Other places referring to the same configuration, including docs, have
the correct spelling.

Signed-off-by: Rodolfo Carvalho <rhcarvalho@gmail.com>
2016-04-12 16:45:05 +02:00
John Howard
b0e24c7393 Windows: Remove TP4 support from test code
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-11 15:36:31 -07:00
Qiang Huang
aae4bcf773 Remove dot in suffix to avoid double dot error message
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-22 09:17:54 +08:00
Sebastiaan van Stijn
b211e57f23 Merge pull request #20774 from hqhq/hq_vender_engine_api
Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
2016-02-29 18:48:55 +01:00
Qiang Huang
53b0d62683 Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-29 19:28:37 +08: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
David Calavera
a793564b25 Remove static errors from errors package.
Moving all strings to the errors package wasn't a good idea after all.

Our custom implementation of Go errors predates everything that's nice
and good about working with errors in Go. Take as an example what we
have to do to get an error message:

```go
func GetErrorMessage(err error) string {
	switch err.(type) {
	case errcode.Error:
		e, _ := err.(errcode.Error)
		return e.Message

	case errcode.ErrorCode:
		ec, _ := err.(errcode.ErrorCode)
		return ec.Message()

	default:
		return err.Error()
	}
}
```

This goes against every good practice for Go development. The language already provides a simple, intuitive and standard way to get error messages, that is calling the `Error()` method from an error. Reinventing the error interface is a mistake.

Our custom implementation also makes very hard to reason about errors, another nice thing about Go. I found several (>10) error declarations that we don't use anywhere. This is a clear sign about how little we know about the errors we return. I also found several error usages where the number of arguments was different than the parameters declared in the error, another clear example of how difficult is to reason about errors.

Moreover, our custom implementation didn't really make easier for people to return custom HTTP status code depending on the errors. Again, it's hard to reason about when to set custom codes and how. Take an example what we have to do to extract the message and status code from an error before returning a response from the API:

```go
	switch err.(type) {
	case errcode.ErrorCode:
		daError, _ := err.(errcode.ErrorCode)
		statusCode = daError.Descriptor().HTTPStatusCode
		errMsg = daError.Message()

	case errcode.Error:
		// For reference, if you're looking for a particular error
		// then you can do something like :
		//   import ( derr "github.com/docker/docker/errors" )
		//   if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }

		daError, _ := err.(errcode.Error)
		statusCode = daError.ErrorCode().Descriptor().HTTPStatusCode
		errMsg = daError.Message

	default:
		// This part of will be removed once we've
		// converted everything over to use the errcode package

		// FIXME: this is brittle and should not be necessary.
		// If we need to differentiate between different possible error types,
		// we should create appropriate error types with clearly defined meaning
		errStr := strings.ToLower(err.Error())
		for keyword, status := range map[string]int{
			"not found":             http.StatusNotFound,
			"no such":               http.StatusNotFound,
			"bad parameter":         http.StatusBadRequest,
			"conflict":              http.StatusConflict,
			"impossible":            http.StatusNotAcceptable,
			"wrong login/password":  http.StatusUnauthorized,
			"hasn't been activated": http.StatusForbidden,
		} {
			if strings.Contains(errStr, keyword) {
				statusCode = status
				break
			}
		}
	}
```

You can notice two things in that code:

1. We have to explain how errors work, because our implementation goes against how easy to use Go errors are.
2. At no moment we arrived to remove that `switch` statement that was the original reason to use our custom implementation.

This change removes all our status errors from the errors package and puts them back in their specific contexts.
IT puts the messages back with their contexts. That way, we know right away when errors used and how to generate their messages.
It uses custom interfaces to reason about errors. Errors that need to response with a custom status code MUST implementent this simple interface:

```go
type errorWithStatus interface {
	HTTPErrorStatusCode() int
}
```

This interface is very straightforward to implement. It also preserves Go errors real behavior, getting the message is as simple as using the `Error()` method.

I included helper functions to generate errors that use custom status code in `errors/errors.go`.

By doing this, we remove the hard dependency we have eeverywhere to our custom errors package. Yes, you can use it as a helper to generate error, but it's still very easy to generate errors without it.

Please, read this fantastic blog post about errors in Go: http://dave.cheney.net/2014/12/24/inspecting-errors

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-26 15:49:09 -05:00
Tibor Vass
f4a1e3db99 Support TLS remote test daemon
This will allow us to have a windows-to-linux CI, where the linux host
can be anywhere, connecting with TLS.

Signed-off-by: Tibor Vass <tibor@docker.com>
2016-02-25 14:12:17 -05:00
Stefan Weil
2eee613326 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-02-22 20:27:15 +01:00
Brian Goff
3434860d54 Fix horribly broken TestGetContainerStatsNoStream
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-09 14:25:05 -05:00
Zhang Wei
9a9ce80a0f Fix flaky test TestGetContainerStatsRmRunning
Remove racey code to fix flaky test

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-01-31 15:34:22 +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
Arnaud Porterie
777ee34b07 Factorize sleeping containers
Add `runSleepingContainer` and `runSleepingContainerInImage` helper
functions to factor out the way to run system-specific idle containers.

Define a sleeping container as command `top` in image `busybox` for
Unix and as command `sleep 60` in image `busybox` for Windows. Provide a
single point of code to update those.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-01-27 08:48:08 -08:00
John Howard
916b9db71d Windows CI: Darn it, I broke due to multiple declarations
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-26 19:58:53 -08:00
Sebastiaan van Stijn
3cf4884787 Merge pull request #19612 from Microsoft/jjh/apicontainerstest
Windows CI: Fixup docker_api_containers_test.go
2016-01-26 19:14:43 -08:00
Alessandro Boch
cfa515fd9d Reject multiple networks on container creation
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-01-25 12:50:01 -08:00
John Howard
2b0a742237 Windows CI: Fix api_containers_test.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-23 14:40:25 -08:00
Sebastiaan van Stijn
c72be040bb Merge pull request #19187 from estesp/lets-do-this
User namespaces: graduate from experimental
2016-01-12 09:34:19 -08:00
Alexander Morozov
9a23569ecf Merge pull request #16032 from cpuguy83/remove_sqlite_dep
Build names and links at runtime - no more sqlite
2016-01-11 10:59:49 -08:00
John Howard
25c383391a Windows CI: Deal with failing tests for TP4
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-08 13:49:43 -08:00
Phil Estes
557c7cb888 Move userns support out of experimental into master
Adds the `--userns-remap` flag to the master build

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-01-08 15:06:22 -05:00
Brian Goff
0f9f99500c Build names and links at runtime
Don't rely on sqlite db for name registration and linking.
Instead register names and links when the daemon starts to an in-memory
store.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-01-07 14:10:42 -05:00
David Calavera
907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
Anusha Ragunathan
5190794f1d Use ImageBuildOptions in builder.
dockerfile.Config is almost redundant with ImageBuildOptions.
Unify the two so that the latter can be removed. This also
helps build's API endpoint code to be less dependent on package
dockerfile.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-01-05 10:09:34 -08:00
David Calavera
7ac4232e70 Move Config and HostConfig from runconfig to types/container.
- Make the API client library completely standalone.
- Move windows partition isolation detection to the client, so the
  driver doesn't use external types.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:34:30 -05:00
Ahmet Alp Balkan
755f8609f6 Add containers’ networks to /containers/json
After addition of multi-host networking in Docker 1.9, Docker Remote
API is still returning only the network specified during creation
of the container in the “List Containers” (`/containers/json`) endpoint:

    ...
    "HostConfig": {
      "NetworkMode": "default"
    },

The list of networks containers are attached to is only available at
Get Container (`/containers/<id>/json`) endpoint.
This does not allow applications utilizing multi-host networking to
be built on top of Docker Remote API.

Therefore I added a simple `"NetworkSettings"` section to the
`/containers/json` endpoint. This is not identical to the NetworkSettings
returned in Get Container (`/containers/<id>/json`) endpoint. It only
contains a single field `"Networks"`, which is essentially the same
value shown in inspect output of a container.

This change adds the following section to the `/containers/json`:

    "NetworkSettings": {
      "Networks": {
        "bridge": {
          "EndpointID": "2cdc4edb1ded3631c81f57966563e...",
          "Gateway": "172.17.0.1",
          "IPAddress": "172.17.0.2",
          "IPPrefixLen": 16,
          "IPv6Gateway": "",
          "GlobalIPv6Address": "",
          "GlobalIPv6PrefixLen": 0,
          "MacAddress": "02:42:ac:11:00:02"
        }
      }
    }

This is of type `SummaryNetworkSettings` type, a minimal version of
`api/types#NetworkSettings`.

Actually all I need is the network name and the IPAddress fields. If folks
find this addition too big, I can create a `SummaryEndpointSettings` field
as well, containing just the IPAddress field.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-12-14 19:03:23 -08:00
Wen Cheng Ma
c424c8c32c Correct the message of ErrorCodeNoSuchContainer to "No such container"
Fixes issue #18424

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
2015-12-04 15:00:08 +08:00
Jessica Frazelle
4354b348ad
fix default shm size in test
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-12-02 12:43:51 -08:00
Arnaud Porterie
8f1f53f735 Merge pull request #16277 from runcom/add-oom-score-adj
Add OomScoreAdj
2015-12-02 11:49:51 -08:00
Brian Goff
f411b101ac Merge pull request #18285 from hqhq/hq_fix_swappiness
Set default MemorySwappiness when adapt
2015-12-02 14:25:08 -05:00
Dan Walsh
b3e527dfd2 This patch adds --tmpfs as a option for mounting tmpfs on directories
It will Tar up contents of child directory onto tmpfs if mounted over

This patch will use the new PreMount and PostMount hooks to "tar"
up the contents of the base image on top of tmpfs mount points.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2015-12-02 10:06:59 -05:00
Antonio Murdaca
2969abc6c5 Move defaultSHMSize in daemon pkg
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-12-02 10:28:10 +01:00
Qiang Huang
4089b4e440 Set default MemorySwappiness when adapt
It makes the inspect result consistent between cli and REST api
when MemorySwappiness is not set.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-12-02 10:53:52 +08:00
Antonio Murdaca
ef1d410b02 fix shm size handling
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-12-01 16:29:40 +01:00
Tibor Vass
c247b3d104 Merge pull request #18318 from calavera/fix_dns_setting_on_hostconfig_start
Make sure container start doesn't make the DNS fields nil.
2015-12-01 12:43:16 +01:00
David Calavera
d7117a1b71 Make sure container start doesn't make the DNS fields nil.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-11-30 22:46:31 -05:00
Aditi Rajagopal
4bdf957c26 Checkers on docker_api_containers_test
Applying #16756 to integration-cli/docker_api_containers_test.go

Signed-off-by: Aditi Rajagopal <arajagopal@us.ibm.com>
2015-11-30 14:31:48 -06:00
Antonio Murdaca
d3af7f283d Add OomScoreAdj to configure container oom killer preferences
libcontainer v0.0.4 introduces setting `/proc/self/oom_score_adj` to
better tune oom killing preferences for container process. This patch
simply integrates OomScoreAdj libcontainer's config option and adjust
the cli with this new option.

Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-11-30 11:19:04 +01:00
Tonis Tiigi
4352da7803 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-24 09:40:25 -08:00
Daehyeok Mun
a9afebae62 Modified cpuset test for unicore test environment
Modified TestInspectApiCpusetInConfigPre120 and
TestContainerApiCreateWithCpuSharesCpuset for working on unicore cpu
environment.

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2015-11-17 13:28:09 -07:00
Jessica Frazelle
ea3afdad61 add test-integration-cli specifics for userns
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-10-09 20:50:27 -04:00
Antonio Murdaca
94464e3a5e Validate --cpuset-cpus, --cpuset-mems
Before this patch libcontainer badly errored out with `invalid
argument` or `numerical result out of range` while trying to write
to cpuset.cpus or cpuset.mems with an invalid value provided.
This patch adds validation to --cpuset-cpus and --cpuset-mems flag along with
validation based on system's available cpus/mems before starting a container.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-27 16:38:58 +02:00
John Howard
e65a7dabb9 Fixes 16556 CI failures
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-24 11:19:00 -07:00
John Howard
5d630abbab TestRandomUnixTmpDirPath platform agnostic
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-24 09:37:07 -07: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
Antonio Murdaca
26bd5e3a2d Fix GET /containers/json emtpy response regression
GET /containers/json route used to reply with and empty array `[]` when no
containers where available. Daemon containers list refactor introduced
this bug by declaring an empty slice istead of initializing it as well
and it was now replying with `null`.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-18 18:44:46 +02:00
Vincent Demeester
5109071706 Add unit tests for integration cli utils function
- utils_test.go and docker_utils_test.go
- Moved docker related function to docker_utils.go
- add a test for integration-cli/checker

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-09-09 15:36:44 +02: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
Shijiang Wei
96e37f671a split build API tests to a separate file
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-08-23 23:59:15 +08: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
Zhang Wei
3d6617ffe7 fix golint warnings/errors on package api/types/
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-08-07 09:43:43 +08:00
Josh Hawn
75f6929b44 Fix docker cp Behavior With Symlinks
[pkg/archive] Update archive/copy path handling

  - Remove unused TarOptions.Name field.
  - Add new TarOptions.RebaseNames field.
  - Update some of the logic around path dir/base splitting.
  - Update some of the logic behind archive entry name rebasing.

[api/types] Add LinkTarget field to PathStat

[daemon] Fix stat, archive, extract of symlinks

  These operations *should* resolve symlinks that are in the path but if the
  resource itself is a symlink then it *should not* be resolved. This patch
  puts this logic into a common function `resolvePath` which resolves symlinks
  of the path's dir in scope of the container rootfs but does not resolve the
  final element of the path. Now archive, extract, and stat operations will
  return symlinks if the path is indeed a symlink.

[api/client] Update cp path hanling

[docs/reference/api] Update description of stat

  Add the linkTarget field to the header of the archive endpoint.
  Remove path field.

[integration-cli] Fix/Add cp symlink test cases

  Copying a symlink should do just that: copy the symlink NOT
  copy the target of the symlink. Also, the resulting file from
  the copy should have the name of the symlink NOT the name of
  the target file.

  Copying to a symlink should copy to the symlink target and not
  modify the symlink itself.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-07-30 12:14:28 -07: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
Stephen Rust
c358a4cd35 Check for nil before using HostConfig to adjustCpuShares
Fix #14915. Add unit test for #14915.
Thanks @runcom for the test case: when the client calls 1.18 api
version w/o hostconfig it results in a nil pointer dereference.

Signed-off-by: Stephen Rust <srust@blockbridge.com>
2015-07-26 20:33:04 -04:00
Antonio Murdaca
18faf6f94e Ensure body is closed after error is checked
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-07-23 14:34:38 +02: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
Jessie Frazelle
ff011ededb Merge pull request #14804 from dave-tucker/golint_nat
golint: Fix issues in pkg/nat
2015-07-21 20:38:40 -07:00
Jessie Frazelle
06162fed8b Merge pull request #14822 from runcom/host-config-links-on-start
Allow starting a container with an existing hostConfig which contains links
2015-07-21 20:06:26 -07:00
Dave Tucker
15d01d6e6c golint: Fix issues in pkg/nat
Updates #14756

Signed-off-by: Dave Tucker <dt@docker.com>
2015-07-22 00:47:41 +01: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
Antonio Murdaca
65121e5fce Allow starting a container with an existing hostConfig which contains links
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-07-21 22:10:00 +02:00
Doug Davis
12b6083c8f Remove panic in nat package on invalid hostport
Closes #14621

This one grew to be much more than I expected so here's the story... :-)
- when a bad port string (e.g. xxx80) is passed into container.create()
  via the API it wasn't being checked until we tried to start the container.
- While starting the container we trid to parse 'xxx80' in nat.Int()
  and would panic on the strconv.ParseUint().  We should (almost) never panic.
- In trying to remove the panic I decided to make it so that we, instead,
  checked the string during the NewPort() constructor.  This means that
  I had to change all casts from 'string' to 'Port' to use NewPort() instead.
  Which is a good thing anyway, people shouldn't assume they know the
  internal format of types like that, in general.
- This meant I had to go and add error checks on all calls to NewPort().
  To avoid changing the testcases too much I create newPortNoError() **JUST**
  for the testcase uses where we know the port string is ok.
- After all of that I then went back and added a check during container.create()
  to check the port string so we'll report the error as soon as we get the
  data.
- If, somehow, the bad string does get into the metadata we will generate
  an error during container.start() but I can't test for that because
  the container.create() catches it now.  But I did add a testcase for that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-07-17 13:02:54 -07:00
Vincent Demeester
5c295460da Use dockerCmd when possible (#14603)
- integration-cli/docker_cli_attach_test.go
- integration-cli/docker_cli_attach_unix_test.go
- integration-cli/docker_cli_build_test.go
- integration-cli/docker_cli_build_unix_test.go
- integration-cli/docker_cli_by_digest_test.go
- integration-cli/docker_cli_commit_test.go
- integration-cli/docker_cli_config_test.go
- integration-cli/docker_cli_cp_test.go
- integration-cli/docker_cli_create_test.go
- integration-cli/docker_cli_pause_test.go
- integration-cli/docker_cli_port_test.go
- integration-cli/docker_cli_port_unix_test.go
- integration-cli/docker_cli_proxy_test.go
- integration-cli/docker_cli_ps_test.go
- integration-cli/docker_cli_pull_test.go
- integration-cli/docker_cli_push_test.go

- docker_api_attach_test.go
- docker_api_containers_test.go
- docker_api_events_test.go
- docker_api_exec_resize_test.go
- docker_api_exec_test.go
- docker_api_images_test.go
- docker_api_info_test.go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-14 21:52:43 +02:00
Quentin Tayssier
fa6925aa9b Improve sockRequest and sockRequestRaw check
Signed-off-by: Quentin Tayssier <qtayssier@gmail.com>
2015-07-13 21:49:08 +09:00
Antonio Murdaca
10a3061c5f Fix regression in parsing capabilities list when a single string is given
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-07-01 21:28:02 +02:00
Ankush Agarwal
477201a295 Validate Port specifications on daemon side
Fixes #14230

Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
2015-06-30 12:14:49 -07:00
Brian Goff
17d6f00ec2 Fix unmarshalling of Command and Entrypoint
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-06-26 09:00:57 -07: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
Madhu Venugopal
da5a3e6dee register libnetwork API and UI with docker parent chain
This commit also brings in the ability to specify a default network and its
corresponding driver as daemon flags. This helps in existing clients to
make use of newer networking features provided by libnetwork.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-06-18 12:07:58 -07:00
Arnaud Porterie
e5b7f61f09 Replace "sleep" by "top" in test implementation
Eliminate any chance of race condition by replacing a call to sleep by a
call to top, and rely on test cleanup logic to have it exit cleanly.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-06-12 10:45:42 -07:00
Darren Shepherd
09de92b891 Set omitempty for IP and PublicPort to conform w/ API 1.18
Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-06-12 09:49:53 -07:00
Antonio Murdaca
4ce817796e Avoid nil pointer dereference while creating a container with an empty Config
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-06-06 20:07:32 +02:00
Antonio Murdaca
6945ac2d02 SizeRW & SizeRootFs omitted if empty in /container/json call
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-06-03 23:13:56 +02:00
Antonio Murdaca
725f34151c Do not omit empty json field in /containers/json api response
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-06-03 18:53:40 +02:00
Vincent Demeester
c61fa8471a Update api documentation to add labels in commit
It is already possible to set labels at commit when using the API. But
it is not present in the API documentation. Added an integration test
too, to validate this work (and will be in the future).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-05-30 11:31:51 +02:00
David Calavera
4389fc8bf9 Merge pull request #13425 from runcom/13421-stats-default-stream
Fix regression in stats API endpoint
2015-05-29 15:05:21 -07:00
Antonio Murdaca
ec97f41465 Fix regression in stats API endpoint where stream query param default is true
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 22:38:36 +02:00
Antonio Murdaca
15134a3320 Remove PortSpecs from Config
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 22:38:09 +02:00
Brian Goff
b3e8ab3021 Fix unregister stats on when rm running container
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-05-26 22:22:03 -04:00
David Calavera
81fa9feb0c Volumes refactor and external plugin implementation.
Signed by all authors:

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Signed-off-by: Luke Marsden <luke@clusterhq.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-21 20:34:17 -07:00
Rajdeep Dua
ebe344d34b TestCase for CpuShares and Cpuset
Signed-off-by: Rajdeep Dua <dua_rajdeep@yahoo.com>
2015-05-20 11:32:48 -07:00
Rajdeep Dua
1eea2c589d Modified Test Case to include check for Memory and MemorySwap
Signed-off-by: Rajdeep Dua <dua_rajdeep@yahoo.com>
2015-05-13 13:39:07 -07:00
Rajdeep Dua
80d73c838a Test Cases for API - Container create with Hostname, DomainName and NetworkMode
Signed-off-by: Rajdeep Dua <dua_rajdeep@yahoo.com>
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-07 21:03:39 +02:00
David Calavera
d78755d159 Merge pull request #12822 from brahmaroutu/container_stop_api
restapi stop fails if ?t=int not present
2015-05-07 09:38:59 -07:00
Srini Brahmaroutu
68e9c07850 Restapi for stop fails if ?t=int not present
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-05-07 15:43:50 +00:00
Antonio Murdaca
74121a4211 Do not check and return strconv.Atoi error in api container restart, regression
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-07 01:49:16 +02:00
Brian Goff
7c574b9e9d Move ChunkedEncoding from integration
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-05-06 13:00:17 -04:00
Antonio Murdaca
8771cafab6 Add tests for API container delete
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-04 22:41:57 +02:00
Tianon Gravi
576985a1dc Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum!
IT'S ABOUT TIME. 🎉

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-05-01 16:01:10 -06:00
Antonio Murdaca
f7e417ea5e Remove integration tests and port them to integration-cli
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-30 01:35:16 +02:00
Antonio Murdaca
4203230cbb c.Fatal won't fail and exit test inside a goroutine, errors should be handled outside with a channel
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-29 17:02:22 +02:00
David Calavera
cfa3a080c6 Merge pull request #12820 from runcom/yet-another-sockRequest-refactor
Expose whole Response struct in sockRequestRaw
2015-04-28 13:26:30 -07:00
Phil Estes
0153edcda1 Merge pull request #12828 from tdmackey/trivial-spelling
trivial: typo cleanup
2015-04-27 17:05:46 -04:00
David Mackey
3941623fbc trivial: typo cleanup
Signed-off-by: David Mackey <tdmackey@booleanhaiku.com>
2015-04-27 13:35:08 -07:00
Antonio Murdaca
844538142d Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-27 21:50:33 +02: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
Alexander Morozov
fefb836766 Merge pull request #12728 from HuKeping/addtest
Add test for REST API container rename
2015-04-25 17:01:10 -07:00
Doug Davis
cd4f507b42 Fix race condition in API commit test
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-25 05:46:47 -07:00
Hu Keping
8f752ffeaf Add test for REST API container rename
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-04-25 17:19:57 +08: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
Alexander Morozov
799cf056e7 Merge pull request #11839 from brahmaroutu/template_11641
Allow go template to work properly with inspect …
2015-04-23 13:07:40 -07:00
Jessie Frazelle
03e77e5c8f Merge pull request #12690 from rajdeepd/dry-run-test
Container API Test with HostName
2015-04-23 11:32:47 -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
231d362db7 Allow go template to work properly with inspect
Closes #11641

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-04-23 18:25:18 +00:00
Antonio Murdaca
ee7a7b07e7 Remove deleteAllContainers call in test
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-23 16:32:50 +02:00
Rajdeep Dua
fca4aea077 TestCase added for Container Create with HostName
Signed-off-by: Rajdeep Dua <dua_rajdeep@yahoo.com>
2015-04-23 06:53:34 -07:00
Brian Goff
563708d78d Fix race with TestContainerApiCommit
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-23 09:45:06 -04: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
Srini Brahmaroutu
1a35b16b08 Port test from integration tests
Addresses #12255
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-04-20 17:57:53 +00: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
308a23021d Move TestPostCreateNull to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:49:46 -04: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
23fa7d41d5 Move TestContainerApiCreate to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:49:10 -04:00
Brian Goff
f19061ccfd Move TestPostCommit to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:48:54 -04:00
Brian Goff
d9e4b14346 Move TestGetContainersTop to integration-cli
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-16 13:48:33 -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
Ahmet Alp Balkan
531433e765 integ-cli: Use status code from sockRequest (fix #12335)
sockRequest now makes the status code available in the returned
values. This helps avoid string checking for non-HttpStatusOK(=200)
yet successful error messages.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-04-14 08:07:50 +00:00
Alexander Morozov
bfb487dc50 Merge pull request #12304 from runcom/remove-job-logs
Remove job from logs
2015-04-13 08:38:46 -07:00
Hu Keping
1567cf2cdf Fix typo in testcase
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-04-13 23:09:07 +08: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
c447fd339a TestVolumesFromHasPriority fix race
Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <hugs@docker.com> (github: jfrazelle)
2015-04-01 18:06:28 -07:00
paul
c5bf2145f1 Fix vet warning
Signed-off-by: Paul Mou <ppymou@gmail.com>
2015-03-25 20:31:02 -07:00
Jessie Frazelle
1fe55b2f8b Merge pull request #10365 from cpuguy83/9981_fix_cannot_overwrite_nonbind_as_bind
Allow path from normal volume existing to overwrite in start Binds
2015-03-23 10:43:02 -07:00
Qiang Huang
8dc5791f73 fix panic error when docker stats a stopped container
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-16 19:55:34 +08:00
Jessie Frazelle
52f6da2238 Merge pull request #11278 from ahmetalpbalkan/win-cli/fakeGIT
integ-cli: use httpserver container for fakeGIT
2015-03-11 18:19:11 -07:00
Ahmet Alp Balkan
44ffb199d0 integ-cli: use httpserver container for fakeGIT
This change enables `fakeGIT()` to use the new `fakeStorage`
server which is automatically starting a container on the remote test
daemon machine using the git repo directory (when requested).

Fixes the following tests:

- `TestBuildApiLowerDockerfile`
- `TestBuildApiBuildGitWithF`
- `TestBuildApiDoubleDockerfile` (skipped on windows: NTFS case-insensitive)
- `TestBuildFromGIT` (still needs local server)

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-10 22:48:35 -07:00
Doug Davis
a853f8e468 Fixup a test for -f processing
Thanks to @ahmetalpbalkan for noticing... we had an old check in this
testcase that no longer applied (due to stuff being removing recently).
However, while in there I added a check to make sure that the file referenced
by the query parameter isn't used at all.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-03-10 05:47:12 -07:00
Ahmet Alp Balkan
2e95bb5f1a integ-cli: Implement remote FakeStorage server for build via URL tests
Implemented a FakeStorage alternative that supports spinning
up a remote container on DOCKER_TEST_HOST to serve files over
an offline-compiled Go static web server image so that tests which
use URLs in Dockerfile can build them over at the daemon side.

`fakeStorage` function now automatically chooses if it should
use a local httptest.Server or a remote container.

This fixes the following tests when running against a remote
daemon:

- `TestBuildCacheADD`
- `TestBuildCopyWildcardNoFind`
- `TestBuildCopyWildcardCache`
- `TestBuildADDRemoteFileWithCache`
- `TestBuildADDRemoteFileWithoutCache`
- `TestBuildADDRemoteFileMTime`
- `TestBuildADDLocalAndRemoteFilesWithCache`
- `TestBuildADDLocalAndRemoteFilesWithoutCache`
- `TestBuildFromURLWithF`
- `TestBuildApiDockerFileRemote`

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-09 12:03:55 -07:00
Jessie Frazelle
beea697be3 Merge pull request #10858 from duglin/10807-MixedcaseDockerfile
Support dockerfile and Dockerfile
2015-03-04 03:52:49 -08:00
Doug Davis
15924f2385 Support dockerfile and Dockerfile
Closes #10807

Adds support for `dockerfile` ONLY when `Dockerfile` can't be found.
If we're building from a Dockerfile via stdin/URL then always download
it a `Dockerfile` and ignore the -f flag.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-03-03 18:38:50 -08:00
Michael Crosby
7fed7d7eb4 Move stats api types into api/types package
Move the stats structs from the api/stats package into a new package
api/types that will contain all the api structs for docker's api request
and responses.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-02-24 10:47:47 -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
Ahmet Alp Balkan
df5334183f integration-cli: generate unix-style volume paths
Some tests in `docker_api_containers_test.go` assume the
docker daemon is running at the same machine as the cli
and uses `ioutil.TempDir` to create temp dirs and use them
in the test.

On windows ioutil.TempDir and os.TempDir would create win-style
paths and pass them to daemon. Instead, I hardcoded `/tmp/` and
generate some random path manually and allow daemon to create
the directory.

Fixes tests:
- TestContainerApiStartVolumeBinds
- TestContainerApiStartDupVolumeBinds
- TestVolumesFromHasPriority

Downside:
- Does not clean the temp dirs generated on the remote daemon
  machine unless delete container deletes them.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-17 01:29:23 -08:00
Brian Goff
49e1ad49c8 Allow normal volume to overwrite in start Binds
Fixes #9981
Allows a volume which was created by docker (ie, in
/var/lib/docker/vfs/dir) to be used as a Bind argument via the container
start API and overwrite an existing volume.

For example:

```bash
docker create -v /foo --name one
docker create -v /foo --name two
```

This allows the volume from `one` to be passed into the container start
API as a bind to `two`, and it will overwrite it.

This was possible before 7107898d5c

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-10 20:46:37 -05:00
Phil Estes
35d4825838 Clean up dup. volume test and add API test for the same
Handles missed comments in PR#10622 and adds an API test to validate
error returned properly for duplicate bind mounts for the same
container target path.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-02-09 12:33:58 -05:00
Tibor Vass
73d5baf585 builder: prevent Dockerfile to leave build context
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2015-02-02 23:40:24 -08:00
Doug Davis
198ff76de5 Add an API test for docker build -f Dockerfile
I noticed that while we have tests to make sure that people don't
specify a Dockerfile (via -f) that's outside of the build context
when using the docker cli, we don't check on the server side to make
sure that API users have the same check done. This would be a security
risk.

While in there I had to add a new util func for the tests to allow us to
send content to the server that isn't json encoded - in this case a tarball

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-02 23:40:20 -08:00
Michael Crosby
4d7707e183 Improve robustness of /stats api test
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-21 16:00:15 -08:00
Michael Crosby
217a2bd1b6 Remove publisher if no one is listening
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:47 -08:00
Michael Crosby
76141a0077 Add documentation for stats feature
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:47 -08:00
Brian Goff
d44c9f9147 Fix volumes-from/bind-mounts passed in on start
Fixes #9628
Slightly reverts #8683, HostConfig on start is _not_ deprecated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-12-15 16:51:15 -05:00