Commit graph

2330 commits

Author SHA1 Message Date
Aaron Lehmann
6052f2b396 Remove pkg/testutil/assert in favor of testify
I noticed that we're using a homegrown package for assertions. The
functions are extremely similar to testify, but with enough slight
differences to be confusing (for example, Equal takes its arguments in a
different order). We already vendor testify, and it's used in a few
places by tests.

I also found some problems with pkg/testutil/assert. For example, the
NotNil function seems to be broken. It checks the argument against
"nil", which only works for an interface. If you pass in a nil map or
slice, the equality check will fail.

In the interest of avoiding NIH, I'm proposing replacing
pkg/testutil/assert with testify. The test code looks almost the same,
but we avoid the confusion of having two similar but slightly different
assertion packages, and having to maintain our own package instead of
using a commonly-used one.

In the process, I found a few places where the tests should halt if an
assertion fails, so I've made those cases (that I noticed) use "require"
instead of "assert", and I've vendored the "require" package from
testify alongside the already-present "assert" package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-14 12:03:21 -07:00
Daniel Nephin
e838679cd7 Add docs for reading Dockerfile from stdin.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-11 11:40:10 -04:00
Vincent Demeester
778e32a2fa Merge pull request #31236 from tonistiigi/docker-stdin
build: accept -f - to read Dockerfile from stdin
2017-04-10 20:14:54 +02:00
Brian Goff
8fabe07982 Merge pull request #32450 from miaoyq/fixed-a-bug-of-multireader
Reset the positions for all readers of multireader before reading the data
2017-04-10 11:39:47 -04:00
Yanqiang Miao
fd06bd6f96 Reset the position of all readers before reading the data
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-08 13:38:15 +08:00
Daniel Nephin
8cd6c30a48 Upadte archive.ReplaceFileTarWrapper() to not expect a sorted archive
Improve test coverage of ReplaceFileTarWrapper()

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-06 13:36:34 -04:00
Brian Goff
fa3e2d5ab9 Merge pull request #32387 from Microsoft/jjh/tidystat
Tidy pkg\system *stat* functions
2017-04-06 08:40:27 -04:00
Brian Goff
9691170de9 Merge pull request #32383 from Microsoft/jjh/removeunused
Windows: Remove unused process_windows.go
2017-04-05 23:32:40 -04:00
Daniel Nephin
56bf6de9f7 Factor out adding dockerfile from stdin.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-05 19:42:31 -04:00
David Sheets
3f6dc81e10 build: accept -f - to read Dockerfile from stdin
Heavily based on implementation by David Sheets

