Commit Graph

22 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 9f9b4290b9
integration: change container.Run signature to fix linting
Line 59: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:05:26 +02:00
Sebastiaan van Stijn 1101568fa1
Update TestUpdatePidsLimit to be more atomic
Create a new container for each subtest, so that individual
subtests are self-contained, and there's no need to execute
them in the exact order, or resetting the container in between.

This makes the test slower (6.54s vs  3.43s), but reduced the
difference by using `network=host`, which made a substantial
difference (without `network=host`, the test took more than
twice as long: 13.96s).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-13 00:27:15 +01:00
Sebastiaan van Stijn ffa1728d4b
Normalize values for pids-limit
- Don't set `PidsLimit` when creating a container and
  no limit was set (or the limit was set to "unlimited")
- Don't set `PidsLimit` if the host does not have pids-limit
  support (previously "unlimited" was set).
- Do not generate a warning if the host does not have pids-limit
  support, but pids-limit was set to unlimited (having no
  limit set, or the limit set to "unlimited" is equivalent,
  so no warning is nescessary in that case).
- When updating a container, convert `0`, and `-1` to
  "unlimited" (`0`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-13 00:27:05 +01:00
Sebastiaan van Stijn 5861a0db22
Fix container update resetting pidslimit on older API clients
Older API clients did not use a pointer for `PidsLimit`, so
API requests would always send `0`, resulting in any previous
value to be reset after an update:

Before this patch:

(using a 17.06 Docker CLI):

```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container update --memory=100M --memory-swap=200M test

docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
0

docker container exec test cat /sys/fs/cgroup/pids/pids.max
max
```

With this patch applied:

(using a 17.06 Docker CLI):

```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container update --memory=100M --memory-swap=200M test

docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container exec test cat /sys/fs/cgroup/pids/pids.max
16
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-24 16:32:32 +01:00
Sunny Gogoi 74eb258ffb Add pids-limit support in docker update
- Adds updating PidsLimit in UpdateContainer().
- Adds setting PidsLimit in toContainerResources().

Signed-off-by: Sunny Gogoi <indiasuny000@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-02-21 14:17:38 -08:00
Yong Tang 52475f8dd5 Replace t.Fatal(err) with assert.NilError(t, err)
So that they are consistent with integration tests style

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-15 04:58:30 +00:00
Sebastiaan van Stijn 0de62d9bbc
Integration: use testenv.APIClient()
A client is already created in testenv.New(), so we can just
as well use that one, instead of creating a new client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 11:53:41 +01:00
Sebastiaan van Stijn 4d88a95d67
Don't mix t.Parallel() wth environment.ProtectAll()
`testEnv` is a package-level variable, so protecting / restoring
`testEnv` in parallel will result in "concurrent map write" errors.

This patch removes `t.Parallel()` from tests that use this
functionality (through `defer setupTest(t)()`).

Note that _subtests_ can still be run in parallel, as the defer
will be called after all subtests have completed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 11:53:31 +01:00
Vincent Demeester d3cc071bb9 Windows: Start of enabling tests under integration/
- Add windows CI entrypoint script.

Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-09-26 12:28:22 -07:00
Vincent Demeester 3845728524
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-13 09:04:30 +02:00
Vincent Demeester 42f6fdf059
Move integration-cli/request to internal/test/request…
… and change a bit the method signature

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-17 16:25:59 +02:00
Daniel Nephin 6be0f70983 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-16 11:03:43 -04:00
Yong Tang eda311c18f Move containerIsStopped/containerIsInState to integration/internal/container
This fix moves helper functions containerIsStopped and
containerIsInState to integration/internal/container,
so that they could be used outside of integration/container.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-23 21:23:05 +00:00
Kir Kolyshkin 31825081d4 integration/testUpdateCPUQuota: fix name
The function name should be TestUpdateCPUQuota and not TestUpdateCPUQUota.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-02-20 13:36:27 -08:00
Kir Kolyshkin cc86647098 integration/TestUpdateMemory: fix false failure
This fixes the following test failure:

> --- FAIL: TestUpdateMemory (0.53s)
>  	assertions.go:226:
>	Error Trace:	update_linux_test.go:52
>	Error:      	Not equal:
>	            	expected: int(524288000)
>	            	received: int64(524288000)

Fixes: 0f9da07b56
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-02-20 13:31:03 -08:00
Kir Kolyshkin 0f9da07b56 integration/TestUpdateMemory: simplify
1. Use integration/internal/exec, removing the getContainerSysFSValue().

2. Avoid repeating magic numbers, use a variable for those.

3. Fix order of arguments to assert.Equal (first "expected", then "actual").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-02-19 11:25:27 -08:00
Kir Kolyshkin 8a7d6143fc integration/TestUpdateCPUQUota: use exec
An implementation of exec in TestUpdateCPUQUota had a few issues,
including resource leaking and calling both ContainerExecAttach and
ContainerExecRun. The last one makes the test flaky:

	update_linux_test.go:136: expected cgroup value 20000, got: Error: Exec
	command f923baf709525f6b38f6511126addc5d9bb88fb477eeca1c22440551090fa2bb
	is already running

Fix by using the integration/internal/exec package.

While at it, use require/assert to further improve code readability.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-02-19 11:25:27 -08:00
Yong Tang e9f19df6a9 Update api tests to use the newly added container helper package
This fix is a follow up to 36266 to update some api tests
to use the newly added container helper package.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-10 23:30:40 +00:00
Vincent Demeester af306d149e
Rename integration/util to integration/internal
Both names have no real sense, but one allows to make sure these packages
aren't used outside of `integration`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-10 09:16:32 +01:00
Daniel Nephin 4f0d95fa6e Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-05 16:51:57 -05:00
Yong Tang 490edd3582 Migrate TestAPIUpdateContainer from integration-cli to api tests
This fix migrates TestAPIUpdateContainer from integration-cli to api tests

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-31 20:02:55 +00:00
Brian Goff 86ba63db82 Ensure CPU quota/period updates are sent to runc
Fixes an issue where if cpu quota/period is sent via the update API, the
values are updated in the stored container data but not actually sent to
the running container.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-01-16 11:50:14 -05:00