Commit graph

93 commits

Author SHA1 Message Date
Tibor Vass
02545bf320
prepare for rm-gocheck script
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 931edfe5e9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-26 23:52:12 +02:00
Sebastiaan van Stijn
c2b84fd0e8
integration-cli: add daemon.StartNodeWithBusybox function
Starting the daemon should not load the busybox image again
in most cases, so add a new `StartNodeWithBusybox` function
to be clear that this one loads the busybox image, and use
`StartNode()` for cases where loading the busybox image is
not needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ead3f4e7c8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 21:36:11 +02:00
Sebastiaan van Stijn
55aadb3a8f
integration-cli: swarm.RestartNode(); don't load busybox again
The daemon was already created and started with the busybox
image loaded, so there's no need to load the image again.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8fc23588f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 21:36:10 +02:00
Brian Goff
24395d55fc
Better logging for swarm tests
Call helper for starting swarm agents and add some logging with daemon
id's when joining the swarm.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit b0fe0dff7a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 21:35:29 +02:00
Brian Goff
eeeb2e941d
Fix Microsecond -> Milisecond.
A bit too quick on the trigger on some text completion I think...

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 5d818213ff)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 17:29:20 +02:00
Brian Goff
05c096a1ac
Don't log test initial test daemon ping failures
This is just noise due to timing. I picked `> 2` just based on
logs from tests I've seen there's always 1 or 2.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 15675e28f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 17:28:27 +02:00
Sebastiaan van Stijn
ad8327f2ce
integration: fix cleanup of raft data
The directory used for storage was either changed or new directories
were added.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6a64a4deec)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 17:27:49 +02:00
Brian Goff
34418110ec
Add (hidden) flags to set containerd namespaces
This allows our tests, which all share a containerd instance, to be a
bit more isolated by setting the containerd namespaces to the generated
daemon ID's rather than the default namespaces.

This came about because I found in some cases we had test daemons
failing to start (really very slow to start) because it was (seemingly)
processing events from other tests.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 24ad2f486d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-25 17:26:26 +02:00
Michael Crosby
78f4d6b84f
Improve select for daemon restart tests
This improves the select logic for the restart tests or starting the
daemon in general.  With the way the ticker and select was setup, it was
possible for only the timeout to be displayed and not the wait errors.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
(cherry picked from commit 402433a5e4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-20 19:11:40 +02:00
Tonis Tiigi
c502db4955
integration-cli: allow temporary errors on leader switch
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 3df1095bbd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-16 13:45:14 +02:00
Tibor Vass
eee3f67571
Jenkinsfile: reduce time of integration tests by dividing tests into 3 parallel runs
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit e554fb23c8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-19 18:58:00 +02:00
Sebastiaan van Stijn
130c0746c1
Cleanup "address" when connecting over a UNIX socket
When connecting with the daemon using a UNIX socket, the HTTP hostname was set, based
on the socket location, which was generating some noise in the test-logs.

Given that the actual hostname is not important (the URL just has to be well-formed),
the hostname/address can be cleaned up to reduce the noise.

This patch strips the path from the `addr`, and keeps `<random-id>.sock` as address.

Before:

    daemon.go:329: [d15d31ba75501] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd15d31ba75501.sock/_ping: dial unix /tmp/docker-integration/d15d31ba75501.sock: connect: no such file or directory

After:

    daemon.go:329: [d15d31ba75501] error pinging daemon on start: Get http://d15d31ba75501.sock/_ping: dial unix /tmp/docker-integration/d15d31ba75501.sock: connect: no such file or directory

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 92e6e7dd5f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-19 18:55:14 +02:00
Sebastiaan van Stijn
624ff4fef4
integration: organize bundle directory per test
The test-integration/test=integration-cli directory contains
a directory for each daemon that was created during the integration
tests, which makes it a long list to browse through. In addition,
some tests spin up multiple daemons, and when debugging test-failures,
the daemon-logs often have to be looked at together.

This patch organizes the bundl directory to group daemon storage
locationos per test, making it easier to find information about
all the daemons that were used in a specific test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9b5e78888d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-19 18:55:06 +02:00
Brian Goff
a24b9087ce
Add log entries for daemon startup/shutdown
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 595987fd08)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:10:45 +02:00
Brian Goff
48786ba842
Optimize test daemon startup
This adds some logs, handles timers better, and sets a request timeout
for the ping request.

