Commit Graph

64 Commits

Author SHA1 Message Date
fb1770417a Move implicit pull test to use local registry
Using hub only works for amd64 platforms.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 641c1808e187ed86d8b614e49e8e6da5146201e3
Component: engine
2016-05-02 18:14:13 -07:00
9fb835ad73 Fix #22240 do not pull all the tags implicitely
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 54ebe42de9c359e0c9f171953bd787bb997d719e
Component: engine
2016-05-01 14:46:04 +02:00
eef44cf65d Change v1 pull 404 message to include tag
The current error message is "Error: image [name] not found". This makes
sense from the perspective of the v1 pull, since we found the repository
doesn't exist over the v1 protocol. However, in the vast majority of
cases, this error will be produced by fallback situations, where we
first try to pull the tag with the v2 protocol, and then fall back the
v1 protocol, which probably isn't even supported by the server.
Including the tag in the error message makes a lot more sense since the
actual repository may exist on v2, but not the tag.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 745892a7b271cf0f1770a8ec3698aaf61573e5f2
Component: engine
2016-03-29 10:04:59 -07:00
f9e5200e21 distribution: errors: do not access the errors slice if it's empty
- cherry-pick from 1.10.3 branch: 0186f4d4223a094a050d06f456355da3ae431468
- add token service test suite
- add integration test (missing in 1.10.3 branch)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 1b5c2e1d722757a55364fb45cf3fcec7f2c75fb4
Component: engine
2016-03-16 09:00:39 +01:00
cad593b9ac integration-cli: add tests for case a) and d) in #21054
- add test for pull from private registry with no credentials
- add test for push to docker hub with no credentials

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Signed-off-by: Antonio Murdaca <amurdaca@localhost.localdomain>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 6d23c3c57a733436d902b7883f2f0b00846df9e2
Component: engine
2016-03-14 12:43:10 +01:00
27ef35473a Optimize slow bottleneck test of DockerHubPullSuite.TestPullNonExistingImage.
This PR fix the DockerHubPullSuite.TestPullNonExistingImage test
in #19425. The majority of the execution time in this test is
from multiple executions of 'docker pull', each of which takes
more than one second even though it tries to pull a non-existing
image.
Without changing the behavior of the 'docker pull' itself, this
fix tries to execute the 'docker pull' command in parallel in
order to speed up the execution of the overall test.
Since each 'docker pull' is independent, executions in parallel
should not alter the purpose of the test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 461976d2affe3ed4a354608d1dcb266e06f1d2b9
Component: engine
2016-03-03 14:51:54 +00:00
213ab0aa23 Another attempt to deflake TestPullFromCentralRegistryImplicitRefParts
Retries after v1 fallbacks were added in #20411. The test still appears
to be flaky. There are two potential problems. The initial pull was not
protected against pulling from v1, so it could be giving us a different
hello-world image to compare against. Also, after experiencing a v1
fallback, we need to restore the original image before doing the next
pull, because otherwise the "Image is up to date for hello-world:latest"
message will not show up as expected.

See #17214.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 0d270cadd4b65623b1f1ae02c4fe5bcc5f81fcd3
Component: engine
2016-03-01 17:02:06 -08:00
e1d1f67bc5 Improve resilience of TestPullFromCentralRegistryImplicitRefParts
Sometimes transient network issues will cause
TestPullFromCentralRegistryImplicitRefParts to end up pulling with the
v1 protocol. This violates the assumptions behind the test. To make the
test more robust, allow a few retries if any pull ends up using the v1
protocol.

Fixes #17214

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 884201115315abb0c7815e44e6728e590476aeb8
Component: engine
2016-02-17 13:08:51 -08:00
8a0c8b1a34 Revert reporting of multiple pull errors
Revert the portions of #17617 that report all errors when a pull
falls back, and go back to just reporting the last error. This was nice
to have, but causes some UX issues because nonexistent images show
additional "unauthorized" errors.

Keep the part of the PR that handled ENOSPC, as this appears to work
even without tracking multiple errors.

