Commit Graph

38 Commits

Author SHA1 Message Date
fea75fa014 Update request.* signature to remove the host
99.9% of use case for request call are using daemonHost. This makes it
default and adds a `request.DoOnHost` function to be able to specify
the host for specific, more complex use cases.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b11ba1231ef0ac99279ed5dcd76d81413d7d63b5
Component: engine
2017-03-06 16:41:33 +01:00
4a0012206d Merge pull request #31412 from vdemeester/integration-request-pass
[test-integration] convert request.SockRequestRaw to appropriate methods
Upstream-commit: fabe16ee34bd8df42b25bb21b9a0b2d427e85adb
Component: engine
2017-03-01 14:15:50 +01:00
b8d05e7498 Convert request.SockRequestRaw to appropriate methods
`request.SockRequestRaw` is deprecated, let's use appropriate methods
for those. This is a first pass, `SockRequest` still needs to be removed.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: f85ee17810ca55a3104f8a7d8945bd16ac526dd0
Component: engine
2017-02-28 17:12:30 +01:00
1b55b3c201 update Reported less Txbytes to RxPackets in docker_api_stats_test.go
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 5690de3c0ed229c2de223aa023bd7a7ae2af0993
Component: engine
2017-02-28 19:42:35 +08:00
f7b8e381ec Use testEnv methods and remove most of the global variables
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: c8016e669f9507480745a441ba4cd735150ebb85
Component: engine
2017-01-17 12:39:08 +01:00
44a6bbe938 Add a new request package in integration-cli
The goal is to remove function from `docker_utils.go` and setup
simple, one-responsability package that can be well tested ; and to
ease writing request.

This moves all the calls to `sockRequest` (and similar methods) to
their counterpart in the `request` package.

This introduce `request.Do` to write easier request (with functional
argument to easily augment the request) with some pre-defined function
for the most used http method (i.e. `request.Get`, `request.Post` and
`request.Delete`).

Few of the `sockRequest` call have been moved to `request.Do` (and
`Get`, etc.) to showcase the usage of the package. There is still a
whole lot to do.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: d69d4799a312dfcae63442e290ae6667afd1a038
Component: engine
2017-01-03 11:49:30 +01:00
2758f0996d Remove pkg/integration and move it to testutil or integration-cli
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 33968e6c7df164fff0a882c50ae7f4f7e6190e4b
Component: engine
2016-12-30 18:26:34 +01:00
e5912f7d7e Rename Remote API to Engine API
Implementation of https://github.com/docker/docker/issues/28319

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: f0d55cd081c6e8ad2a8222c787d54f9aae15723f
Component: engine
2016-11-22 12:49:38 +00:00
b55dfc1ac1 Windows: Require REST 1.25 or later
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f811d5b1288583b4bb4b978e58ca0466236a9a30
Component: engine
2016-10-31 14:33:59 -07:00
866c5e6688 Merge pull request #27037 from Microsoft/jjh/apistatsdatarace
Fix datarace in ApiStatsNetworkStatsVersioning
Upstream-commit: ba9fb732801cfdcd55dd2a4cfce5ef5e0962fc59
Component: engine
2016-10-05 13:06:40 -07:00
ff392389fd Fix datarace in ApiStatsnetworkStatsVersioning
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 825e3a66a419038600024be7dfc5ca24426444f0
Component: engine
2016-10-05 10:12:46 -07:00
ed910442b7 [nit] integration-cli: obey Go's naming convention
No substantial code change.

 - Api         --> API
 - Cli         --> CLI
 - Http, Https --> HTTP, HTTPS
 - Id          --> ID
 - Uid,Gid,Pid --> UID,PID,PID
 - Ipam        --> IPAM
 - Tls         --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)

Didn't touch in this commit:
 - Git: because it is officially "Git": https://git-scm.com/
 - Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
 - Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 7fb7a477d79c67ab53c432977780662ccbfeec57