I'm not sure the ticker in that loop is what we really want since the
ticker keeps ticking while we are (attempting) to make a request... but
I opted to not change that for now.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 20ea8942b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:10:37 +02:00
Tibor Vass
feb373a216
build: buildkit now also uses systemd's resolv.conf
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 8ff4ec98cf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-04 18:11:14 +02:00
Deep Debroy
d347049802
Consider WINDOWS_BASE_IMAGE_TAG override when setting Windows base image for tests
Signed-off-by: Deep Debroy <ddebroy@docker.com>
(cherry picked from commit 15419d7ba0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-21 17:00:07 +02:00
Daniel Sweet
8d8904f02b
Ensure all integration daemon logging happens before test exit
As of Go 1.12, the `testing` package panics if a goroutine logs to a
`testing.T` after the relevant test has completed. This was not
documented as a change at all; see the commit
95d06ab6c982f58b127b14a52c3325acf0bd3926 in the Go repository for the
relevant change.

At any point in the integration tests, tests could panic with the
message "Log in goroutine after TEST_FUNCTION has completed". This was
exacerbated by less direct logging I/O, e.g. running `make test` with
its output piped instead of attached to a TTY.

The most common cause of panics was that there was a race condition
between an exit logging goroutine and the `StopWithError` method:
`StopWithError` could return, causing the calling test method to return,
causing the `testing.T` to be marked as finished, before the goroutine
could log that the test daemon had exited. The fix is simple: capture
the result of `cmd.Wait()`, _then_ log, _then_ send the captured
result over the `Wait` channel. This ensures that the message is
logged before `StopWithError` can return, blocking the test method
so that the target `testing.T` is not marked as finished.

Signed-off-by: Daniel Sweet <danieljsweet@icloud.com>
(cherry picked from commit 7546322e99)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 15:50:43 -07:00
Sebastiaan van Stijn
e6c0d19c3a
client: define "Opt" type
Minor improvement, but makes defining a list of options
a bit cleaner, and more descriptive;

Before:

    opts := make([]func(*client.Client) error, 0)

After:

    opts := make([]client.Opt, 0)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 01:23:45 +02:00
Aleksa Sarai
ba0afa6ba8
internal: test/env: switch to assert.TestingT
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2019-03-13 11:48:40 +11:00
Aleksa Sarai
175b1d7830
integration-cli: don't build -test images if they already exist
There's no need to try to re-build the test images if they already
exist. This change makes basically no difference to the upstream
integration test-suite running, but for users who want to run the
integration-cli suite on a host machine (such as distributions doing
tests) this change allows images to be pre-loaded such that compilers
aren't needed on the test machine.

However, this does remove the accidental re-compilation of nnp-test, as
well as handling errors far more cleanly (previously if an error
occurred during a test build, further tests won't attempt to rebuild
it).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2019-03-13 11:48:40 +11:00
Justin Cormack
98fc09128b Remove the rest of v1 manifest support
As people are using the UUID in `docker info` that was based on the v1 manifest signing key, replace
with a UUID instead.

Remove deprecated `--disable-legacy-registry` option that was scheduled to be removed in 18.03.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2019-03-02 10:46:37 -08:00
Sebastiaan van Stijn
b3407d2029
Testing: create new daemon (only) if needed
Some tests were skipped if the local daemon did not have
experimental features enabled; at the same time, some tests
unconditionally created a new (experimental) daemon, even if
the local daemon already had experimental enabled.

This patch;

- Checks if the "testEnv" is an experimental Linux daemon
- If not, and the daemon is running locally; spin up a new
  experimental daemon to be used during the test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-23 13:32:59 +01:00
Brian Goff
e063099f91 Completely remove d.NewClient from testing tools
Favor `d.NewClientT` instead.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-02-07 16:07:02 -08:00
Sebastiaan van Stijn
7e7e100be0
Add HEAD support for /_ping endpoint
Monitoring systems and load balancers are usually configured to use HEAD
requests for health monitoring. The /_ping endpoint currently does not
support this type of request, which means that those systems have fallback
to GET requests.

This patch adds support for HEAD requests on the /_ping endpoint.

Although optional, this patch also returns `Content-Type` and `Content-Length`
headers in case of a HEAD request; Refering to RFC 7231, section 4.3.2:

    The HEAD method is identical to GET except that the server MUST NOT
    send a message body in the response (i.e., the response terminates at
    the end of the header section).  The server SHOULD send the same
    header fields in response to a HEAD request as it would have sent if
    the request had been a GET, except that the payload header fields
    (Section 3.3) MAY be omitted.  This method can be used for obtaining
    metadata about the selected representation without transferring the
    representation data and is often used for testing hypertext links for
    validity, accessibility, and recent modification.

    A payload within a HEAD request message has no defined semantics;
    sending a payload body on a HEAD request might cause some existing
    implementations to reject the request.

    The response to a HEAD request is cacheable; a cache MAY use it to
    satisfy subsequent HEAD requests unless otherwise indicated by the
    Cache-Control header field (Section 5.2 of [RFC7234]).  A HEAD
    response might also have an effect on previously cached responses to
    GET; see Section 4.3.5 of [RFC7234].

With this patch applied, either `GET` or `HEAD` requests work; the only
difference is that the body is empty in case of a `HEAD` request;

    curl -i --unix-socket /var/run/docker.sock http://localhost/_ping
    HTTP/1.1 200 OK
    Api-Version: 1.40
    Cache-Control: no-cache, no-store, must-revalidate
    Docker-Experimental: false
    Ostype: linux
    Pragma: no-cache
    Server: Docker/dev (linux)
    Date: Mon, 14 Jan 2019 12:35:16 GMT
    Content-Length: 2
    Content-Type: text/plain; charset=utf-8

    OK

    curl --head -i --unix-socket /var/run/docker.sock http://localhost/_ping
    HTTP/1.1 200 OK
    Api-Version: 1.40
    Cache-Control: no-cache, no-store, must-revalidate
    Content-Length: 0
    Content-Type: text/plain; charset=utf-8
    Docker-Experimental: false
    Ostype: linux
    Pragma: no-cache
    Server: Docker/dev (linux)
    Date: Mon, 14 Jan 2019 12:34:15 GMT

The client is also updated to use `HEAD` by default, but fallback to `GET`
if the daemon does not support this method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-31 18:18:24 +01:00
Sebastiaan van Stijn
b84bff7f8a
Fix: plugin-tests discarding current environment
By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:

e73f489494/src/os/exec/exec.go (L57-L60)

> If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-12 13:06:25 +01:00
Sebastiaan van Stijn
263e28a830
Fix some minor wording / issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 13:57:01 +01:00
Sebastiaan van Stijn
55b5b8de79
Merge pull request #38486 from thaJeztah/dont_use_deprecated_envclient
Remove use of deprecated client.NewEnvClient()
2019-01-05 11:23:19 +01:00
Sebastiaan van Stijn
c8ff5ecc09
Remove use of deprecated client.NewEnvClient()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 22:49:00 +01:00
Sebastiaan van Stijn
2cb7b73a1b
Test: Replace NewClient() with NewClientT()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-22 15:53:02 +01:00
selansen
32180ac0c7 VXLAN UDP Port configuration support
This commit contains changes to configure DataPathPort
option. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
DataPathPort can't be modified after swarm init.
Signed-off-by: selansen <elango.siva@docker.com>
2018-11-22 17:35:02 -05:00
Kir Kolyshkin
2ed512c7fa integration-cli/Test*Swarm*: use same args on restart
When starting docker daemons for swarm testing, we disable iptables
and use lo for communication (in order to avoid network conflicts).

The problem is, these options are lost on restart, that can lead
to any sorts of network conflicts and thus connectivity issues
between swarm nodes.

Fix this. This does not fix issues with swarm test failures, but
it seems they appear are less often after this one.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:25:12 -07:00
Kir Kolyshkin
06afc2d1e6 TestAPISwarmLeaderElection: add some debug
......

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:24:39 -07:00
Kir Kolyshkin
6016520162 internal/test/daemon: don't leak timers
A timer is leaking on every daemon start and stop.
Probably nothing major, but given the amount of
daemon starts/stops during tests, it's better to
be accurate about it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:23:47 -07:00
Kir Kolyshkin
73baee2dcf integration-cli: fix netns test cleanup
1. Using MNT_FORCE flag does not make sense for nsfs. Using MNT_DETACH
though might help.

2. When -check.vv is added to TESTFLAGS, there are a lot of messages
like this one:

> unmount of /tmp/dxr/d847fd103a4ba/netns failed: invalid argument

and some like

> unmount of /tmp/dxr/dd245af642d94/netns failed: no such file or directory

The first one means directory is not a mount point, the second one
means it's gone. Do ignore both of these.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:23:47 -07:00
Sebastiaan van Stijn
deac65c929
Merge pull request #37850 from AkihiroSuda/propagate-exec-root-to-libnetwork
daemon: propagate exec-root to libnetwork-setkey
2018-09-28 15:20:37 +02:00
Tibor Vass
52b60f705c fix daemon tests that were using wrong containerd socket
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-25 17:57:35 +00:00
Tibor Vass
34eede0296 Remove 'docker-' prefix for containerd and runc binaries
This allows to run the daemon in environments that have upstream containerd installed.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-24 21:49:03 +00:00
Yong Tang
30b5eb19d4
Merge pull request #37851 from adshmh/migrate-ipc-integration-tests-to-integration-container
migrated ipc integration tests to integration/container
2018-09-22 09:58:56 -07:00
song
c80e20f93f fix typos in service.go and plugin.go
Signed-off-by: song <tinysong1226@gmail.com>
Signed-off-by: Rongxiang Song <tinysong1226@gmail.com>
2018-09-18 10:48:39 +08:00
Akihiro Suda
40385208cb daemon: propagate exec-root to libnetwork-setkey
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-09-15 13:49:30 +09:00
Arash Deshmeh
febefb850d migrated ipc integration tests to integration/container
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-14 17:19:34 -04:00
Sebastiaan van Stijn
bf95fbc54f
Use errors.Wrap() in daemon errors, and cleanup messages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-23 16:12:44 +02:00
selansen
f7ad95cab9 Global Default Address Pool feature support
This feature allows user to specify list of subnets for global
default address pool. User can configure subnet list using
'swarm init' command. Daemon passes the information to swarmkit.
We validate the information in swarmkit, then store it in cluster
object. when IPAM init is called, we pass subnet list to IPAM driver.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-20 15:07:08 -04:00
Sebastiaan van Stijn
e1584514c1
Merge pull request #37485 from fcrisciani/resolv
Systemd-resolved proper handling
2018-08-01 14:52:33 +02:00
Pavel Tikhomirov
2ed53943f3
Don not lose an error message from d.StartWithError in d.Start
Else it is harder to understand where we've failed in StartWithLogFile

We have an errror:

[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
[d42ce729d0b06] waiting for daemon to start
docker_cli_userns_test.go:27:
    s.d.StartWithBusybox(c, "--userns-remap", "default")
/go/src/github.com/docker/docker/internal/test/daemon/daemon.go:203:
    t.Fatalf("Error starting daemon with arguments: %v", args)
... Error: Error starting daemon with arguments: [--userns-remap default]

[d42ce729d0b06] exiting daemon

Likely it is "[..] Daemon exited during startup" case, but these error
message is lost

Also we lose the error returned by waiting daemon so also add it

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2018-07-30 10:33:03 +02:00
Kir Kolyshkin
2c2834ba4d integration: fix log message
The message was mistakenly replaced with a completely different one.

Fixes: cf2ea76138

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-07-27 11:47:59 +03:00
Flavio Crisciani
0fc52ca6dd
Add a way to get a pid of a process
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-26 11:17:46 -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
e401b88e59
Add support for init on services
It's already supported by `swarmkit`, and act the same as
`HostConfig.Init` on container creation.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-07 14:17:55 +02:00