Fixes #19419

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 87338bf0fa97c905d2d707393c95f73aea398cad
Component: engine
2016-01-18 15:49:08 -08:00
156d67e60e Merge pull request #18889 from aaronlehmann/v1-fallback-pull-all-tags
Allow v1 protocol fallback when pulling all tags from a repository unknown to v2 registry
Upstream-commit: 6c30931b06ff44e1ce002002430577b7135d2049
Component: engine
2016-01-05 16:20:04 -05:00
440e6d5df7 Merge pull request #18714 from jecarey/16756-docker_cli_pull_test
Use of checkers in docker_cli_pull_test.go
Upstream-commit: 51fa287368205e1f043d632e5930b7cce08a2419
Component: engine
2015-12-30 10:00:41 -08:00
04c33e2ef9 Allow v1 protocol fallback when pulling all tags from a repository unknown to v2 registry
This is a followup to #18839. That PR relaxed the fallback logic so that
if a manifest doesn't exist on v2, or the user is unauthorized to access
it, we try again with the v1 protocol. A similar special case is needed
for "pull all tags" (docker pull -a). If the v2 registry doesn't
recognize the repository, or doesn't allow the user to access it, we
should fall back to v1 and try to pull all tags from the v1 registry.
Conversely, if the v2 registry does allow us to list the tags, there
should be no fallback, even if there are errors pulling those tags.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 589a5226e7d4880ab7afa9e31202849db08a4bfa
Component: engine
2015-12-23 15:21:43 -08:00
ccad5598d4 When a manifest is not found, allow fallback to v1
PR #18590 caused compatibility issues with registries such as gcr.io
which support both the v1 and v2 protocols, but do not provide the same
set of images over both protocols. After #18590, pulls from these
registries would never use the v1 protocol, because of the
Docker-Distribution-Api-Version header indicating that v2 was supported.

Fix the problem by making an exception for the case where a manifest is
not found. This should allow fallback to v1 in case that image is
exposed over the v1 protocol but not the v2 protocol.

This avoids the overly aggressive fallback behavior before #18590 which
would allow protocol fallback after almost any error, but restores
interoperability with mixed v1/v2 registry setups.

Fixes #18832

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 9d6acbee92016c47796ee8751dce9c59056f850d
Component: engine
2015-12-21 18:19:38 -08:00
def74d9c92 Use of checkers in docker_cli_pull_test.go
Signed-off-by: James Carey <jecarey@us.ibm.com>
Upstream-commit: 1b010516d09fb587999eff6abb69cc76b25f7944
Component: engine
2015-12-21 14:04:38 -06:00
d2691dfadc Do not fall back to the V1 protocol when we know we are talking to a V2 registry
If we detect a Docker-Distribution-Api-Version header indicating that
the registry speaks the V2 protocol, no fallback to V1 should take
place.

The same applies if a V2 registry operation succeeds while attempting a
push or pull.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: a57478d65f1f5782cc746c260f9d841a0907ce54
Component: engine
2015-12-16 15:02:03 -08:00
547342d777 Improved push and pull with upload manager and download manager
This commit adds a transfer manager which deduplicates and schedules
transfers, and also an upload manager and download manager that build on
top of the transfer manager to provide high-level interfaces for uploads
and downloads. The push and pull code is modified to use these building
blocks.

Some benefits of the changes:

- Simplification of push/pull code
- Pushes can upload layers concurrently
- Failed downloads and uploads are retried after backoff delays
- Cancellation is supported, but individual transfers will only be
  cancelled if all pushes or pulls using them are cancelled.
- The distribution code is decoupled from Docker Engine packages and API
  conventions (i.e. streamformatter), which will make it easier to split
  out.

This commit also includes unit tests for the new distribution/xfer
package. The tests cover 87.8% of the statements in the package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 572ce802306a4e919802e5b77cbeca94acda7c0a
Component: engine
2015-12-09 19:13:35 -08:00
7d8daf7bad Fix flaky test TestPullAllTagsFromCentralRegistry
This test was directly comparing lines of output from "docker images".
Sometimes, when busybox had been pushed to the hub recently, the
relative creation times would differ like this:

... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"}
... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"}

Fixing by removing the time-since-creation fields from the comparison.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d17669999fff55219f5ed236f00fdf8a08d09304
Component: engine
2015-12-08 11:23:04 -08:00
e105a29374 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4352da7803d182a6013a5238ce20a7c749db979a
Component: engine
2015-11-24 09:40:25 -08:00
eb67a37877 Calculate hash based image IDs on pull
Generate a hash chain involving the image configuration, layer digests,
and parent image hashes. Use the digests to compute IDs for each image
in a manifest, instead of using the remotely specified IDs.

