Commit graph

64 commits

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

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-05-02 18:14:13 -07:00
Vincent Demeester
54ebe42de9
Fix #22240 do not pull all the tags implicitely
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-05-01 14:46:04 +02:00
Aaron Lehmann
745892a7b2 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>
2016-03-29 10:04:59 -07:00
Antonio Murdaca
1b5c2e1d72 distribution: errors: do not access the errors slice if it's empty
- cherry-pick from 1.10.3 branch: 0186f4d422
- add token service test suite
- add integration test (missing in 1.10.3 branch)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-03-16 09:00:39 +01:00
Antonio Murdaca
6d23c3c57a 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>
2016-03-14 12:43:10 +01:00
Yong Tang
461976d2af 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>
2016-03-03 14:51:54 +00:00
Aaron Lehmann
0d270cadd4 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>
2016-03-01 17:02:06 -08:00
Aaron Lehmann
8842011153 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>
2016-02-17 13:08:51 -08:00
Aaron Lehmann
87338bf0fa 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>
2016-01-18 15:49:08 -08:00
Phil Estes
6c30931b06 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
2016-01-05 16:20:04 -05:00
David Calavera
51fa287368 Merge pull request #18714 from jecarey/16756-docker_cli_pull_test
Use of checkers in docker_cli_pull_test.go
2015-12-30 10:00:41 -08:00
Aaron Lehmann
589a5226e7 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>
2015-12-23 15:21:43 -08:00
Aaron Lehmann
9d6acbee92 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>
2015-12-21 18:19:38 -08:00
James Carey
1b010516d0 Use of checkers in docker_cli_pull_test.go
Signed-off-by: James Carey <jecarey@us.ibm.com>
2015-12-21 14:04:38 -06:00
Aaron Lehmann
a57478d65f 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>
2015-12-16 15:02:03 -08:00
Aaron Lehmann
572ce80230 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>
2015-12-09 19:13:35 -08:00
Aaron Lehmann
d17669999f 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>
2015-12-08 11:23:04 -08:00
Tonis Tiigi
4352da7803 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>
2015-11-24 09:40:25 -08:00
Tonis Tiigi
504e67b867 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>
2015-10-12 10:51:28 -07:00
Vincent Demeester
5109071706 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>
2015-09-09 15:36:44 +02:00
John Howard
f9a3558a9d Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-04 12:32:40 -07:00
Arnaud Porterie
f324f4851f 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>
2015-09-03 15:57:41 -07:00
Tonis Tiigi
9dd6c8822d Use DockerSuite for PullClientDisconnect test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-08-27 11:22:54 -07:00
Tonis Tiigi
8eeafa058c Fix pull on client disconnect
Fixes #15589

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-08-18 09:41:37 -07:00
Derek McGowan
bf3c1e6a3a 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)
2015-07-29 12:09:40 -07:00
Brian Goff
693ba98cb9 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-27 14:33:32 -04:00
Derek McGowan
259cadb0b1 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)
2015-07-24 16:31:18 -07:00
Diogo Monica
3e90b12d42 Added tests for expired snapshots and timestamps
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 16:31:18 -07:00
Nathan McCauley
268fa5af47 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-24 16:31:18 -07:00
Derek McGowan
871d2b96ed 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)
2015-07-24 16:31:12 -07:00
Diogo Monica
eeb6d0a71b Add test for incorrect nonroot passphrase
Fix failing tests for create, push, and pull

Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 14:08:20 -07:00
Nathan McCauley
1406cb35fd Add trust tests for Docker create, run, push, and pull
Created date util function

Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-24 14:08:20 -07:00
Diogo Monica
356b07c896 Add more integration tests for trusted push and pull
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-24 14:08:20 -07:00
Derek McGowan
58a1de9b59 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)
2015-07-24 14:08:20 -07:00
Derek McGowan
19515a7ad8 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>
2015-07-16 13:13:47 -04:00
Vincent Demeester
5c295460da 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>
2015-07-14 21:52:43 +02:00
Yuan Sun
c9a4c1401f Add TestPullImageWithAllTagFromCentralRegistry test case.
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
2015-07-08 19:47:33 +08:00
Alexander Morozov
f696b1071a Implement DockerRegistrySuite in integration-cli
To avoid manually creating and destroying registrys in tests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 14:17:00 -07:00
Alexander Morozov
a9688cdca5 Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-24 10:37:21 -07:00
Jessie Frazelle
68fc79f592 Merge pull request #12655 from jlhawn/fix_12281
Validate repo name before image pull
2015-04-23 13:12:12 -07:00
Josh Hawn
18f4688385 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)
2015-04-23 11:44:46 -07:00
Jessica Frazelle
7a525c6cb7 add integration test for error pull nonexistent
Signed-off-by: Jessica Frazelle <princess@docker.com>
2015-04-22 14:11:25 -07:00
Alexander Morozov
dc944ea7e4 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>
2015-04-21 10:28:52 -07:00
Arnaud Porterie
9a4fa9c191 Skip TestPullVerified
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-04-16 23:05:47 -07:00
Arnaud Porterie
8900ae2928 Revert all but TestPullImageFromCentralRegistry changes
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-24 16:27:35 -07:00
Srini Brahmaroutu
5d70a97b1f 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>
2015-03-23 22:53:04 +00:00
Arnaud Porterie
3b4ff1c132 Merge pull request #11264 from brahmaroutu/fixtest_10967
Test image api through local V1 repo, skip network test.
2015-03-23 15:20:39 -07:00
Srini Brahmaroutu
5daa9260bc Test image api through local V1 repo
Closes #10967
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-03-23 16:45:48 +00:00
Arnaud Porterie
33448ac3c9 Restore TestPullVerified test
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-22 17:56:05 -07:00
Tibor Vass
df389df990 Skip TestPullVerified because hello-world image cannot be verified
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-03-22 19:34:40 -04:00