TritonDataCenter / node-docker-registry-client

node.js client for the docker registry
Mozilla Public License 2.0
64 stars 33 forks source link

test suite against docker.io is busted #7

Closed trentm closed 8 years ago

trentm commented 8 years ago
$ ./node_modules/.bin/tape test/v2.dockerio.test.js
TAP version 13
# v2 docker.io
#   createClient
ok 1 (unnamed assert)
ok 2 should be equal
#   ping
ok 3 (unnamed assert)
ok 4 have a response
ok 5 should be equal
ok 6 (unnamed assert)
#   listTags
ok 7 undefined
ok 8 (unnamed assert)
ok 9 should be equal
ok 10 no "latest" tag
#   getManifest
ok 11 undefined
ok 12 (unnamed assert)
ok 13 should be equal
ok 14 should be equal
ok 15 should be equal
ok 16 (unnamed assert)
ok 17 (unnamed assert)
ok 18 (unnamed assert)
ok 19 (unnamed assert)
#   getManifest (by digest)
ok 20 undefined
ok 21 (unnamed assert)
ok 22 schemaVersion
ok 23 name
ok 24 tag
ok 25 architecture
#   getManifest (unknown tag)
ok 26 (unnamed assert)
ok 27 (unnamed assert)
ok 28 should be equal
#   headBlob
ok 29 null
ok 30 (unnamed assert)
ok 31 (unnamed assert)
ok 32 (unnamed assert)
not ok 33 should be equal
  ---
    operator: equal
    expected: |-
      'sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4'
    actual: |-
      undefined
    at: next (/Users/trentm/joy/node-docker-registry-client/node_modules/vasync/lib/vasync.js:201:4)
  ...
ok 34 should be equal
ok 35 (unnamed assert)
ok 36 should be equal
not ok 37 expected content-type: application/octet-stream
  ---
    operator: ok
    expected: true
    actual:   0
    at: next (/Users/trentm/joy/node-docker-registry-client/node_modules/vasync/lib/vasync.js:201:4)
  ...
ok 38 (unnamed assert)
#   headBlob (unknown digest)
ok 39 (unnamed assert)
ok 40 (unnamed assert)
ok 41 (unnamed assert)
ok 42 should be equal
ok 43 should be equal
ok 44 should be equal
#   createBlobReadStream
ok 45 null
ok 46 (unnamed assert)
ok 47 (unnamed assert)
ok 48 (unnamed assert)
not ok 49 should be equal
  ---
    operator: equal
    expected: |-
      'sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4'
    actual: |-
      undefined
    at: next (/Users/trentm/joy/node-docker-registry-client/node_modules/vasync/lib/vasync.js:201:4)
  ...
ok 50 should be equal
ok 51 (unnamed assert)
ok 52 should be equal
ok 53 should be equal
ok 54 (unnamed assert)
ok 55 should be equal
ok 56 should be equal
#   createBlobReadStream (unknown digest)
ok 57 (unnamed assert)
ok 58 (unnamed assert)
ok 59 (unnamed assert)
ok 60 should be equal
ok 61 should be equal
ok 62 should be equal
#   close

1..62
# tests 62
# pass  59
# fail  3

I gather Docker Hub changes (update to new ver of docker/distribution?) changed response headers for headBlob and getBlob. E.g. this call (judging from the test suite here) used to include a Docker-Content-Digest header in the first response:

$ node headBlob.js busybox@sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
# response 1 headers
{
    "content-type": "application/octet-stream",
    "docker-distribution-api-version": "registry/2.0",
    "location": "https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/data?Expires=1461709187&Signature=Oy2dHuSl-5k9y-mS9iKWwgNPKGZsVWz2wqMXs5eTCIz~1hPC7AUVO-MipQJTtvG89VMgdCtkn0J2ByFJVep-Z2Zt-uzG24OJ4hMIu5E~leLwVE6ot-LDSlEi8TI67JRjQZ2Eg-pvnbBNU88cX9XgvMW2tsKI3ls-dT1002VYoKU_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q",
    "date": "Tue, 26 Apr 2016 21:59:47 GMT",
    "strict-transport-security": "max-age=31536000"
}
# response 2 headers
{
    "content-type": "application/octet-stream",
    "content-length": "32",
    "connection": "keep-alive",
    "date": "Tue, 29 Mar 2016 10:21:22 GMT",
    "x-amz-version-id": "mSZnulvkQ2rnXHxnyn7ciahEgq419bja",
    "last-modified": "Sat, 14 Nov 2015 09:09:44 GMT",
    "etag": "\"54a01009f17bdb7ec1dd1cb427244304\"",
    "accept-ranges": "bytes",
    "server": "AmazonS3",
    "age": "39449",
    "x-cache": "Hit from cloudfront",
    "via": "1.1 b0cf369613943ba2695ad3f15a483dc3.cloudfront.net (CloudFront)",
    "x-amz-cf-id": "Y9eVzUQvs7ugLRgKQsTvBpHCoW8SQb6ShZaMtR1Hvm-uWRVeiVlArw=="
}

The docs say that header will be there but, per this existing comment in node-docker-registry-client, the Docker-docker client doesn't require it:

 * Note: While the spec says the registry response will include the
 * Docker-Content-Digest and Content-Length headers, there is a suggestion that
 * this was added to the spec in rev "a", see
 * <https://docs.docker.com/registry/spec/api/#changes>. Also, if I read it
 * correctly, it looks like Docker's own registry client code doesn't
 * require those headers:
 *     // JSSTYLED
 *     https://github.com/docker/distribution/blob/master/registry/client/repository.go#L220
 * So this implementation won't require them either.
trentm commented 8 years ago

fixed in ^