To avoid breaking users' caches, check for images already in the graph
under old IDs, and avoid repulling an image if the version on disk under
the legacy ID ends up with the same digest that was computed from the
manifest for that image.

When a calculated ID already exists in the graph but can't be verified,
continue trying SHA256(digest) until a suitable ID is found.

"save" and "load" are not changed to use a similar scheme. "load" will
preserve the IDs present in the tar file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 504e67b867865a2835e8002c01087a2cfd7bfd0e
Component: engine
2015-10-12 10:51:28 -07:00
3d19f9af55 Add unit tests for integration cli utils function
- utils_test.go and docker_utils_test.go
- Moved docker related function to docker_utils.go
- add a test for integration-cli/checker

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5109071706cab06257b21172627ce51e5fa3a88c
Component: engine
2015-09-09 15:36:44 +02: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
0249cbd7d9 Update image pull tests
Update and migrate existing tests to the `DockerHubPullSuite`. Most
tests were preserved, but refactored and made more exhaustive. One test
was deliberately removed (`TestPullVerified`) as it is unreliable and
that the feature was obsoleted by content trust.

Move all trust related tests to `docker_cli_pull_trusted_test.go`.

Move tests depending on a local registry to `docker_cli_pull_local_test.go`.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: f324f4851f28edfd8dab82cd624a4ec1f01cd207
Component: engine
2015-09-03 15:57:41 -07:00
190c9ba004 Use DockerSuite for PullClientDisconnect test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 9dd6c8822ddccff1952dfd611263ba551693ff7d
Component: engine
2015-08-27 11:22:54 -07:00
2a748ae2e6 Fix pull on client disconnect
Fixes #15589

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8eeafa058c762b303436422a4682c364fe469985
Component: engine
2015-08-18 09:41:37 -07:00
4c1bdea55d Skip notary tests which update system clock
Currently some notary tests change the system clock to check for expiration.
Skip these tests until the code can be refactored to not rely on updating the system clock.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: bf3c1e6a3afc951e41643b8d55d4ac25fa9cb06d
Component: engine
2015-07-29 12:09:40 -07:00
6e14356132 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 693ba98cb9118bf15caaabc69ca281c0ce604226
Component: engine
2015-07-27 14:33:32 -04:00
99a373ceb8 Rename to flags and environment variables to content trust
Update help line to allow 90 characters instead of 80

The trust flag pushes out the help description column wider, requiring more room to display help messages.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 259cadb0b19a9049302e78fec529b0105efabb1d
Component: engine
2015-07-24 16:31:18 -07:00
e5887c6923 Added tests for expired snapshots and timestamps
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 3e90b12d42f6f937639edafa4b2ddc12badf8895
Component: engine
2015-07-24 16:31:18 -07:00
937cba2db1 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 268fa5af4768f7b1df32501d5f7ba0daba2c2da1
Component: engine
2015-07-24 16:31:18 -07:00
97834446bf Add build integration cli tests
Clean up tests to remove duplicate code