Signed-off-by: David Sheets <sheets@alum.mit.edu>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-04-05 19:42:31 -04:00
John Howard
16c1ede79c Tidy pkg\system *stat* functions
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-04-05 16:01:53 -07:00
John Howard
329daee5ef Windows: Remove unused process_windows.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-04-05 11:04:34 -07:00
Aaron Lehmann
330a003533 Synchronous service create and service update
Change "service create" and "service update" to wait until the creation
or update finishes, when --detach=false is specified. Show progress bars
for the overall operation and for each individual task (when there are a
small enough number of tasks), unless "-q" / "--quiet" is specified.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-03 09:46:01 -07:00
Sebastiaan van Stijn
9c0473fa65 Merge pull request #32222 from unclejack/small_cleanup
Small cleanup
2017-03-30 21:09:39 +02:00
unclejack
a23c456e5a pkg/*: clean up a few issues
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-30 16:50:46 +03:00
unclejack
90a44b875c pkg/urlutil: don't compare to bool
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-30 16:38:01 +03:00
unclejack
20d6f5c2a9 pkg/file{utils,notify}: don't compare to bool
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-30 16:38:01 +03:00
unclejack
087f7307a6 pkg/{chroot,}archive: clean up a few small issues
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-30 16:37:54 +03:00
Aaron Lehmann
85357a1167 Make pkg/devicemapper and pkg/loopback depend on cgo in build tags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-29 17:55:42 -07:00
Aaron Lehmann
3da1192828 plugins: Rename plugins_linux.go to plugins_unix.go and use build tags
This allows pkg/authorization to build on OS X.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-29 14:06:59 -07:00
Vincent Demeester
95510551ce Merge pull request #32156 from cpuguy83/index_copy_new_slice
Don't pass reference to mutable slice
2017-03-28 10:23:08 +02:00
Brian Goff
d5b7839008 Don't pass reference to mutable slice
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-03-27 21:23:06 -04:00
Ivan Markin
925bc27b81 Fix building client on OpenBSD
Signed-off-by: Ivan Markin <twim@riseup.net>
2017-03-26 20:47:18 +00:00
Akihiro Suda
8008f65293 Merge pull request #31608 from vdemeester/integration-cli-package
[test-integration] Introduce a `cli` package for test-integration
2017-03-24 13:04:47 +09:00
Tõnis Tiigi
2fa8fe400d Merge pull request #31257 from tonistiigi/nested-build
build: add multi-stage build support
2017-03-23 19:14:13 -07:00
Tonis Tiigi
f95f58283b Add support for COPY from previous rootfs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-03-23 15:12:15 -07:00
Vincent Demeester
50c4475df6
Introduce a cli package for test-integration
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-03-23 18:35:22 +01:00
Anusha Ragunathan
bbce24997c Merge pull request #31930 from anusha-ragunathan/authz-disable
When authz plugin is disabled, remove from authz middleware chain.
2017-03-22 14:17:38 -07:00
Anusha Ragunathan
38de272bd4 When authz plugin is disabled, remove from authz middleware chain.
When the daemon is configured to run with an authorization-plugin and if
the plugin is disabled, the daemon continues to send API requests to the
plugin and expect it to respond. But the plugin has been disabled. As a
result, all API requests are blocked. Fix this behavior by removing the
disabled plugin from the authz middleware chain.

Tested using riyaz/authz-no-volume-plugin and observed that after
disabling the plugin, API request/response is functional.

Fixes #31836

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
2017-03-22 12:07:39 -07:00
Vincent Demeester
2422d5ad35 Merge pull request #31669 from tonistiigi/files-filter
Fix inefficient file paths filter
2017-03-20 17:43:47 +01:00
cooltoast
234b2203e5 Add Johannes Kepler and Mary Jackson to name generator
Signed-off-by: cooltoast <mpatel678@gmail.com>
2017-03-17 20:36:12 -07:00
unclejack
5957dc4899 pkg/archive/diff.go: avoid redundant options init
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-15 18:03:33 +02:00
Tonis Tiigi
c7c2cd4e8e Fix default socket group regression
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-03-14 16:09:08 -07:00
John Howard (VM)
f577131d3b Fix stringer in Result (pkg\testutil\cmd)
Signed-off-by: John Howard (VM) <jhoward@ntdev.microsoft.com>
2017-03-13 08:40:31 -07:00
James Nugent
4683f588ce pkg/system: Set appropriate CFLAGS on Solaris
The cgo in `meminfo_solaris.go` initializes variables in for loops, and
therefore requires a `-std=c99` `CFLAG` in order to compile (at least on
modern SmartOS).

Signed-off-by: James Nugent <james@jen20.com>
2017-03-09 13:40:05 -05:00
Tonis Tiigi
adeb3e3684 Fix inefficient file paths filter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-03-08 18:59:25 -08:00
Kenfe-Mickaël Laventure
9369acc776 Merge pull request #30733 from yongtang/02022017-formatter-header
Allow `--format` to use different delim in `table` format
2017-03-03 11:25:19 -08:00
Kenfe-Mickaël Laventure
d8b0d2b9e9 Merge pull request #30729 from dmcgowan/update-go-connections
Update go-connections package
2017-03-01 18:24:32 -08:00
Sebastiaan van Stijn
392ece2239
Improve coverage of pkg/ioutils/buffer
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-02-28 14:11:15 +01:00
phineas
da8cf590eb
Update copyright dates
Signed-off-by: phineas <phin@phineas.io>
2017-02-24 19:41:59 +00:00
Alexander Morozov
d52350d662 Merge pull request #30416 from stevenh/linux-mount-fixes
Fix linux mount calls not applying propagation type changes
2017-02-15 14:10:54 -08:00
Steven Hartland
b3b14b97b1 Fix linux mount calls not applying propagation type changes
Propagation type changes must be done as a separate call, in the
same way as read only bind mounts.

To fix this:
1. Ensure propagation type change flags aren't included in other calls.
2. Apply propagation type change in a separate call.

Also:
* Make it clear which parameters are ignored by passing them as empty.
* Add tests to ensure Mount options are applied correctly.

Fixes #30415

Signed-off-by: Steven Hartland <steven.hartland@multiplay.co.uk>
2017-02-15 14:15:09 +00:00
Drew Erny
f19b0d72d1 fix docker logs error handling
Previously, `docker logs` (and by extension, `docker service logs`) had
an error in the way they returned errors that occurred after a stream
had already been started. Specifically, the errors were added verbatim
to the HTTP response, which caused StdCopy to fail with an esoteric
error. This change updates StdCopy to accept errors from the source
stream and then return those errors when copying to the destination
stream.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-02-14 14:38:42 -08:00
Yong Tang
8b165cad1a Ignore some functions in the Go template when header is rendered
This fix ignore some functions in the Go template when header is
redendered, so that `--format "{{truncate .ID 1}}"` will still
be able to redener the header correctly.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 19:34:50 -08:00
Brian Goff
bdf4cad1d1 Do group lookup in listeners package
This used to be handled by go-connections, but now it only takes a group
ID (int).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-02-09 16:38:52 -05:00
Derek McGowan
e5d77c64a2 Convert socket group to int
Sockets interface has been updated to take in a the group
id as an integer rather than a string.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-09 16:10:38 -05:00
Vincent Demeester
cb89d658dc
Bump go-units
To include  https://github.com/docker/go-units/pull/23
Fixes a unit test that fails because of it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-07 21:58:56 +01:00
Brian Goff
f907205f5d Merge pull request #30430 from Thynix/30374-remove-kickass
Replace "kickass" in name generator with "vigorous"
2017-02-01 10:33:07 -05:00
Steve Dougherty
2b30a79d9e
Replace "kickass" in name generator with "vigorous"
Having curse words in container names can get awkward.

Closes #30374.

Signed-off-by: Steve Dougherty <steve@asksteved.com>
2017-01-31 21:33:23 -05:00
Yong Tang
7fa8d5e064 Add truncate function for Go templates
This fix is part of the discussion in 28199 about using
`truncate` to replace `--no-trunc`.

As part of the fix, a new function `truncate` has been
added for Go templates so that it is possible to use
```
docker stack services --format "{{truncate .ID 5}}: {{.Mode}} {{.Replicas}}"
```
to show truncated ID.

A unit test has been added.

This fix is related to 28199.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-30 13:33:16 -08:00