Component: engine
2016-09-30 01:21:05 +00:00
7342ae40e2 Windows: stats support
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 340e5233b2fb95981ddea610c1667134ed3b2376
Component: engine
2016-09-16 11:56:15 -07:00
45ddc4bfcb Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 91e197d614547f0202e6ae9b8a24d88ee131d950
Component: engine
2016-09-07 11:05:58 -07:00
6cbe7c9c86 Change number of pings to 1
This cuts the test time down from 6s to 2s

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: cfde8e785582502b830238245ad69eae5394b4f0
Component: engine
2016-08-03 13:30:34 -07:00
c5d4a2d2e9 Make network stats version test concurrent
This change makes the test run go down from 10s to 2s

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 2f3b7f08a09d70bc17a75b00a81e56357a9cae3f
Component: engine
2016-08-03 13:24:55 -07:00
c78b55f0c1 Fix flaky TestApiStatsNetworkStats test
It appears that on some systems apparmor gets in the way of libc.so.6
shared library being loaded - which means the ping fails.

To get around this if we run ping under `/lib64/ld-linux-x86-64.so.2`
then it works.  So we only do this for linux and only if the first attempt
fails. If this 2nd attempt fails then we'll show the original error to
the user for debugging.

Also s/Output/CombinedOutput/ to help debugging in the future. It didn't
show the real error msg.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 94d057130461b3b56957b2755da9dae00a937e81
Component: engine
2016-05-23 19:00:19 -07:00
11be2b26e1 TestApiStatsContainerGetMemoryLimit: Add cgroup memory test
Currently on kernels booted without the "cgroup_enable=memory" kernel
parameter the testcase TestApiStatsContainerGetMemoryLimit fails with:

FAIL: docker_api_stats_test.go:231: TestApiStatsContainerGetMemoryLimit.pN52_github_com_docker_docker_integration_cli.DockerSuite

docker_api_stats_test.go:256:
    c.Assert(fmt.Sprintf("%d", v.MemoryStats.Limit), checker.Equals, fmt.Sprintf("%d", info.MemTotal))
... obtained string = "0"
... expected string = "33759145984"

Fix this and skip the testcase if the kernel does not support cgroup memory
limit. In that case the output would be:

SKIP: docker_api_stats_test.go:231:
TestApiStatsContainerGetMemoryLimit.pN52_github_com_docker_docker_integration_cli.DockerSuite
(Test requires an environment that supports cgroup memory limit.)

ChangeLog:
----------
v4: Move TestApiStatsContainerGetMemoryLimit to docker_api_stats_unix_test.go
v3: Use existing "memoryLimitSupport" from requirements_unix.go
v2: Move check to requirements.go

Fixes #22477

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Upstream-commit: 8ba8189ee66fa36f7adb1f2bab6cc4c35ebfd8cd
Component: engine
2016-05-04 20:46:41 +02:00
03d17b8c5f Update code for latest engine-api
- Update CopyToContainer uses
- Use engine-api/types/versions instead of pkg/version

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 7534f17261d0bb74557ca2f7cd893d5b7b531d49
Component: engine
2016-04-19 16:56:54 +02:00
7511f16a58 Docker stats is not working when a container is using another container's network.
This fix tries to fix the issue in #21848 where `docker stats` will not correctly
display the container stats in case the container reuse another container's
network stack.

The issue is that when `stats` is performed, the daemon will check for container
network setting's `SandboxID`. Unfortunately, for containers that reuse another
container's network stack (`NetworkMode.IsConnected()`), SandboxID is not assigned.
Therefore, the daemon thinks the id is invalid and remote API will never return.

This fix tries to resolve the SandboxID by iterating through connected containers
and identify the appropriate SandboxID.

A test case for `stats` remote API has been added to check if `stats` will return
within the timeout.