Add tests which run pull and create in an isolated configuration directory.
Add build test for untrusted tag

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 871d2b96ed5cf234c41a5e731a34fc9deda4e9f1
Component: engine
2015-07-24 16:31:12 -07:00
08efdea505 Add test for incorrect nonroot passphrase
Fix failing tests for create, push, and pull

Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: eeb6d0a71b754c1c99748f7ba08be27e4d8b8eb9
Component: engine
2015-07-24 14:08:20 -07:00
be6fe06878 Add trust tests for Docker create, run, push, and pull
Created date util function

Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 1406cb35fd814a987b91f92ed1a4b61a21205736
Component: engine
2015-07-24 14:08:20 -07:00
5eae9c3c28 Add more integration tests for trusted push and pull
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 356b07c89602e4f5e9c9d4c53ec24b341b4e7865
Component: engine
2015-07-24 14:08:20 -07:00
b82ed8bb95 Add integration cli trust tests
Added notary server to docker base image.
Created trust suite which runs trust server for running trusted commands.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 58a1de9b59594948df152f0003e759b77bcaa56a
Component: engine
2015-07-24 14:08:20 -07:00
1492d5ce64 Update graph to use vendored distribution client for the v2 codepath
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 19515a7ad859b28c474d81e756ac245afcd968e3
Component: engine
2015-07-16 13:13:47 -04:00
abe73960d5 Use dockerCmd when possible (#14603)
- integration-cli/docker_cli_attach_test.go
- integration-cli/docker_cli_attach_unix_test.go
- integration-cli/docker_cli_build_test.go
- integration-cli/docker_cli_build_unix_test.go
- integration-cli/docker_cli_by_digest_test.go
- integration-cli/docker_cli_commit_test.go
- integration-cli/docker_cli_config_test.go
- integration-cli/docker_cli_cp_test.go
- integration-cli/docker_cli_create_test.go
- integration-cli/docker_cli_pause_test.go
- integration-cli/docker_cli_port_test.go
- integration-cli/docker_cli_port_unix_test.go
- integration-cli/docker_cli_proxy_test.go
- integration-cli/docker_cli_ps_test.go
- integration-cli/docker_cli_pull_test.go
- integration-cli/docker_cli_push_test.go

- docker_api_attach_test.go
- docker_api_containers_test.go
- docker_api_events_test.go
- docker_api_exec_resize_test.go
- docker_api_exec_test.go
- docker_api_images_test.go
- docker_api_info_test.go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5c295460da2098d971eda28a73b416ff6be62f53
Component: engine
2015-07-14 21:52:43 +02:00
f310d0a0b6 Add TestPullImageWithAllTagFromCentralRegistry test case.
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Upstream-commit: c9a4c1401fc79d6cdee222a2b82cdb8379402552
Component: engine
2015-07-08 19:47:33 +08:00
a2a6303a84 Implement DockerRegistrySuite in integration-cli
To avoid manually creating and destroying registrys in tests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: f696b1071a296bee1f4ac7cafa807ce337fb9f2c
Component: engine
2015-04-24 14:17:00 -07:00
c48fdf0abd Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a9688cdca5577d6db65d76f38bcbe4c1e6f5994f
Component: engine
2015-04-24 10:37:21 -07:00
88eea81abe Merge pull request #12655 from jlhawn/fix_12281
Validate repo name before image pull
Upstream-commit: 68fc79f5924bc76111422eec5b7713a586febd96
Component: engine
2015-04-23 13:12:12 -07:00
8cb2465efc Validate repo name before image pull
Checks for reserved 'scratch' image name.

fixes #12281

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 18f46883851e47387ec2bd116940cdae97ba3c8d
Component: engine
2015-04-23 11:44:46 -07:00
f72daf37a9 add integration test for error pull nonexistent
Signed-off-by: Jessica Frazelle <princess@docker.com>
Upstream-commit: 7a525c6cb74af854d621f5560868b32694d2553b
Component: engine
2015-04-22 14:11:25 -07:00
1884ef3b9b Use suite for integration-cli
It prints test name and duration for each test.
Also performs deleteAllContainers after each test.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: dc944ea7e48d11a2906e751d3e61daf08faee054
Component: engine
2015-04-21 10:28:52 -07:00
7e8cef686e Skip TestPullVerified
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 9a4fa9c19167756cf39a4d002efe81d4bcd3bb75
Component: engine
2015-04-16 23:05:47 -07:00
11fbf94cfd Revert all but TestPullImageFromCentralRegistry changes
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 8900ae2928cea8f4b5d52ff68253cad2504edd6c
Component: engine
2015-03-24 16:27:35 -07:00
92fbf90d6e Fix the TestPullImageFromCentralRegistry to skip and add local v1 registry test when net=none
Closes #10966
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 5d70a97b1fff8286220d2bef9ceb248401f046d1
Component: engine
2015-03-23 22:53:04 +00:00
293d14edd7 Merge pull request #11264 from brahmaroutu/fixtest_10967
Test image api through local V1 repo, skip network test.
Upstream-commit: 3b4ff1c132669017f04d3b2e67517ff0c9a1a3df
Component: engine
2015-03-23 15:20:39 -07:00
31ae66ceae Test image api through local V1 repo
Closes #10967
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 5daa9260bcef2a47c493adc04e6638c9d200a9cf
Component: engine
2015-03-23 16:45:48 +00:00
67fed9c55e Restore TestPullVerified test
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 33448ac3c9c0c63fb07f7bf04cec998d3536fc10
Component: engine
2015-03-22 17:56:05 -07:00
503af64bfc Skip TestPullVerified because hello-world image cannot be verified
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: df389df9904dc1585160d7992c6f3dc150490e05
Component: engine
2015-03-22 19:34:40 -04:00