Commit Graph

29 Commits

Author SHA1 Message Date
Kir Kolyshkin ac038eab29 integration-cli: error report improvements
1. After running d.Cmd(), in case an error is returned, it makes sense
to print command output, as its stderr may contain a clue about what
went wrong. This is by no means complete, just as far as I could go.

2. In case the comment in c.Assert is a constant string, it's better
to provide it as a comment which will be printed.

3. An arbitrary string should not be passed on to a function expecting
%-style formatting. Use %s to fix this.

4. Print the output string before transformation, not after.

5. Unify the output format (drop "out:" prefix").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-14 12:52:30 +03:00
Kir Kolyshkin 83363fb2d4 integration: use %s for check.Commentf()
It is wrong to pass an arbitrary string to a function expecting
%-style formatting. One solution would be to replace any % with %%,
but it's easier to just do what this patch does.

Generated with:

for f in $(git grep -l 'check.Commentf(out)'); do \
	sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \
done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-14 10:45:39 +03: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
Kir Kolyshkin bb934c6aca pkg/mount: implement/use filter for mountinfo parsing
Functions `GetMounts()` and `parseMountTable()` return all the entries
as read and parsed from /proc/self/mountinfo. In many cases the caller
is only interested only one or a few entries, not all of them.

One good example is `Mounted()` function, which looks for a specific
entry only. Another example is `RecursiveUnmount()` which is only
interested in mount under a specific path.

This commit adds `filter` argument to `GetMounts()` to implement
two things:
 1. filter out entries a caller is not interested in
 2. stop processing if a caller is found what it wanted

`nil` can be passed to get a backward-compatible behavior, i.e. return
all the entries.

A few filters are implemented:
 - `PrefixFilter`: filters out all entries not under `prefix`
 - `SingleEntryFilter`: looks for a specific entry

Finally, `Mounted()` is modified to use `SingleEntryFilter()`, and
`RecursiveUnmount()` is using `PrefixFilter()`.

Unit tests are added to check filters are working.

[v2: ditch NoFilter, use nil]
[v3: ditch GetMountsFiltered()]
[v4: add unit test for filters]
[v5: switch to gotestyourself]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-19 14:48:09 -07:00
Vincent Demeester 69bab3832c
Migrate test-integration-cli experimental plugin tests to integration
All `plugins` tests that require an `ExperimentalDaemon` are migrated
to `integration/plugin/*` and start an experimental daemon to test on
it.

The end goal being to remove the `experimental` build.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-19 11:57:28 +02:00
Brian Goff 0df654f3d6 Cleanup volume plugin test with bad assumptions
Test made some bad assumptions about on-disk state of volume data.
This updates the test to only test based on what the volume API is
designed to provide.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-20 16:57:20 -05:00
Daniel Nephin 92427b3a81 Update tests to use icmd
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-25 12:07:30 -04:00
Christopher Jones 069fdc8a08
[project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-07-11 08:00:32 -04:00
Anusha Ragunathan b748debb76 Add missing test for daemon kill with plugins running.
Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
2017-03-22 14:38:55 -07:00
Christopher Jones 362d082b6e
[multi-arch] skip more plugin tests on non-x86
Until the plugins are multi-arch plugins, or built on runtime,
skip these tests like we do with the remainder of the plugin tests.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-02-28 16:53:30 -05:00
Yong Tang 99d91ada97 Add `capability` filter to `docker plugin ls`
This fix adds `--filter capability=[volumedriver|authz]` to `docker plugin ls`.

The related docs has been updated.

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 07:32:22 -08:00
Yong Tang a66e0dc349 Add `--filter enabled=true` for `docker plugin ls`
This fix adds `--filter enabled=true` to `docker plugin ls`,
as was specified in 28624.

The related API and docs has been updated.

An integration test has been added.

This fix fixes 28624.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-26 13:16:11 -08:00
Vincent Demeester 303b1d200a
Update trustedCmd to be compatible with testutil/cmd
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-09 11:07:05 +01:00
Vincent Demeester 87e3fcfe1e
Clean some runCommandWithOutput accross integration-cli code
There is still ways to go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-05 17:44:31 +01:00
Vincent Demeester 33968e6c7d
Remove pkg/integration and move it to testutil or integration-cli
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-30 18:26:34 +01:00
Vincent Demeester d3e3a97cb2 Merge pull request #28623 from cpuguy83/update_graphdriver_docs
Ensure graphdriver only loads with experimental flag
2016-12-24 11:59:24 +01:00
Anusha Ragunathan 8cb2229cd1 Enforce zero plugin refcount during disable.
When plugins have a positive refcount, they were not allowed to be
removed. However, plugins could still be disabled when volumes
referenced it and containers using them were running.

This change fixes that by enforcing plugin refcount during disable.
A "force" disable option is also added to ignore reference refcounting.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-12-22 13:26:53 -08:00
Brian Goff 677fa03654 Moves graphdriver plugn docs out of experimental
Also updates some of the structures being sent so plugins are getting
all the new options.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-22 15:30:25 -05:00
Brian Goff e4ebc92edc Ensure test graphdriver plugin runs on test host
Sets a kernel requirement for for `TestGraphdriverPlugin` since the
graphdriver being used is overlay2.. and also makes sure to skip the
kernel check in the actual graphdriver since we may be able to detect
kernels with backported support for overlay2 style mounts a bit more
freely in the test code.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-19 16:05:22 -05:00
Brian Goff 6ef1060cd0 Fix volume plugin refecounting on daemon restart
Ensures all known volumes (known b/c they are persisted to disk) have
their volume drivers refcounted properly.

In testing this, I found an issue with `--live-restore` (required since
currently the provided volume plugin doesn't keep state on restart)
where restorted plugins did not have a plugin client loaded causing a
panic when trying to use the plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-16 10:14:06 -05:00
Brian Goff 500210475f Make graphdriver plugin use plugin BasePath
Also enables `PropagatedMount` for graphdrivers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-15 16:22:13 -05:00
Brian Goff cb6633175c Fix issues with plugin and `--live-restore`
Fixes an issue when starting the daemon with live-restore
where previously it was not set, plugins are not running.

Fixes an issue when starting the daemon with live-restore, the plugin
client (for interacting with the plugins HTTP interface) is not set,
causing a panic when the plugin is called.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-13 16:11:59 -05:00
Christopher Jones ebff8c79a3
[integration-cli] skip plugin tests on non-x86
Due to the test plugins being architecture specific, these
tests fail to start the plugin (even though they don't fail yet)

Temporary fix until we can build architecture specific test
plugins.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2016-12-12 17:17:45 -05:00
Vincent Demeester c502fb49dc Use *check.C in StartWithBusybox, Start, Stop and Restart…
… to make sure it doesn't fail. It also introduce StartWithError,
StopWithError and RestartWithError in case we care about the
error (and want the error to happen).

This removes the need to check for error and make the intent more
clear : I want a deamon with busybox loaded on it — if an error occur
it should fail the test, but it's not the test code that has the
responsability to check that.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-12 09:46:47 +01:00
Vincent Demeester 48de91a33f Extract daemon to its own package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-09 22:26:42 +01:00
Tibor Vass c54b717caf plugins: container-rootfs-relative paths
Legacy plugins expect host-relative paths (such as for Volume.Mount).
However, a containerized plugin cannot respond with a host-relative
path. Therefore, this commit modifies new volume plugins' paths in Mount
and List to prepend the container's rootfs path.

This introduces a new PropagatedMount field in the Plugin Config.
When it is set for volume plugins, RootfsPropagation is set to rshared
and the path specified by PropagatedMount is bind-mounted with rshared
prior to launching the container. This is so that the daemon code can
access the paths returned by the plugin from the host mount namespace.

Signed-off-by: Tibor Vass <tibor@docker.com>
2016-12-09 10:16:24 -08:00
Tibor Vass a08ffa0e93 plugins: fix some tests
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-11-21 16:34:10 -08:00
Tonis Tiigi e23e36f25c Skip plugin tests if not in amd64
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-11 09:52:13 -08:00
Victor Vieux c410222e42 move plugins out of experimental
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-10 15:51:32 -08:00
Renamed from integration-cli/docker_cli_daemon_experimental_test.go (Browse further)