This fix fixes #21848.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: faf2b6f7aaca7f9ef400e227921b8125590fc9e5
Component: engine
2016-04-09 20:15:51 +00:00
4b530927b7 Fix docker stats missing memory limit
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: a0a6d031d76c1bf9d5581a8310b8a2d1df4b7b82
Component: engine
2016-04-07 22:09:07 -04:00
4087be7d21 Optimize TestApiStatsNetworkStats and TestApiStatsNetworkStatsVersioning
Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: 695b7e8d11036d4a71263b31d15b75d81c35831e
Component: engine
2016-02-01 10:26:27 +08:00
c91af62049 remove the check of ContentLength in TestApiStatsNoStreamGetCpu
Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: d474f7fb86779aa15ea302f269bfc8d00ad379ec
Component: engine
2016-01-19 12:06:01 +08:00
4ec2693c9e Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 907407d0b2e5863f0e1b40b93a356bbf03c7b9fb
Component: engine
2016-01-06 19:48:59 -05:00
0b23ea825a add tests for docker stats versioning
testing for #17549

Signed-off-by: Donald Huang <don.hcd@gmail.com>
Upstream-commit: 8ceded6d0384bef32dfddf800057fa08d910e95e
Component: engine
2015-10-31 00:23:08 +00:00
c2f87fdd0e Fix docker inspect container only reports last assigned information
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 1b9a08e719776e53b7aea1a89c2c29fbf27b1ae4
Component: engine
2015-10-27 16:26:06 -04:00
04eb439359 Use checker on integration test when possible
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 710817a71b40287acc546fe2e08367b2a02dae54
Component: engine
2015-10-22 15:53:17 +08:00
e0ab2a79d7 integration-cli: add cli/api stats tests when container not found
Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: 66be81b148a1c6693c44cf52d8172d512eedc233
Component: engine
2015-09-17 18:20:25 +02:00
c71aa53e3d Refactor the statistics of network in docker stats
For now docker stats will sum the rxbytes, txbytes, etc. of all
the interfaces.

It is OK for the output of CLI `docker stats` but not good for
the API response, especially when the container is in sereval
subnets.

It's better to leave these origianl data to user.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: d3379946ec96fb6163cb8c4517d7d5a067045801
Component: engine
2015-09-15 15:40:34 +08:00
c03ccb6893 Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f9a3558a9d75ed6a2f9f1b2d80800226afaa74a5
Component: engine
2015-09-04 12:32:40 -07:00
22da8315f6 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>
Upstream-commit: 799d9605d6d37a0f5c559b0325d924ad183ff4ee
Component: engine
2015-08-18 20:36:08 +02:00
502a6d4faf fix golint warnings/errors on package api/types/
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 3d6617ffe7d9242107ac09eab4f2d8ce87acb95c
Component: engine
2015-08-07 09:43:43 +08:00
6fd5a9b231 Ensure body is closed after error is checked
Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: 18faf6f94e0995ac3fab703d22ca82baf4a65676
Component: engine
2015-07-23 14:34:38 +02:00
448d2ef599 Fix Windows CI fail due to GH13866 and patch up tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c1b524486c80932f0c97b935f1ff9e41d30eab4e
Component: engine
2015-07-09 10:09:45 -07:00
908ab87a15 Stats API to retrieve nw stats from libnetwork
- Container networking statistics are no longer
  retrievable from libcontainer after the introduction
  of libnetwork. This change adds the missing code
  for docker daemon to retireve the nw stats from
  Endpoint.

Signed-off-by: Alessandro Boch <aboch@docker.com>
Upstream-commit: 8b40e44c395fb307cceb6f179ffe02030b316535
Component: engine
2015-07-01 11:15:16 -07: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
73dfc7d473 Fixes content-type/length for stats stream=false
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 855a056af7829504ccc310587445c61d62427b51
Component: engine
2015-06-12 13:06:06 -04:00
ffc2b1eb23 Rename test file to have _test postfix
Without this go test was unable to find line number of error in that
file.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: ff9877ccc4db4d0891583ebac6558a235b028942
Component: engine
2015-06-05 13:49:58 -07:00