diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0154e5961..1a9ec91e89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,8 +73,6 @@ jobs: go-version: '^1.15.0' - run: go test -gcflags=all=-d=checkptr -v ./... -tags admin - - run: go test -gcflags=all=-d=checkptr -v ./internal -tags admin - working-directory: test - run: go test -gcflags=all=-d=checkptr -c ./containerd-shim-runhcs-v1/ -tags functional working-directory: test - run: go test -gcflags=all=-d=checkptr -c ./cri-containerd/ -tags functional diff --git a/go.mod b/go.mod index 1797bd7f83..d0c21388b9 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 github.com/Microsoft/go-winio v0.4.17 + github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 github.com/cenkalti/backoff/v4 v4.1.1 github.com/containerd/cgroups v1.0.1 github.com/containerd/console v1.0.2 @@ -28,13 +29,13 @@ require ( github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.22.3 - golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e google.golang.org/grpc v1.40.0 ) replace ( + github.com/Microsoft/hcsshim/test => ./test google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 google.golang.org/grpc => google.golang.org/grpc v1.27.1 ) diff --git a/go.sum b/go.sum index afe9660c90..fce6716c99 100644 --- a/go.sum +++ b/go.sum @@ -22,9 +22,7 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= @@ -53,16 +51,15 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3 github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/Microsoft/hcsshim v0.9.1/go.mod h1:Y/0uV2jUab5kBI7SQgl62at0AVX7uaruzADAVmxm3eM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -70,22 +67,14 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -136,6 +125,8 @@ github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7 github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -225,14 +216,10 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017 h1:2HQmlpI3yI9deH18Q6xiSOIjXD4sLI55Y/gfpa8/558= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -243,11 +230,9 @@ github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avu github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -264,13 +249,11 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -300,7 +283,6 @@ github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/ github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -371,9 +353,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -400,8 +379,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -409,7 +386,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -436,7 +412,6 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -450,7 +425,6 @@ github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WT github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM= @@ -467,7 +441,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -489,15 +462,14 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -527,18 +499,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -576,8 +545,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -634,9 +601,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -708,7 +672,6 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -762,7 +725,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -839,7 +801,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -879,7 +840,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -896,7 +856,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= @@ -916,7 +875,6 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -969,7 +927,6 @@ k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NI k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= diff --git a/internal/schemaversion/schemaversion_test.go b/internal/schemaversion/schemaversion_test.go new file mode 100644 index 0000000000..e55e2955b8 --- /dev/null +++ b/internal/schemaversion/schemaversion_test.go @@ -0,0 +1,65 @@ +package schemaversion + +import ( + "io/ioutil" + "testing" + + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" + "github.com/Microsoft/hcsshim/osversion" + "github.com/sirupsen/logrus" + + // import solely for side-effect; maifest allows access to os version + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" +) + +func init() { + logrus.SetOutput(ioutil.Discard) +} + +func TestDetermineSchemaVersion(t *testing.T) { + osv := osversion.Get() + + if osv.Build >= osversion.RS5 { + if sv := DetermineSchemaVersion(nil); !IsV21(sv) { + t.Fatalf("expected v2") + } + if sv := DetermineSchemaVersion(SchemaV21()); !IsV21(sv) { + t.Fatalf("expected requested v2") + } + if sv := DetermineSchemaVersion(SchemaV10()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(&hcsschema.Version{}); !IsV21(sv) { + t.Fatalf("expected requested v2") + } + + if err := IsSupported(SchemaV21()); err != nil { + t.Fatalf("v2 expected to be supported") + } + if err := IsSupported(SchemaV10()); err != nil { + t.Fatalf("v1 expected to be supported") + } + + } else { + if sv := DetermineSchemaVersion(nil); !IsV10(sv) { + t.Fatalf("expected v1") + } + // Pre RS5 will downgrade to v1 even if request v2 + if sv := DetermineSchemaVersion(SchemaV21()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(SchemaV10()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(&hcsschema.Version{}); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + + if err := IsSupported(SchemaV21()); err == nil { + t.Fatalf("didn't expect v2 to be supported") + } + if err := IsSupported(SchemaV10()); err != nil { + t.Fatalf("v1 expected to be supported") + } + } +} diff --git a/test/cri-containerd/clone_test.go b/test/cri-containerd/clone_test.go index 01e675f846..e54d572024 100644 --- a/test/cri-containerd/clone_test.go +++ b/test/cri-containerd/clone_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -13,7 +14,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -239,7 +240,7 @@ func cleanupContainer(t *testing.T, client runtime.RuntimeServiceClient, ctx con // cloned container from that template. func Test_CloneContainer_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -264,7 +265,7 @@ func Test_CloneContainer_WCOW(t *testing.T) { // A test for creating multiple clones(3 clones) from one template container. func Test_MultiplClonedContainers_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -301,7 +302,7 @@ func Test_MultiplClonedContainers_WCOW(t *testing.T) { // container. func Test_NormalContainerInClonedPod_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -341,7 +342,7 @@ func Test_NormalContainerInClonedPod_WCOW(t *testing.T) { // of those pods. func Test_CloneContainersWithClonedPodPool_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -389,7 +390,7 @@ func Test_CloneContainersWithClonedPodPool_WCOW(t *testing.T) { func Test_ClonedContainerRunningAfterDeletingTemplate(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -423,7 +424,7 @@ func Test_ClonedContainerRunningAfterDeletingTemplate(t *testing.T) { // can be made from each of them simultaneously. func Test_MultipleTemplateAndClones_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -466,7 +467,7 @@ func Test_MultipleTemplateAndClones_WCOW(t *testing.T) { // and verifies that the request correctly fails with an error. func Test_VerifyCloneAndTemplateConfig(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/test/cri-containerd/container_downlevel_test.go b/test/cri-containerd/container_downlevel_test.go index 46c618a638..d74e09fe4f 100644 --- a/test/cri-containerd/container_downlevel_test.go +++ b/test/cri-containerd/container_downlevel_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -6,13 +7,13 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) func Test_CreateContainer_DownLevel_WCOW_Hypervisor(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredImages(t, []string{imageWindowsNanoserver17763}) diff --git a/test/cri-containerd/container_layers_packing_test.go b/test/cri-containerd/container_layers_packing_test.go index a0407f8999..57daf022df 100644 --- a/test/cri-containerd/container_layers_packing_test.go +++ b/test/cri-containerd/container_layers_packing_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -10,7 +11,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) const ( @@ -37,7 +38,7 @@ func validateTargets(ctx context.Context, t *testing.T, deviceNumber int, podID } func Test_Container_Layer_Packing_On_VPMem(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -92,7 +93,7 @@ func Test_Container_Layer_Packing_On_VPMem(t *testing.T) { } func Test_Many_Container_Layers_Supported_On_VPMem(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -123,7 +124,7 @@ func Test_Many_Container_Layers_Supported_On_VPMem(t *testing.T) { } func Test_Annotation_Disable_Multi_Mapping(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) diff --git a/test/cri-containerd/container_update_test.go b/test/cri-containerd/container_update_test.go index 0fa049d8e5..86ac807674 100644 --- a/test/cri-containerd/container_update_test.go +++ b/test/cri-containerd/container_update_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -9,7 +10,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -31,7 +32,7 @@ func calculateJobCPURate(hostProcs uint32, processorCount uint32) uint32 { } func Test_Container_UpdateResources_CPUShare(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) type config struct { name string requiredFeatures []string diff --git a/test/cri-containerd/createcontainer_test.go b/test/cri-containerd/createcontainer_test.go index aaff8fcd68..7628f5e20b 100644 --- a/test/cri-containerd/createcontainer_test.go +++ b/test/cri-containerd/createcontainer_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -13,7 +14,7 @@ import ( "github.com/Microsoft/go-winio" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -843,7 +844,7 @@ func Test_CreateContainer_CPUShares_LCOW(t *testing.T) { func Test_CreateContainer_Mount_File_LCOW(t *testing.T) { requireFeatures(t, featureLCOW) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) @@ -888,7 +889,7 @@ func Test_CreateContainer_Mount_File_LCOW(t *testing.T) { func Test_CreateContainer_Mount_ReadOnlyFile_LCOW(t *testing.T) { requireFeatures(t, featureLCOW) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) diff --git a/test/cri-containerd/main_test.go b/test/cri-containerd/main_test.go index 4af3204e1c..e3b091b731 100644 --- a/test/cri-containerd/main_test.go +++ b/test/cri-containerd/main_test.go @@ -14,8 +14,8 @@ import ( "time" "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/functional/manifest" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/containerd/containerd" eventtypes "github.com/containerd/containerd/api/events" eventsapi "github.com/containerd/containerd/api/services/events/v1" @@ -81,7 +81,7 @@ var ( // Flags var ( - flagFeatures = testutilities.NewStringSetFlag() + flagFeatures = testutil.NewStringSetFlag() flagCRIEndpoint = flag.String("cri-endpoint", "tcp://127.0.0.1:2376", "Address of CRI runtime and image service.") flagVirtstack = flag.String("virtstack", "", "Virtstack to use for hypervisor isolated containers") flagVMServiceBinary = flag.String("vmservice-binary", "", "Path to a binary implementing the vmservice ttrpc service") diff --git a/test/cri-containerd/pod_update_test.go b/test/cri-containerd/pod_update_test.go index 2106ae0851..9b623babff 100644 --- a/test/cri-containerd/pod_update_test.go +++ b/test/cri-containerd/pod_update_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -11,7 +12,7 @@ import ( "github.com/Microsoft/hcsshim/internal/processorinfo" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -221,7 +222,7 @@ func Test_Pod_UpdateResources_CPUShares(t *testing.T) { } func Test_Pod_UpdateResources_CPUGroup(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V21H1) + testutil.RequiresBuild(t, osversion.V21H1) ctx := context.Background() processorTopology, err := processorinfo.HostProcessorInfo(ctx) diff --git a/test/cri-containerd/runpodsandbox_test.go b/test/cri-containerd/runpodsandbox_test.go index 6af9a5a784..19c80f3229 100644 --- a/test/cri-containerd/runpodsandbox_test.go +++ b/test/cri-containerd/runpodsandbox_test.go @@ -24,7 +24,7 @@ import ( "github.com/Microsoft/hcsshim/internal/shimdiag" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/containerd/containerd/log" "golang.org/x/sys/windows" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" @@ -984,7 +984,7 @@ func Test_RunPodSandbox_Mount_SandboxDir_NoShare_WCOW(t *testing.T) { } func Test_RunPodSandbox_CPUGroup(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V21H1) + testutil.RequiresBuild(t, osversion.V21H1) ctx := context.Background() presentID := "FA22A12C-36B3-486D-A3E9-BC526C2B450B" @@ -1064,7 +1064,7 @@ func createExt4VHD(ctx context.Context, t *testing.T, path string) { log.L.Logger.SetOutput(io.Discard) defer log.L.Logger.SetOutput(origLogOut) } - uvm := testutilities.CreateLCOWUVM(ctx, t, t.Name()+"-createExt4VHD") + uvm := testutil.CreateLCOWUVM(ctx, t, nil, t.Name()+"-createExt4VHD") defer uvm.Close() if err := lcow.CreateScratch(ctx, uvm, path, 2, ""); err != nil { diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index 42a63796a7..a7dd96a56d 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -1,3 +1,4 @@ +//go:build functional || lcow // +build functional lcow package functional @@ -6,7 +7,6 @@ import ( "bytes" "context" "fmt" - "os" "os/exec" "path/filepath" "strings" @@ -20,13 +20,13 @@ import ( "github.com/Microsoft/hcsshim/internal/resources" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestLCOWUVMNoSCSINoVPMemInitrd starts an LCOW utility VM without a SCSI controller and // no VPMem device. Uses initrd. func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 0 opts.PreferredRootFSType = uvm.PreferredRootFSTypeInitRd @@ -38,7 +38,7 @@ func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { // TestLCOWUVMNoSCSISingleVPMemVHD starts an LCOW utility VM without a SCSI controller and // only a single VPMem device. Uses VPMEM VHD func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 1 opts.PreferredRootFSType = uvm.PreferredRootFSTypeVHD @@ -48,8 +48,9 @@ func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { } func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected string) { - testutilities.RequiresBuild(t, osversion.RS5) - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) + lcowUVM := testutil.CreateLCOWUVMFromOpts(ctx, t, client, opts) defer lcowUVM.Close() out, err := exec.Command(`hcsdiag`, `exec`, `-uvm`, lcowUVM.ID(), `dmesg`).Output() // TODO: Move the CreateProcess. if err != nil { @@ -63,7 +64,7 @@ func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected // TestLCOWTimeUVMStartVHD starts/terminates a utility VM booting from VPMem- // attached root filesystem a number of times. func TestLCOWTimeUVMStartVHD(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) testLCOWTimeUVMStart(t, false, uvm.PreferredRootFSTypeVHD) } @@ -72,7 +73,7 @@ func TestLCOWTimeUVMStartVHD(t *testing.T) { // VPMem- attached root filesystem a number of times starting from the Linux // Kernel directly and skipping EFI. func TestLCOWUVMStart_KernelDirect_VHD(t *testing.T) { - testutilities.RequiresBuild(t, 18286) + testutil.RequiresBuild(t, 18286) testLCOWTimeUVMStart(t, true, uvm.PreferredRootFSTypeVHD) } @@ -80,7 +81,7 @@ func TestLCOWUVMStart_KernelDirect_VHD(t *testing.T) { // TestLCOWTimeUVMStartInitRD starts/terminates a utility VM booting from initrd- // attached root file system a number of times. func TestLCOWTimeUVMStartInitRD(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) testLCOWTimeUVMStart(t, false, uvm.PreferredRootFSTypeInitRd) } @@ -89,14 +90,14 @@ func TestLCOWTimeUVMStartInitRD(t *testing.T) { // from initrd- attached root file system a number of times starting from the // Linux Kernel directly and skipping EFI. func TestLCOWUVMStart_KernelDirect_InitRd(t *testing.T) { - testutilities.RequiresBuild(t, 18286) + testutil.RequiresBuild(t, 18286) testLCOWTimeUVMStart(t, true, uvm.PreferredRootFSTypeInitRd) } func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.PreferredRootFSType) { for i := 0; i < 3; i++ { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.KernelDirect = kernelDirect opts.VPMemDeviceCount = 32 opts.PreferredRootFSType = rfsType @@ -107,36 +108,34 @@ func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.Preferred opts.RootFSFile = uvm.VhdFile } - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + lcowUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, opts) lcowUVM.Close() } } func TestLCOWSimplePodScenario(t *testing.T) { t.Skip("Doesn't work quite yet") - testutilities.RequiresBuild(t, osversion.RS5) - alpineLayers := testutilities.LayerFolders(t, "alpine") + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) - cacheDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(cacheDir) + alpineLayers := testutil.LayerFoldersPlatform(ctx, t, client, testutil.ImageLinuxAlpineLatest, testutil.PlatformLinux) + + cacheDir := t.TempDir() cacheFile := filepath.Join(cacheDir, "cache.vhdx") // This is what gets mounted into /tmp/scratch - uvmScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(uvmScratchDir) + uvmScratchDir := t.TempDir() uvmScratchFile := filepath.Join(uvmScratchDir, "uvmscratch.vhdx") // Scratch for the first container - c1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(c1ScratchDir) + c1ScratchDir := t.TempDir() c1ScratchFile := filepath.Join(c1ScratchDir, "sandbox.vhdx") // Scratch for the second container - c2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(c2ScratchDir) + c2ScratchDir := t.TempDir() c2ScratchFile := filepath.Join(c2ScratchDir, "sandbox.vhdx") - lcowUVM := testutilities.CreateLCOWUVM(context.Background(), t, "uvm") + lcowUVM := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLCOWUvmOptions(t, "uvm")) defer lcowUVM.Close() // Populate the cache and generate the scratch file for /tmp/scratch @@ -153,7 +152,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { if err := lcow.CreateScratch(context.Background(), lcowUVM, c1ScratchFile, lcow.DefaultScratchSizeGB, cacheFile); err != nil { t.Fatal(err) } - c1Spec := testutilities.GetDefaultLinuxSpec(t) + c1Spec := testutil.GetDefaultLinuxSpec(t) c1Folders := append(alpineLayers, c1ScratchDir) c1Spec.Windows.LayerFolders = c1Folders c1Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "one"} @@ -166,7 +165,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { if err := lcow.CreateScratch(context.Background(), lcowUVM, c2ScratchFile, lcow.DefaultScratchSizeGB, cacheFile); err != nil { t.Fatal(err) } - c2Spec := testutilities.GetDefaultLinuxSpec(t) + c2Spec := testutil.GetDefaultLinuxSpec(t) c2Folders := append(alpineLayers, c2ScratchDir) c2Spec.Windows.LayerFolders = c2Folders c2Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "two"} diff --git a/test/functional/main_test.go b/test/functional/main_test.go new file mode 100644 index 0000000000..1d5013ebed --- /dev/null +++ b/test/functional/main_test.go @@ -0,0 +1,127 @@ +package functional + +import ( + "context" + "flag" + "os" + "os/exec" + "strconv" + "testing" + "time" + + "github.com/Microsoft/hcsshim/internal/cow" + "github.com/Microsoft/hcsshim/internal/hcsoci" + "github.com/Microsoft/hcsshim/internal/resources" + "github.com/Microsoft/hcsshim/internal/uvm" + "github.com/Microsoft/hcsshim/test/testutil" + "github.com/containerd/containerd" + "github.com/sirupsen/logrus" +) + +const ( + bytesPerMB = 1024 * 1024 +) + +var ( + debug bool + pauseDurationOnCreateContainerFailure time.Duration + + // flags + flagContainerdAddress = flag.String("ctr-address", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") + flagContainerdNamespace = flag.String("ctr-namespace", "k8s.io", "Containerd namespace") + flagCtrExePath = flag.String("ctr-path", testutil.DefaultCtrPath(), "Path to ctr.exe") + flagLinuxBootFilesPath = flag.String("linux-bootfiles", + "C:\\ContainerPlat\\LinuxBootFiles", + "Path to LCOW UVM boot files (rootfs.vhd, initrd.img, kernel, etc.)") +) + +// todo: use separate containerd namespace for testing, pull images and create commit snapshots for +// images as needed, then remove all active and view snapshots at the end in cleanup + +func init() { + if _, ok := os.LookupEnv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG"); ok { + debug = true + } + flag.BoolVar(&debug, "debug", debug, "Set logging level to debug [%HCSSHIM_FUNCTIONAL_TESTS_DEBUG%]") + + // This allows for debugging a utility VM. + if s := os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES"); s != "" { + if t, err := strconv.Atoi(s); err == nil { + pauseDurationOnCreateContainerFailure = time.Duration(t) * time.Minute + } + } + flag.DurationVar(&pauseDurationOnCreateContainerFailure, + "container-creation-failure-pause", + pauseDurationOnCreateContainerFailure, + "The number of minutes to wait after a container creation failure to try again "+ + "[%HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES%]") + + lvl := logrus.WarnLevel + if debug { + lvl = logrus.DebugLevel + } + // logrus.SetOutput(ioutil.Discard) + logrus.SetLevel(lvl) + logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) + + // Try to stop any pre-existing compute processes + cmd := exec.Command("powershell", `get-computeprocess | stop-computeprocess -force`) + _ = cmd.Run() +} + +func TestMain(m *testing.M) { + flag.Parse() + os.Exit(m.Run()) +} + +func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptions) (cow.Container, *resources.Resources, error) { + if pauseDurationOnCreateContainerFailure != 0 { + options.DoNotReleaseResourcesOnFailure = true + } + s, r, err := hcsoci.CreateContainer(ctx, options) + if err != nil { + logrus.Warnf("Test is pausing for %s for debugging CreateContainer failure", pauseDurationOnCreateContainerFailure) + time.Sleep(pauseDurationOnCreateContainerFailure) + _ = resources.ReleaseResources(ctx, r, options.HostingSystem, true) + } + return s, r, err +} + +// default options using command line flags, if any + +func getCtrOptions() testutil.CtrClientOptions { + return testutil.CtrClientOptions{ + Ctrd: getContainerdOptions(), + Path: *flagCtrExePath, + } +} + +func getContainerdOptions() testutil.ContainerdClientOptions { + return testutil.ContainerdClientOptions{ + Address: *flagContainerdAddress, + Namespace: *flagContainerdNamespace, + } +} + +func getDefaultLCOWUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { + opts := uvm.NewDefaultOptionsLCOW(name, "") + opts.BootFilesPath = *flagLinuxBootFilesPath + + return opts +} + +func getDefaultWCOWUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { + opts := uvm.NewDefaultOptionsWCOW(name, "") + + return opts +} + +// convenience wrappers + +func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { + return getContainerdOptions().NewClient(ctx, t) +} + +func pullImage(ctx context.Context, t *testing.T, platform, image string) { + getCtrOptions().PullImage(ctx, t, platform, image) +} diff --git a/test/functional/manifest_test.go b/test/functional/manifest_test.go index d7be25b1d2..ee199ee500 100644 --- a/test/functional/manifest_test.go +++ b/test/functional/manifest_test.go @@ -1,3 +1,3 @@ package functional -import _ "github.com/Microsoft/hcsshim/test/functional/manifest" +import _ "github.com/Microsoft/hcsshim/test/testutil/manifest" diff --git a/test/functional/test.go b/test/functional/test.go deleted file mode 100644 index 28314d4928..0000000000 --- a/test/functional/test.go +++ /dev/null @@ -1,53 +0,0 @@ -package functional - -import ( - "context" - "os" - "os/exec" - "strconv" - "time" - - "github.com/Microsoft/hcsshim/internal/cow" - "github.com/Microsoft/hcsshim/internal/hcsoci" - "github.com/Microsoft/hcsshim/internal/resources" - "github.com/sirupsen/logrus" -) - -const ( - bytesPerMB = 1024 * 1024 -) - -var pauseDurationOnCreateContainerFailure time.Duration - -func init() { - if len(os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG")) > 0 { - logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - } - - // This allows for debugging a utility VM. - s := os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES") - if s != "" { - if t, err := strconv.Atoi(s); err == nil { - pauseDurationOnCreateContainerFailure = time.Duration(t) * time.Minute - } - } - - // Try to stop any pre-existing compute processes - cmd := exec.Command("powershell", `get-computeprocess | stop-computeprocess -force`) - _ = cmd.Run() - -} - -func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptions) (cow.Container, *resources.Resources, error) { - if pauseDurationOnCreateContainerFailure != 0 { - options.DoNotReleaseResourcesOnFailure = true - } - s, r, err := hcsoci.CreateContainer(ctx, options) - if err != nil { - logrus.Warnf("Test is pausing for %s for debugging CreateContainer failure", pauseDurationOnCreateContainerFailure) - time.Sleep(pauseDurationOnCreateContainerFailure) - _ = resources.ReleaseResources(ctx, r, options.HostingSystem, true) - } - return s, r, err -} diff --git a/test/functional/utilities/createuvm.go b/test/functional/utilities/createuvm.go deleted file mode 100644 index 8587fdef42..0000000000 --- a/test/functional/utilities/createuvm.go +++ /dev/null @@ -1,77 +0,0 @@ -package testutilities - -import ( - "context" - "os" - "testing" - - "github.com/Microsoft/hcsshim/internal/uvm" -) - -// CreateWCOWUVM creates a WCOW utility VM with all default options. Returns the -// UtilityVM object; folder used as its scratch -func CreateWCOWUVM(ctx context.Context, t *testing.T, id, image string) (*uvm.UtilityVM, []string, string) { - return CreateWCOWUVMFromOptsWithImage(ctx, t, uvm.NewDefaultOptionsWCOW(id, ""), image) - -} - -// CreateWCOWUVMFromOpts creates a WCOW utility VM with the passed opts. -func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, opts *uvm.OptionsWCOW) *uvm.UtilityVM { - if opts == nil || len(opts.LayerFolders) < 2 { - t.Fatalf("opts must bet set with LayerFolders") - } - - uvm, err := uvm.CreateWCOW(ctx, opts) - if err != nil { - t.Fatal(err) - } - if err := uvm.Start(ctx); err != nil { - uvm.Close() - t.Fatal(err) - } - return uvm -} - -// CreateWCOWUVMFromOptsWithImage creates a WCOW utility VM with the passed opts -// builds the LayerFolders based on `image`. Returns the UtilityVM object; -// folder used as its scratch -func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { - if opts == nil { - t.Fatal("opts must be set") - } - - uvmLayers := LayerFolders(t, image) - scratchDir := CreateTempDir(t) - defer func() { - if t.Failed() { - os.RemoveAll(scratchDir) - } - }() - - opts.LayerFolders = append(opts.LayerFolders, uvmLayers...) - opts.LayerFolders = append(opts.LayerFolders, scratchDir) - - return CreateWCOWUVMFromOpts(ctx, t, opts), uvmLayers, scratchDir -} - -// CreateLCOWUVM with all default options. -func CreateLCOWUVM(ctx context.Context, t *testing.T, id string) *uvm.UtilityVM { - return CreateLCOWUVMFromOpts(ctx, t, uvm.NewDefaultOptionsLCOW(id, "")) -} - -// CreateLCOWUVMFromOpts creates an LCOW utility VM with the specified options. -func CreateLCOWUVMFromOpts(ctx context.Context, t *testing.T, opts *uvm.OptionsLCOW) *uvm.UtilityVM { - if opts == nil { - t.Fatal("opts must be set") - } - - uvm, err := uvm.CreateLCOW(ctx, opts) - if err != nil { - t.Fatal(err) - } - if err := uvm.Start(ctx); err != nil { - uvm.Close() - t.Fatal(err) - } - return uvm -} diff --git a/test/functional/utilities/layerfolders.go b/test/functional/utilities/layerfolders.go deleted file mode 100644 index 6fc23dd049..0000000000 --- a/test/functional/utilities/layerfolders.go +++ /dev/null @@ -1,54 +0,0 @@ -package testutilities - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" -) - -var imageLayers map[string][]string - -func init() { - imageLayers = make(map[string][]string) -} - -func LayerFolders(t *testing.T, imageName string) []string { - if _, ok := imageLayers[imageName]; !ok { - imageLayers[imageName] = getLayers(t, imageName) - } - return imageLayers[imageName] -} - -func getLayers(t *testing.T, imageName string) []string { - cmd := exec.Command("docker", "inspect", imageName, "-f", `"{{.GraphDriver.Data.dir}}"`) - var out bytes.Buffer - cmd.Stdout = &out - if err := cmd.Run(); err != nil { - t.Skipf("Failed to find layers for %q. Check docker images", imageName) - } - imagePath := strings.Replace(strings.TrimSpace(out.String()), `"`, ``, -1) - layers := getLayerChain(t, imagePath) - return append([]string{imagePath}, layers...) -} - -func getLayerChain(t *testing.T, layerFolder string) []string { - jPath := filepath.Join(layerFolder, "layerchain.json") - content, err := ioutil.ReadFile(jPath) - if os.IsNotExist(err) { - t.Fatalf("layerchain not found") - } else if err != nil { - t.Fatalf("failed to read layerchain") - } - - var layerChain []string - err = json.Unmarshal(content, &layerChain) - if err != nil { - t.Fatalf("failed to unmarshal layerchain") - } - return layerChain -} diff --git a/test/functional/utilities/tempdir.go b/test/functional/utilities/tempdir.go deleted file mode 100644 index ebbe6ae533..0000000000 --- a/test/functional/utilities/tempdir.go +++ /dev/null @@ -1,15 +0,0 @@ -package testutilities - -import ( - "io/ioutil" - "testing" -) - -// CreateTempDir creates a temporary directory -func CreateTempDir(t *testing.T) string { - tempDir, err := ioutil.TempDir("", "test") - if err != nil { - t.Fatalf("failed to create temporary directory: %s", err) - } - return tempDir -} diff --git a/test/functional/uvm_cpulimits_test.go b/test/functional/uvm_cpulimits_test.go new file mode 100644 index 0000000000..7db2a285fb --- /dev/null +++ b/test/functional/uvm_cpulimits_test.go @@ -0,0 +1,49 @@ +package functional + +import ( + "context" + "testing" + "time" + + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" + "github.com/Microsoft/hcsshim/osversion" + "github.com/Microsoft/hcsshim/test/testutil" +) + +func TestUVMCPULimitsUpdateLCOW(t *testing.T) { + testutil.RequiresBuild(t, osversion.RS5) + + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + defer cancel() + + opts := getDefaultLCOWUvmOptions(t, t.Name()) + opts.MemorySizeInMB = 1024 * 2 + u := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) + + limits := &hcsschema.ProcessorLimits{ + Weight: 10000, + } + if err := u.UpdateCPULimits(ctx, limits); err != nil { + t.Fatalf("failed to update the cpu limits of the UVM with: %v", err) + } +} + +func TestUVMCPULimitsUpdateWCOW(t *testing.T) { + testutil.RequiresBuild(t, osversion.RS5) + + client, ctx := newCtrdClient(context.Background(), t) + opts := getDefaultWCOWUvmOptions(t, t.Name()) + opts.MemorySizeInMB = 1024 * 2 + + // context with time out times out and prevents this from cleaning up and removing snapshots + u, _, _ := testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver2004) + + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + defer cancel() + limits := &hcsschema.ProcessorLimits{ + Weight: 10000, + } + if err := u.UpdateCPULimits(ctx, limits); err != nil { + t.Fatalf("failed to update the cpu limits of the UVM with: %v", err) + } +} diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index 6adc97c646..ca463cf8fd 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmmem // +build functional uvmmem package functional @@ -5,24 +6,24 @@ package functional import ( "context" "io/ioutil" - "os" "testing" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/sirupsen/logrus" ) func runMemStartLCOWTest(t *testing.T, opts *uvm.OptionsLCOW) { - u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + client, ctx := newCtrdClient(context.Background(), t) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, client, opts) u.Close() } func runMemStartWCOWTest(t *testing.T, opts *uvm.OptionsWCOW) { - u, _, scratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(context.Background(), t, opts, "microsoft/nanoserver") - defer os.RemoveAll(scratchDir) - u.Close() + client, ctx := newCtrdClient(context.Background(), t) + + testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver1809) } func runMemTests(t *testing.T, os string) { @@ -39,13 +40,13 @@ func runMemTests(t *testing.T, os string) { for _, bt := range testCases { if os == "windows" { - wopts := uvm.NewDefaultOptionsWCOW(t.Name(), "") + wopts := getDefaultWCOWUvmOptions(t, t.Name()) wopts.MemorySizeInMB = 512 wopts.AllowOvercommit = bt.allowOvercommit wopts.EnableDeferredCommit = bt.enableDeferredCommit runMemStartWCOWTest(t, wopts) } else { - lopts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + lopts := getDefaultLCOWUvmOptions(t, t.Name()) lopts.MemorySizeInMB = 512 lopts.AllowOvercommit = bt.allowOvercommit lopts.EnableDeferredCommit = bt.enableDeferredCommit @@ -55,17 +56,17 @@ func runMemTests(t *testing.T, os string) { } func TestMemBackingTypeWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) runMemTests(t, "windows") } func TestMemBackingTypeLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) runMemTests(t, "linux") } func runBenchMemStartTest(b *testing.B, opts *uvm.OptionsLCOW) { - // Cant use testutilities here because its `testing.B` not `testing.T` + // Cant use testutil here because its `testing.B` not `testing.T` u, err := uvm.CreateLCOW(context.Background(), opts) if err != nil { b.Fatal(err) @@ -87,21 +88,21 @@ func runBenchMemStartLcowTest(b *testing.B, allowOvercommit bool, enableDeferred } func BenchmarkMemBackingTypeVirtualLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, true, false) } func BenchmarkMemBackingTypeVirtualDeferredLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, true, true) } func BenchmarkMemBackingTypePhyscialLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, false, false) diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index bc1ecd5ea9..a4922819e0 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -6,20 +6,19 @@ import ( "testing" "time" - "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestUVMMemoryUpdateLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) - ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, opts) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer u.Close() newMemorySize := uint64(opts.MemorySizeInMB/2) * bytesPerMB @@ -37,15 +36,16 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { } func TestUVMMemoryUpdateWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) - ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) + client, ctx := newCtrdClient(context.Background(), t) + ctx, cancel := context.WithTimeout(ctx, 120*time.Second) defer cancel() - opts := uvm.NewDefaultOptionsWCOW(t.Name(), "") + opts := getDefaultWCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, opts, "mcr.microsoft.com/windows/nanoserver:1909") + u, _, uvmScratchDir := testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver2004) defer os.RemoveAll(uvmScratchDir) defer u.Close() diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index 55e63375c0..97a122b672 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmp9 // +build functional uvmp9 // This file isn't called uvm_plan9_test.go as go test skips when a number is in it... go figure (pun intended) @@ -7,28 +8,27 @@ package functional import ( "context" "fmt" - "os" "path/filepath" "testing" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestPlan9 tests adding/removing Plan9 shares to/from a v2 Linux utility VM // TODO: This is very basic. Need multiple shares and so-on. Can be iterated on later. func TestPlan9(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) - vm := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + vm := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer vm.Close() - dir := testutilities.CreateTempDir(t) - defer os.RemoveAll(dir) var iterations uint32 = 64 var shares []*uvm.Plan9Share for i := 0; i < int(iterations); i++ { + // create a new temp dir per mount, to avoid "failed to remove plan9 share: device or resource busy" errors + dir := t.TempDir() share, err := vm.AddPlan9(context.Background(), dir, fmt.Sprintf("/tmp/%s", filepath.Base(dir)), false, false, nil) if err != nil { t.Fatalf("AddPlan9 failed: %s", err) diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index 34baa35607..4137059c21 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -1,21 +1,20 @@ +//go:build functional || uvmproperties // +build functional uvmproperties package functional import ( "context" - "os" "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestPropertiesGuestConnection_LCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) - uvm := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) - defer uvm.Close() + uvm := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) p, gc := uvm.Capabilities() if gc.NamespaceAddRequestSupported || @@ -26,10 +25,9 @@ func TestPropertiesGuestConnection_LCOW(t *testing.T) { } func TestPropertiesGuestConnection_WCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "microsoft/nanoserver") - defer os.RemoveAll(uvmScratchDir) - defer uvm.Close() + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) + uvm, _, _ := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1809) p, gc := uvm.Capabilities() if !gc.NamespaceAddRequestSupported || diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index 3ab78198e7..df8bd69f87 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmscratch // +build functional uvmscratch package functional @@ -11,15 +12,14 @@ import ( "github.com/Microsoft/hcsshim/internal/lcow" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestScratchCreateLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - tempDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(tempDir) + testutil.RequiresBuild(t, osversion.RS5) + tempDir := t.TempDir() - firstUVM := testutilities.CreateLCOWUVM(context.Background(), t, "TestCreateLCOWScratch") + firstUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch")) defer firstUVM.Close() cacheFile := filepath.Join(tempDir, "cache.vhdx") @@ -36,7 +36,7 @@ func TestScratchCreateLCOW(t *testing.T) { t.Fatalf("cacheFile wasn't created!") } - targetUVM := testutilities.CreateLCOWUVM(context.Background(), t, "TestCreateLCOWScratch_target") + targetUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch_target")) defer targetUVM.Close() // A non-cached create @@ -61,7 +61,7 @@ func TestScratchCreateLCOW(t *testing.T) { //// VHDX and format it ext4. //func TestCreateLCOWScratch(t *testing.T) { // t.Skip("for now") -// cacheDir := createTempDir(t) +// cacheDir := t.TempDir() // cacheFile := filepath.Join(cacheDir, "cache.vhdx") // uvm, err := CreateContainer(&CreateOptions{Spec: getDefaultLinuxSpec(t)}) // if err != nil { diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index 60a27dd38a..fd252cc9ad 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmscsi // +build functional uvmscsi package functional @@ -18,15 +19,15 @@ import ( "github.com/Microsoft/hcsshim/internal/lcow" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/sirupsen/logrus" ) // TestSCSIAddRemovev2LCOW validates adding and removing SCSI disks // from a utility VM in both attach-only and with a container path. func TestSCSIAddRemoveLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + testutil.RequiresBuild(t, osversion.RS5) + u := testutil.CreateLCOWUVM(context.Background(), t, nil, t.Name()) defer u.Close() testSCSIAddRemoveMultiple(t, u, `/run/gcs/c/0/scsi`, "linux", []string{}) @@ -36,9 +37,10 @@ func TestSCSIAddRemoveLCOW(t *testing.T) { // TestSCSIAddRemoveWCOW validates adding and removing SCSI disks // from a utility VM in both attach-only and with a container path. func TestSCSIAddRemoveWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) // TODO make the image configurable to the build we're testing on - u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "mcr.microsoft.com/windows/nanoserver:1903") + client, ctx := newCtrdClient(context.Background(), t) + u, layers, uvmScratchDir := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1903) defer os.RemoveAll(uvmScratchDir) defer u.Close() @@ -85,9 +87,9 @@ func testSCSIAddRemoveSingle(t *testing.T, u *uvm.UtilityVM, pathPrefix string, for i := 0; i < numDisks; i++ { tempDir := "" if operatingSystem == "windows" { - tempDir = testutilities.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) + tempDir = testutil.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) } else { - tempDir = testutilities.CreateLCOWBlankRWLayer(context.Background(), t) + tempDir = testutil.CreateLCOWBlankRWLayer(context.Background(), t) } defer os.RemoveAll(tempDir) disks[i] = filepath.Join(tempDir, `sandbox.vhdx`) @@ -136,9 +138,9 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string for i := 0; i < numDisks; i++ { tempDir := "" if operatingSystem == "windows" { - tempDir = testutilities.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) + tempDir = testutil.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) } else { - tempDir = testutilities.CreateLCOWBlankRWLayer(context.Background(), t) + tempDir = testutil.CreateLCOWBlankRWLayer(context.Background(), t) } defer os.RemoveAll(tempDir) disks[i] = filepath.Join(tempDir, `sandbox.vhdx`) @@ -214,8 +216,8 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string } func TestParallelScsiOps(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + testutil.RequiresBuild(t, osversion.RS5) + u := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() // Create a sandbox to use diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index 2afb95785e..303137bbf9 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package functional @@ -5,16 +6,17 @@ package functional import ( "context" "os/exec" + "path/filepath" "strings" "testing" "time" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) -const lcowGPUBootFilesPath = "C:\\ContainerPlat\\LinuxBootFiles\\nvidiagpu" +var lcowGPUBootFilesPath = filepath.Join(*flagLinuxBootFilesPath, "\\nvidiagpu") // findTestDevices returns the first pcip device on the host func findTestVirtualDevice() (string, error) { @@ -29,7 +31,7 @@ func findTestVirtualDevice() (string, error) { } func TestVirtualDevice(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V20H1) + testutil.RequiresBuild(t, osversion.V20H1) ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() @@ -42,7 +44,7 @@ func TestVirtualDevice(t *testing.T) { } // update opts needed to assign a hyper-v pci device - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.VPCIEnabled = true opts.AllowOvercommit = false opts.KernelDirect = false @@ -53,7 +55,7 @@ func TestVirtualDevice(t *testing.T) { opts.BootFilesPath = lcowGPUBootFilesPath // create test uvm and ensure we can assign and remove the device - vm := testutilities.CreateLCOWUVMFromOpts(ctx, t, opts) + vm := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer vm.Close() vpci, err := vm.AssignDevice(ctx, testDeviceInstanceID, 0) if err != nil { diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index 3d55881e92..19eeb5bd89 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -1,36 +1,35 @@ +//go:build functional || uvmvpmem // +build functional uvmvpmem package functional import ( "context" - "os" "path/filepath" "testing" "github.com/Microsoft/hcsshim/internal/copyfile" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) -// TestVPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM -func TestVPMEM(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - alpineLayers := testutilities.LayerFolders(t, "alpine") +// Test_VPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM +func Test_VPMEM(t *testing.T) { + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) + alpineLayers := testutil.LayerFoldersPlatform(ctx, t, client, testutil.ImageLinuxAlpineLatest, testutil.PlatformLinux) - ctx := context.Background() - u := testutilities.CreateLCOWUVM(ctx, t, t.Name()) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() var iterations uint32 = uvm.MaxVPMEMCount // Use layer.vhd from the alpine image as something to add - tempDir := testutilities.CreateTempDir(t) + tempDir := t.TempDir() if err := copyfile.CopyFile(ctx, filepath.Join(alpineLayers[0], "layer.vhd"), filepath.Join(tempDir, "layer.vhd"), true); err != nil { t.Fatal(err) } - defer os.RemoveAll(tempDir) for i := 0; i < int(iterations); i++ { uvmPath, err := u.AddVPMem(ctx, filepath.Join(tempDir, "layer.vhd")) diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index 020f61ea51..20483c6bad 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmvsmb // +build functional uvmvsmb package functional @@ -8,18 +9,19 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestVSMB tests adding/removing VSMB layers from a v2 Windows utility VM func TestVSMB(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "microsoft/nanoserver") + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) + + uvm, _, uvmScratchDir := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1809) defer os.RemoveAll(uvmScratchDir) defer uvm.Close() - dir := testutilities.CreateTempDir(t) - defer os.RemoveAll(dir) + dir := t.TempDir() var iterations uint32 = 64 options := uvm.DefaultVSMBOptions(true) options.TakeBackupPrivilege = true diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index c620ea6cc0..9fb5805276 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -1,3 +1,4 @@ +//go:build functional || wcow // +build functional wcow package functional @@ -9,10 +10,13 @@ import ( "path/filepath" "strings" "testing" + "time" "github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim/internal/cow" + "github.com/Microsoft/hcsshim/internal/hcs/resourcepaths" "github.com/Microsoft/hcsshim/internal/hcs/schema1" + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" "github.com/Microsoft/hcsshim/internal/hcsoci" layerspkg "github.com/Microsoft/hcsshim/internal/layers" "github.com/Microsoft/hcsshim/internal/resources" @@ -22,7 +26,7 @@ import ( "github.com/Microsoft/hcsshim/internal/wclayer" "github.com/Microsoft/hcsshim/internal/wcow" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" specs "github.com/opencontainers/runtime-spec/specs-go" ) @@ -340,9 +344,9 @@ const imageName = "busyboxw" // Creates two temp folders used for the mounts/mapped directories func createTestMounts(t *testing.T) (string, string) { - // Create two temp folders for mapped directories. - hostRWSharedDirectory := testutilities.CreateTempDir(t) - hostROSharedDirectory := testutilities.CreateTempDir(t) + // Create two temp foldert.TempDir() + hostRWSharedDirectory := t.TempDir() + hostROSharedDirectory := t.TempDir() fRW, _ := os.OpenFile(filepath.Join(hostRWSharedDirectory, "readwrite"), os.O_RDWR|os.O_CREATE, 0755) fRO, _ := os.OpenFile(filepath.Join(hostROSharedDirectory, "readonly"), os.O_RDWR|os.O_CREATE, 0755) fRW.Close() @@ -362,31 +366,28 @@ func generateShimLayersStruct(t *testing.T, imageLayers []string) []hcsshim.Laye // Argon through HCSShim interface (v1) func TestWCOWArgonShim(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) argonShimMounted := false - - argonShimScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonShimScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), argonShimScratchDir, imageLayers); err != nil { + argonShimScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, argonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) layers := generateShimLayersStruct(t, imageLayers) // For cleanup on failure defer func() { if argonShimMounted { - layerspkg.UnmountContainerLayers(context.Background(), append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll) + layerspkg.UnmountContainerLayers(ctx, append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll) } }() id := "argon" // This is a cheat but stops us re-writing exactly the same code just for test - argonShimLocalMountPath, err := layerspkg.MountContainerLayers(context.Background(), id, append(imageLayers, argonShimScratchDir), "", "", nil) + argonShimLocalMountPath, err := layerspkg.MountContainerLayers(ctx, id, append(imageLayers, argonShimScratchDir), "", "", nil) if err != nil { t.Fatal(err) } @@ -419,7 +420,7 @@ func TestWCOWArgonShim(t *testing.T) { } runShimCommands(t, argonShim) stopContainer(t, argonShim) - if err := layerspkg.UnmountContainerLayers(context.Background(), append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll); err != nil { + if err := layerspkg.UnmountContainerLayers(ctx, append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll); err != nil { t.Fatal(err) } argonShimMounted = false @@ -428,19 +429,16 @@ func TestWCOWArgonShim(t *testing.T) { // Xenon through HCSShim interface (v1) func TestWCOWXenonShim(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) - - xenonShimScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonShimScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), xenonShimScratchDir, imageLayers); err != nil { + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) + xenonShimScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, xenonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) - uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) if err != nil { t.Fatalf("LocateUVMFolder failed %s", err) } @@ -477,52 +475,66 @@ func TestWCOWXenonShim(t *testing.T) { stopContainer(t, xenonShim) } -func generateWCOWOciTestSpec(t *testing.T, imageLayers []string, scratchPath, hostRWSharedDirectory, hostROSharedDirectory string) *specs.Spec { +func generateWCOWOCITestSpecGeneric(t *testing.T, imageLayers []string, scratchPath string) *specs.Spec { return &specs.Spec{ Windows: &specs.Windows{ LayerFolders: append(imageLayers, scratchPath), }, - Mounts: []specs.Mount{ - { - Source: hostROSharedDirectory, - Destination: `c:\mappedro`, - Options: []string{"ro"}, - }, - { - Source: hostRWSharedDirectory, - Destination: `c:\mappedrw`, + Process: &specs.Process{ + Args: []string{ + "cmd", + "/c", + "ping", + "-t", + "127.0.0.1", + ">", + "nul", }, }, } } +func generateWCOWOCITestSpec(t *testing.T, imageLayers []string, scratchPath, hostRWSharedDirectory, hostROSharedDirectory string) *specs.Spec { + newSpec := generateWCOWOCITestSpecGeneric(t, imageLayers, scratchPath) + newSpec.Mounts = []specs.Mount{ + { + Source: hostROSharedDirectory, + Destination: `c:\mappedro`, + Options: []string{"ro"}, + }, + { + Source: hostRWSharedDirectory, + Destination: `c:\mappedrw`, + }, + } + return newSpec +} + // Argon through HCSOCI interface (v1) func TestWCOWArgonOciV1(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) argonOci1Mounted := false - argonOci1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonOci1ScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), argonOci1ScratchDir, imageLayers); err != nil { + argonOci1ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, argonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // For cleanup on failure var argonOci1Resources *resources.Resources var argonOci1 cow.Container defer func() { if argonOci1Mounted { - resources.ReleaseResources(context.Background(), argonOci1Resources, nil, true) + resources.ReleaseResources(ctx, argonOci1Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, argonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, argonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) argonOci1, argonOci1Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "argonOci1", SchemaVersion: schemaversion.SchemaV10(), @@ -532,13 +544,13 @@ func TestWCOWArgonOciV1(t *testing.T) { t.Fatal(err) } argonOci1Mounted = true - err = argonOci1.Start(context.Background()) + err = argonOci1.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, argonOci1) stopContainer(t, argonOci1) - if err := resources.ReleaseResources(context.Background(), argonOci1Resources, nil, true); err != nil { + if err := resources.ReleaseResources(ctx, argonOci1Resources, nil, true); err != nil { t.Fatal(err) } argonOci1Mounted = false @@ -546,18 +558,15 @@ func TestWCOWArgonOciV1(t *testing.T) { // Xenon through HCSOCI interface (v1) func TestWCOWXenonOciV1(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) xenonOci1Mounted := false - - xenonOci1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonOci1ScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), xenonOci1ScratchDir, imageLayers); err != nil { + xenonOci1ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, xenonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // TODO: This isn't currently used. // uvmImagePath, err := uvmfolder.LocateUVMFolder(imageLayers) @@ -570,15 +579,15 @@ func TestWCOWXenonOciV1(t *testing.T) { var xenonOci1 cow.Container defer func() { if xenonOci1Mounted { - resources.ReleaseResources(context.Background(), xenonOci1Resources, nil, true) + resources.ReleaseResources(ctx, xenonOci1Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, xenonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, xenonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) spec.Windows.HyperV = &specs.WindowsHyperV{} xenonOci1, xenonOci1Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "xenonOci1", SchemaVersion: schemaversion.SchemaV10(), @@ -588,13 +597,13 @@ func TestWCOWXenonOciV1(t *testing.T) { t.Fatal(err) } xenonOci1Mounted = true - err = xenonOci1.Start(context.Background()) + err = xenonOci1.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, xenonOci1) stopContainer(t, xenonOci1) - if err := resources.ReleaseResources(context.Background(), xenonOci1Resources, nil, true); err != nil { + if err := resources.ReleaseResources(ctx, xenonOci1Resources, nil, true); err != nil { t.Fatal(err) } xenonOci1Mounted = false @@ -602,33 +611,31 @@ func TestWCOWXenonOciV1(t *testing.T) { // Argon through HCSOCI interface (v2) func TestWCOWArgonOciV2(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - imageLayers := testutilities.LayerFolders(t, imageName) - argonOci2Mounted := false + testutil.RequiresBuild(t, osversion.RS5) - argonOci2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonOci2ScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), argonOci2ScratchDir, imageLayers); err != nil { + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) + argonOci2Mounted := false + argonOci2ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, argonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // For cleanup on failure var argonOci2Resources *resources.Resources var argonOci2 cow.Container defer func() { if argonOci2Mounted { - resources.ReleaseResources(context.Background(), argonOci2Resources, nil, true) + resources.ReleaseResources(ctx, argonOci2Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, argonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, argonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) argonOci2, argonOci2Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "argonOci2", SchemaVersion: schemaversion.SchemaV21(), @@ -638,7 +645,7 @@ func TestWCOWArgonOciV2(t *testing.T) { t.Fatal(err) } argonOci2Mounted = true - err = argonOci2.Start(context.Background()) + err = argonOci2.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } @@ -653,22 +660,17 @@ func TestWCOWArgonOciV2(t *testing.T) { // Xenon through HCSOCI interface (v2) func TestWCOWXenonOciV2(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - imageLayers := testutilities.LayerFolders(t, imageName) - xenonOci2Mounted := false - xenonOci2UVMCreated := false - - xenonOci2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonOci2ScratchDir) - if err := wclayer.CreateScratchLayer(context.Background(), xenonOci2ScratchDir, imageLayers); err != nil { + testutil.RequiresBuild(t, osversion.RS5) + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, testutil.ImageWindowsNanoserver2004) + xenonOci2ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, xenonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) - uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) if err != nil { t.Fatalf("LocateUVMFolder failed %s", err) } @@ -676,38 +678,29 @@ func TestWCOWXenonOciV2(t *testing.T) { var xenonOci2Resources *resources.Resources var xenonOci2 cow.Container var xenonOci2UVM *uvm.UtilityVM - defer func() { - if xenonOci2Mounted { - resources.ReleaseResources(context.Background(), xenonOci2Resources, xenonOci2UVM, true) - } - if xenonOci2UVMCreated { - xenonOci2UVM.Close() - } - }() // Create the utility VM. xenonOci2UVMId := "xenonOci2UVM" - xenonOci2UVMScratchDir := testutilities.CreateTempDir(t) - if err := wcow.CreateUVMScratch(context.Background(), uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { + xenonOci2UVMScratchDir := t.TempDir() + if err := wcow.CreateUVMScratch(ctx, uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { t.Fatalf("failed to create scratch: %s", err) } xenonOciOpts := uvm.NewDefaultOptionsWCOW(xenonOci2UVMId, "") xenonOciOpts.LayerFolders = append(imageLayers, xenonOci2UVMScratchDir) - xenonOci2UVM, err = uvm.CreateWCOW(context.Background(), xenonOciOpts) + xenonOci2UVM, err = uvm.CreateWCOW(ctx, xenonOciOpts) if err != nil { t.Fatalf("Failed create UVM: %s", err) } - xenonOci2UVMCreated = true - if err := xenonOci2UVM.Start(context.Background()); err != nil { + if err := xenonOci2UVM.Start(ctx); err != nil { xenonOci2UVM.Close() t.Fatalf("Failed start UVM: %s", err) } - spec := generateWCOWOciTestSpec(t, imageLayers, xenonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, xenonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) xenonOci2, xenonOci2Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "xenonOci2", HostingSystem: xenonOci2UVM, @@ -717,19 +710,85 @@ func TestWCOWXenonOciV2(t *testing.T) { if err != nil { t.Fatal(err) } - xenonOci2Mounted = true - err = xenonOci2.Start(context.Background()) + defer resources.ReleaseResources(ctx, xenonOci2Resources, xenonOci2UVM, true) + err = xenonOci2.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, xenonOci2) stopContainer(t, xenonOci2) - if err := resources.ReleaseResources(context.Background(), xenonOci2Resources, xenonOci2UVM, true); err != nil { +} + +// Xenon through HCSOCI interface (v2) memory update +func TestWCOWXenonOciV2MemoryUpdate(t *testing.T) { + testutil.RequiresBuild(t, osversion.RS5) + + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutil.LayerFolders(ctx, t, client, testutil.ImageWindowsNanoserver2004) + + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + defer cancel() + + xenonOci2ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, xenonOci2ScratchDir, imageLayers); err != nil { + t.Fatalf("failed to create xenon scratch layer: %s", err) + } + + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) + if err != nil { + t.Fatalf("LocateUVMFolder failed %s", err) + } + + var xenonOci2Resources *resources.Resources + var xenonOci2 cow.Container + var xenonOci2UVM *uvm.UtilityVM + + // Create the utility VM. + xenonOci2UVMId := "xenonOci2UVM" + xenonOci2UVMScratchDir := t.TempDir() + if err := wcow.CreateUVMScratch(ctx, uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { + t.Fatalf("failed to create scratch: %s", err) + } + + xenonOciOpts := uvm.NewDefaultOptionsWCOW(xenonOci2UVMId, "") + xenonOciOpts.MemorySizeInMB = 1024 * 3 + xenonOciOpts.LayerFolders = append(imageLayers, xenonOci2UVMScratchDir) + xenonOci2UVM, err = uvm.CreateWCOW(ctx, xenonOciOpts) + if err != nil { + t.Fatalf("Failed create UVM: %s", err) + } + defer xenonOci2UVM.Close() + if err := xenonOci2UVM.Start(ctx); err != nil { + xenonOci2UVM.Close() + t.Fatalf("Failed start UVM: %s", err) + + } + + spec := generateWCOWOCITestSpecGeneric(t, imageLayers, xenonOci2ScratchDir) + spec.Annotations = make(map[string]string) + spec.Annotations["io.microsoft.virtualmachine.computetopology.memory.sizeinmb"] = "1024" + createOpts := &hcsoci.CreateOptions{ + ID: "xenonOci2", + HostingSystem: xenonOci2UVM, + SchemaVersion: schemaversion.SchemaV21(), + Spec: spec, + } + xenonOci2, xenonOci2Resources, err = hcsoci.CreateContainer(ctx, createOpts) + if err != nil { t.Fatal(err) } - xenonOci2Mounted = false + defer resources.ReleaseResources(ctx, xenonOci2Resources, xenonOci2UVM, true) - // Terminate the UVM - xenonOci2UVM.Close() - xenonOci2UVMCreated = false + if err := xenonOci2.Start(ctx); err != nil { + t.Fatalf("Failed start: %s", err) + } + + memoryLimit := hcsoci.NormalizeMemorySize(ctx, xenonOci2.ID(), uint64(1024*2)) + req := &hcsschema.ModifySettingRequest{ + ResourcePath: resourcepaths.SiloMemoryResourcePath, + Settings: memoryLimit, + } + if err := xenonOci2.Modify(ctx, req); err != nil { + t.Fatalf("Failed to update container memory size: %v", err) + } } diff --git a/test/go.mod b/test/go.mod index 6c668abfbf..5976197a95 100644 --- a/test/go.mod +++ b/test/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/Microsoft/go-winio v0.4.17 - github.com/Microsoft/hcsshim v0.8.23 + github.com/Microsoft/hcsshim v0.9.1 github.com/containerd/containerd v1.5.8 github.com/containerd/go-runc v1.0.0 github.com/containerd/ttrpc v1.1.0 diff --git a/test/go.sum b/test/go.sum index f5805153e2..c4630d61fe 100644 --- a/test/go.sum +++ b/test/go.sum @@ -696,9 +696,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -775,7 +774,6 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= @@ -786,9 +784,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/test/internal/schemaversion_test.go b/test/internal/schemaversion_test.go deleted file mode 100644 index cb7ecf241a..0000000000 --- a/test/internal/schemaversion_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package internal - -import ( - "io/ioutil" - "testing" - - hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" - "github.com/Microsoft/hcsshim/internal/schemaversion" - "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/functional/manifest" - "github.com/sirupsen/logrus" -) - -func init() { - logrus.SetOutput(ioutil.Discard) -} - -func TestDetermineSchemaVersion(t *testing.T) { - osv := osversion.Get() - - if osv.Build >= osversion.RS5 { - if sv := schemaversion.DetermineSchemaVersion(nil); !schemaversion.IsV21(sv) { - t.Fatalf("expected v2") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV21()); !schemaversion.IsV21(sv) { - t.Fatalf("expected requested v2") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV10()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(&hcsschema.Version{}); !schemaversion.IsV21(sv) { - t.Fatalf("expected requested v2") - } - - if err := schemaversion.IsSupported(schemaversion.SchemaV21()); err != nil { - t.Fatalf("v2 expected to be supported") - } - if err := schemaversion.IsSupported(schemaversion.SchemaV10()); err != nil { - t.Fatalf("v1 expected to be supported") - } - - } else { - if sv := schemaversion.DetermineSchemaVersion(nil); !schemaversion.IsV10(sv) { - t.Fatalf("expected v1") - } - // Pre RS5 will downgrade to v1 even if request v2 - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV21()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV10()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(&hcsschema.Version{}); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - - if err := schemaversion.IsSupported(schemaversion.SchemaV21()); err == nil { - t.Fatalf("didn't expect v2 to be supported") - } - if err := schemaversion.IsSupported(schemaversion.SchemaV10()); err != nil { - t.Fatalf("v1 expected to be supported") - } - } -} diff --git a/test/runhcs/e2e_matrix_test.go b/test/runhcs/e2e_matrix_test.go index 28c81a7746..7d9e408b57 100644 --- a/test/runhcs/e2e_matrix_test.go +++ b/test/runhcs/e2e_matrix_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package runhcs @@ -18,7 +19,8 @@ import ( "github.com/Microsoft/go-winio/vhd" "github.com/Microsoft/hcsshim/osversion" runhcs "github.com/Microsoft/hcsshim/pkg/go-runhcs" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" + "github.com/containerd/containerd" runc "github.com/containerd/go-runc" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" @@ -162,22 +164,39 @@ func readPidFile(path string) (int, error) { return p, nil } +func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { + cdo := testutil.ContainerdClientOptions{ + Address: "tcp://127.0.0.1:2376", + Namespace: "k8s.io", + } + + return cdo.NewClient(ctx, t) +} + +func pullImage(ctx context.Context, t *testing.T, snapshotter, image string) { + co := testutil.CtrClientOptions{ + Ctrd: testutil.ContainerdClientOptions{ + Address: "tcp://127.0.0.1:2376", + Namespace: "k8s.io", + }, + Path: filepath.Join(filepath.Dir(os.Args[0]), "ctr.exe"), + } + co.PullImage(ctx, t, snapshotter, image) +} + func testWindows(t *testing.T, version int, isolated bool) { var err error // Make the bundle - bundle := testutilities.CreateTempDir(t) + bundle := t.TempDir() defer func() { - if err == nil { - os.RemoveAll(bundle) - } else { + if err != nil { t.Errorf("additional logs at bundle path: %v", bundle) } }() - scratch := testutilities.CreateTempDir(t) + scratch := t.TempDir() defer func() { vhd.DetachVhd(filepath.Join(scratch, "sandbox.vhdx")) - os.RemoveAll(scratch) }() // Generate the Spec @@ -194,7 +213,8 @@ func testWindows(t *testing.T, version int, isolated bool) { // Get the LayerFolders imageName := getWindowsImageNameByVersion(t, version) - layers := testutilities.LayerFolders(t, imageName) + client, ctx := newCtrdClient(context.Background(), t) + layers := testutil.LayerFolders(ctx, t, client, imageName) for _, layer := range layers { g.AddWindowsLayerFolders(layer) } @@ -214,7 +234,6 @@ func testWindows(t *testing.T, version int, isolated bool) { cf.Close() // Create the Argon, Xenon, or UVM - ctx := context.TODO() rhcs := runhcs.Runhcs{ Debug: true, } @@ -310,25 +329,25 @@ func testLCOWPod(t *testing.T) { } func Test_RS1_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS1) + testutil.RequiresExactBuild(t, osversion.RS1) testWindows(t, osversion.RS1, false) } func Test_RS1_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS1) + testutil.RequiresExactBuild(t, osversion.RS1) testWindows(t, osversion.RS1, true) } func Test_RS3_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS3) + testutil.RequiresExactBuild(t, osversion.RS3) testWindows(t, osversion.RS3, false) } func Test_RS3_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS3) + testutil.RequiresExactBuild(t, osversion.RS3) guests := []int{osversion.RS1, osversion.RS3} for _, g := range guests { @@ -337,13 +356,13 @@ func Test_RS3_Xenon(t *testing.T) { } func Test_RS4_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS4) + testutil.RequiresExactBuild(t, osversion.RS4) testWindows(t, osversion.RS4, false) } func Test_RS4_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS4) + testutil.RequiresExactBuild(t, osversion.RS4) guests := []int{osversion.RS1, osversion.RS3, osversion.RS4} for _, g := range guests { @@ -352,19 +371,19 @@ func Test_RS4_Xenon(t *testing.T) { } func Test_RS5_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindows(t, osversion.RS5, false) } func Test_RS5_ArgonPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindowsPod(t, osversion.RS5, false) } func Test_RS5_UVMAndContainer(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) guests := []int{osversion.RS1, osversion.RS3, osversion.RS4, osversion.RS5} for _, g := range guests { @@ -373,19 +392,19 @@ func Test_RS5_UVMAndContainer(t *testing.T) { } func Test_RS5_UVMPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindowsPod(t, osversion.RS5, true) } func Test_RS5_LCOW(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testLCOW(t) } func Test_RS5_LCOW_UVMPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testLCOWPod(t) } diff --git a/test/runhcs/runhcs_test.go b/test/runhcs/runhcs_test.go index 427c3d1ec2..2906711e01 100644 --- a/test/runhcs/runhcs_test.go +++ b/test/runhcs/runhcs_test.go @@ -1,7 +1,8 @@ +//go:build functional // +build functional package runhcs import ( - _ "github.com/Microsoft/hcsshim/test/functional/manifest" + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" ) diff --git a/test/testutil/constants.go b/test/testutil/constants.go new file mode 100644 index 0000000000..a2dfe47c4f --- /dev/null +++ b/test/testutil/constants.go @@ -0,0 +1,57 @@ +package testutil + +import ( + "fmt" + "time" +) + +const ( + connectTimeout = time.Second * 10 + + PlatformWindows = "windows" + PlatformLinux = "linux" + SnapshotterWindows = "windows" + SnapshotterLinux = "windows-lcow" + + McrWindowsImageRepo = "mcr.microsoft.com/windows" + + ImageLinuxAlpineLatest = "docker.io/library/alpine:latest" +) + +var ( + ImageWindowsNanoserver1709 = NanoserverImage("1709") + ImageWindowsNanoserver1803 = NanoserverImage("1803") + ImageWindowsNanoserver1809 = NanoserverImage("1809") + ImageWindowsNanoserver1903 = NanoserverImage("1903") + ImageWindowsNanoserver1909 = NanoserverImage("1909") + ImageWindowsNanoserver2004 = NanoserverImage("2004") + ImageWindowsNanoserver2009 = NanoserverImage("2009") + ImageWindowsNanoserverLTSC2022 = NanoserverImage("ltsc2022") + + ImageWindowsServercore1709 = ServercoreImage("1709") + ImageWindowsServercore1803 = ServercoreImage("1803") + ImageWindowsServercore1809 = ServercoreImage("1809") + ImageWindowsServercore1903 = ServercoreImage("1903") + ImageWindowsServercore1909 = ServercoreImage("1909") + ImageWindowsServercore2004 = ServercoreImage("2004") + ImageWindowsServercore2009 = ServercoreImage("2009") + ImageWindowsServercoreLTSC2022 = ServercoreImage("ltsc2022") +) + +// all inputs should be predefined and vetted +// may not be formatted correctly for arbitrary inputs +func makeImageURL(repo, image, tag string) string { + r := fmt.Sprintf("%s/%s", repo, image) + if tag != "" { + r = fmt.Sprintf("%s:%s", r, tag) + } + return r +} + +func NanoserverImage(tag string) string { + return makeImageURL(McrWindowsImageRepo, "nanoserver", tag) +} + +func ServercoreImage(tag string) string { + return makeImageURL(McrWindowsImageRepo, "servercore", tag) +} diff --git a/test/testutil/containerd.go b/test/testutil/containerd.go new file mode 100644 index 0000000000..6753daa171 --- /dev/null +++ b/test/testutil/containerd.go @@ -0,0 +1,132 @@ +package testutil + +import ( + "context" + "testing" + + "github.com/containerd/containerd" + kubeutil "github.com/containerd/containerd/integration/remote/util" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/namespaces" + "github.com/containerd/containerd/platforms" + "github.com/containerd/containerd/snapshots" + "github.com/opencontainers/image-spec/identity" + "google.golang.org/grpc" +) + +// default containerd.New(address) does not connect to tcp endpoints on windows +func createGRPCConn(ctx context.Context, address string) (*grpc.ClientConn, error) { + addr, dialer, err := kubeutil.GetAddressAndDialer(address) + if err != nil { + return nil, err + } + return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer)) +} + +type ContainerdClientOptions struct { + Address string + Namespace string +} + +func (cco ContainerdClientOptions) defaultOpts() []containerd.ClientOpt { + return []containerd.ClientOpt{containerd.WithDefaultNamespace(cco.Namespace)} +} + +// returned context is how namespaces are passed to various containerd client calls +func (cco ContainerdClientOptions) NewClient(ctx context.Context, t *testing.T, opts ...containerd.ClientOpt) (*containerd.Client, context.Context) { + // regular `New` does not work on windows, need to use `WithConn` + cctx, ccancel := context.WithTimeout(ctx, connectTimeout) + defer ccancel() + + conn, err := createGRPCConn(cctx, cco.Address) + if err != nil { + t.Fatalf("failed to dial runtime client: %v", err) + } + + opts = append(opts, cco.defaultOpts()...) + c, err := containerd.NewWithConn(conn, opts...) + if err != nil { + t.Fatalf("containerd.New() client failed: %v", err) + } + t.Cleanup(func() { c.Close() }) + + ctx = namespaces.WithNamespace(ctx, cco.Namespace) + ctx, cancel := context.WithCancel(ctx) + t.Cleanup(cancel) + + return c, ctx +} + +func GetPlatformComparer(t *testing.T, platform string) platforms.MatchComparer { + var p platforms.MatchComparer + if platform == "" { + p = platforms.All + } else { + pp, err := platforms.Parse(platform) + if err != nil { + t.Fatalf("could not parse platform %q: %v", platform, err) + } + p = platforms.Only(pp) + } + + return p +} + +// GetImageChainID gets the chain id of an image. platform can be "". +func GetImageChainID(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) string { + is := client.ImageService() + + i, err := is.Get(ctx, image) + if err != nil { + t.Fatalf("could not retrieve image %q: %v", image, err) + } + + p := GetPlatformComparer(t, platform) + + diffIDs, err := i.RootFS(ctx, client.ContentStore(), p) + if err != nil { + t.Fatalf("could not retrieve unpacked diff ids: %v", err) + } + chainID := identity.ChainID(diffIDs).String() + return chainID +} + +func CreateActiveSnapshot(ctx context.Context, t *testing.T, client *containerd.Client, snapshotter, parent, key string, opts ...snapshots.Opt) []mount.Mount { + ss := client.SnapshotService(snapshotter) + + ms, err := ss.Prepare(ctx, key, parent, opts...) + if err != nil { + t.Fatalf("could not make active snapshot %q from %q: %v", key, parent, err) + } + + t.Cleanup(func() { + err = ss.Remove(ctx, key) + if err != nil { + // remove is not idempotent, so do not Fail test + t.Logf("failed to remove active snapshot %q: %v", key, err) + } + }) + + return ms +} + +// a view will not not create a new scratch layer/vhd, but instead return only the directory of the +// committed snapshot `parent` +func CreateViewSnapshot(ctx context.Context, t *testing.T, client *containerd.Client, snapshotter, parent, key string, opts ...snapshots.Opt) []mount.Mount { + ss := client.SnapshotService(snapshotter) + + ms, err := ss.View(ctx, key, parent, opts...) + if err != nil { + t.Fatalf("could not make active snapshot %q from %q: %v", key, parent, err) + } + + t.Cleanup(func() { + err = ss.Remove(ctx, key) + if err != nil { + // remove is not idempotent, so do not Fail test + t.Logf("failed to remove view snapshot %q: %v", key, err) + } + }) + + return ms +} diff --git a/test/testutil/createuvm.go b/test/testutil/createuvm.go new file mode 100644 index 0000000000..2d50021eac --- /dev/null +++ b/test/testutil/createuvm.go @@ -0,0 +1,87 @@ +package testutil + +import ( + "context" + "testing" + + "github.com/Microsoft/hcsshim/internal/uvm" + "github.com/containerd/containerd" +) + +// CreateWCOWUVM creates a WCOW utility VM with all default options. Returns the +// UtilityVM object; folder used as its scratch +func CreateWCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, id, image string) (*uvm.UtilityVM, []string, string) { + return CreateWCOWUVMFromOptsWithImage(ctx, t, client, uvm.NewDefaultOptionsWCOW(id, ""), image) + +} + +// CreateWCOWUVMFromOptsWithImage creates a WCOW utility VM with the passed opts +// builds the LayerFolders based on `image`. Returns the UtilityVM object; +// folder used as its scratch +func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, client *containerd.Client, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { + if opts == nil { + t.Fatal("opts must be set") + } + + layers := LayerFolders(ctx, t, client, image) + scratch := t.TempDir() + opts.LayerFolders = append(opts.LayerFolders, layers...) + opts.LayerFolders = append(opts.LayerFolders, scratch) + + return CreateWCOWUVMFromOpts(ctx, t, client, opts), layers, scratch +} + +// CreateWCOWUVMFromOpts creates a WCOW utility VM with the passed opts. +func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Client, opts *uvm.OptionsWCOW) *uvm.UtilityVM { + if opts == nil || len(opts.LayerFolders) < 2 { + t.Fatalf("opts must bet set with LayerFolders") + } + + vm, err := uvm.CreateWCOW(ctx, opts) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + // should be idempotent + if err := vm.Close(); err != nil { + t.Fatalf("could not close uvm %q: %v", vm.ID(), err) + } + }) + + if err := vm.Start(ctx); err != nil { + vm.Close() + t.Fatal(err) + } + + return vm +} + +// CreateLCOWUVM with all default options. +// client is only to maintain call line compatibility with WCOW versions +func CreateLCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, id string) *uvm.UtilityVM { + return CreateLCOWUVMFromOpts(ctx, t, client, uvm.NewDefaultOptionsLCOW(id, "")) +} + +// CreateLCOWUVMFromOpts creates an LCOW utility VM with the specified options. +func CreateLCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Client, opts *uvm.OptionsLCOW) *uvm.UtilityVM { + if opts == nil { + t.Fatal("opts must be set") + } + + vm, err := uvm.CreateLCOW(ctx, opts) + if err != nil { + t.Fatalf("could not create LCOW UVM: %v", err) + } + t.Cleanup(func() { + // should be idempotent + if err := vm.Close(); err != nil { + t.Fatalf("could not close uvm %q: %v", vm.ID(), err) + } + }) + + if err := vm.Start(ctx); err != nil { + t.Fatalf("could not start LCOW UVM: %v", err) + } + + return vm +} diff --git a/test/testutil/ctrclient.go b/test/testutil/ctrclient.go new file mode 100644 index 0000000000..aa4ed58cab --- /dev/null +++ b/test/testutil/ctrclient.go @@ -0,0 +1,48 @@ +package testutil + +import ( + "context" + "os" + "os/exec" + "path/filepath" + "testing" +) + +func DefaultCtrPath() string { + return filepath.Join(filepath.Dir(os.Args[0]), "ctr.exe") +} + +// Global options for connecting to ctr.exe +// Flags are passed to parent module, cannot import them here without causing circular dependencies +// todo: restructure `LayerFolders` and `CreateWCOWUVM*` functions to use CtrClientOptions +// or move `utilities/*` into parent path, similar to `tests/cri-containerd` + +type CtrClientOptions struct { + Ctrd ContainerdClientOptions + Path string +} + +func (co CtrClientOptions) Command(ctx context.Context, arg ...string) *exec.Cmd { + args := []string{ + "--address", + co.Ctrd.Address, + "--namespace", + co.Ctrd.Namespace, + } + args = append(args, arg...) + cmd := exec.CommandContext(ctx, co.Path, args...) + return cmd +} + +// PullImages fetches the image, unpacks, and creates a snapshot of it using the chain ID as +// the reference. Rather than reimplement that using a containerd client, leverage ctr.exe +func (co CtrClientOptions) PullImage(ctx context.Context, t *testing.T, platform, image string) { + cmd := co.Command(ctx, "images", + "pull", + "--platform", + platform, + image) + if err := cmd.Run(); err != nil { + t.Fatalf("Failed to pull image %q with %v. Command was %v", image, err, cmd) + } +} diff --git a/test/functional/utilities/defaultlinuxspec.go b/test/testutil/defaultlinuxspec.go similarity index 95% rename from test/functional/utilities/defaultlinuxspec.go rename to test/testutil/defaultlinuxspec.go index 2f0b019799..59b6302e79 100644 --- a/test/functional/utilities/defaultlinuxspec.go +++ b/test/testutil/defaultlinuxspec.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "encoding/json" diff --git a/test/functional/utilities/defaultwindowsspec.go b/test/testutil/defaultwindowsspec.go similarity index 95% rename from test/functional/utilities/defaultwindowsspec.go rename to test/testutil/defaultwindowsspec.go index e1fa541a54..a691a03829 100644 --- a/test/functional/utilities/defaultwindowsspec.go +++ b/test/testutil/defaultwindowsspec.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "encoding/json" diff --git a/test/testutil/layerfolders.go b/test/testutil/layerfolders.go new file mode 100644 index 0000000000..b2f9bb5652 --- /dev/null +++ b/test/testutil/layerfolders.go @@ -0,0 +1,60 @@ +package testutil + +import ( + "context" + "encoding/json" + "strings" + "testing" + + "github.com/containerd/containerd" + "github.com/containerd/containerd/mount" +) + +var ( + imageLayers map[string][]string +) + +func init() { + imageLayers = make(map[string][]string) +} + +func GetSnapshotterFromPlatform(platform string) string { + if platform == PlatformWindows { + return SnapshotterWindows + } + return SnapshotterLinux +} + +func GetLayerFoldersFromMount(t *testing.T, m mount.Mount) (layers []string) { + for _, option := range m.Options { + if strings.HasPrefix(option, mount.ParentLayerPathsFlag) { + err := json.Unmarshal([]byte(option[len(mount.ParentLayerPathsFlag):]), &layers) + if err != nil { + t.Fatalf("failed to unmarshal parent layer paths from mount: %v", err) + } + } + } + layers = append(layers, m.Source) + return layers +} + +func LayerFolders(ctx context.Context, t *testing.T, client *containerd.Client, image string) []string { + return LayerFoldersPlatform(ctx, t, client, image, PlatformWindows) +} + +func LayerFoldersPlatform(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) []string { + if _, ok := imageLayers[image]; !ok { + imageLayers[image] = getLayers(ctx, t, client, image, platform) + } + return imageLayers[image] +} + +func getLayers(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) []string { + cid := GetImageChainID(ctx, t, client, image, platform) + snapshotter := GetSnapshotterFromPlatform(platform) + ms := CreateViewSnapshot(ctx, t, client, snapshotter, cid, image+"view") + if len(ms) != 1 { + t.Fatalf("Rootfs does not contain exactly 1 mount for the root file system") + } + return GetLayerFoldersFromMount(t, ms[0]) +} diff --git a/test/functional/manifest/manifest.go b/test/testutil/manifest/manifest.go similarity index 100% rename from test/functional/manifest/manifest.go rename to test/testutil/manifest/manifest.go diff --git a/test/functional/manifest/rsrc_amd64.syso b/test/testutil/manifest/rsrc_amd64.syso similarity index 100% rename from test/functional/manifest/rsrc_amd64.syso rename to test/testutil/manifest/rsrc_amd64.syso diff --git a/test/functional/utilities/requiresbuild.go b/test/testutil/requiresbuild.go similarity index 93% rename from test/functional/utilities/requiresbuild.go rename to test/testutil/requiresbuild.go index 47930994d0..33a13bb568 100644 --- a/test/functional/utilities/requiresbuild.go +++ b/test/testutil/requiresbuild.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "testing" diff --git a/test/functional/utilities/scratch.go b/test/testutil/scratch.go similarity index 89% rename from test/functional/utilities/scratch.go rename to test/testutil/scratch.go index e7cf11028a..f1cc685895 100644 --- a/test/functional/utilities/scratch.go +++ b/test/testutil/scratch.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" @@ -35,7 +35,7 @@ func CreateWCOWBlankRWLayer(t *testing.T, imageLayers []string) string { // t.Fatalf("failed to locate UVM folder from %+v: %s", imageLayers, err) // } - tempDir := CreateTempDir(t) + tempDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), tempDir, imageLayers); err != nil { t.Fatalf("Failed CreateScratchLayer: %s", err) } @@ -47,10 +47,10 @@ func CreateWCOWBlankRWLayer(t *testing.T, imageLayers []string) string { // for a "service VM". func CreateLCOWBlankRWLayer(ctx context.Context, t *testing.T) string { if lcowGlobalSVM == nil { - lcowGlobalSVM = CreateLCOWUVM(ctx, t, lcowGlobalSVMID) - lcowCacheScratchFile = filepath.Join(CreateTempDir(t), "sandbox.vhdx") + lcowGlobalSVM = CreateLCOWUVM(ctx, t, nil, lcowGlobalSVMID) + lcowCacheScratchFile = filepath.Join(t.TempDir(), "sandbox.vhdx") } - tempDir := CreateTempDir(t) + tempDir := t.TempDir() if err := lcow.CreateScratch(ctx, lcowGlobalSVM, filepath.Join(tempDir, "sandbox.vhdx"), lcow.DefaultScratchSizeGB, lcowCacheScratchFile); err != nil { t.Fatalf("failed to create EXT4 scratch for LCOW test cases: %s", err) diff --git a/test/functional/utilities/stringsetflag.go b/test/testutil/stringsetflag.go similarity index 97% rename from test/functional/utilities/stringsetflag.go rename to test/testutil/stringsetflag.go index eeb06bf4cf..bbc16a86da 100644 --- a/test/functional/utilities/stringsetflag.go +++ b/test/testutil/stringsetflag.go @@ -1,4 +1,4 @@ -package testutilities +package testutil // StringSetFlag is a type to be used with the standard library's flag.Var // function as a custom flag value. It accumulates the arguments passed each diff --git a/test/vendor/github.com/Microsoft/hcsshim/go.mod b/test/vendor/github.com/Microsoft/hcsshim/go.mod index 1797bd7f83..d0c21388b9 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/go.mod +++ b/test/vendor/github.com/Microsoft/hcsshim/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 github.com/Microsoft/go-winio v0.4.17 + github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 github.com/cenkalti/backoff/v4 v4.1.1 github.com/containerd/cgroups v1.0.1 github.com/containerd/console v1.0.2 @@ -28,13 +29,13 @@ require ( github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.22.3 - golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e google.golang.org/grpc v1.40.0 ) replace ( + github.com/Microsoft/hcsshim/test => ./test google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 google.golang.org/grpc => google.golang.org/grpc v1.27.1 ) diff --git a/test/vendor/github.com/Microsoft/hcsshim/go.sum b/test/vendor/github.com/Microsoft/hcsshim/go.sum index afe9660c90..fce6716c99 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/go.sum +++ b/test/vendor/github.com/Microsoft/hcsshim/go.sum @@ -22,9 +22,7 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= @@ -53,16 +51,15 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3 github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/Microsoft/hcsshim v0.9.1/go.mod h1:Y/0uV2jUab5kBI7SQgl62at0AVX7uaruzADAVmxm3eM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -70,22 +67,14 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -136,6 +125,8 @@ github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7 github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -225,14 +216,10 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017 h1:2HQmlpI3yI9deH18Q6xiSOIjXD4sLI55Y/gfpa8/558= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -243,11 +230,9 @@ github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avu github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -264,13 +249,11 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -300,7 +283,6 @@ github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/ github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -371,9 +353,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -400,8 +379,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -409,7 +386,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -436,7 +412,6 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -450,7 +425,6 @@ github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WT github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM= @@ -467,7 +441,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -489,15 +462,14 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -527,18 +499,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -576,8 +545,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -634,9 +601,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -708,7 +672,6 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -762,7 +725,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -839,7 +801,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -879,7 +840,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -896,7 +856,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= @@ -916,7 +875,6 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -969,7 +927,6 @@ k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NI k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= diff --git a/test/vendor/golang.org/x/net/http/httpguts/httplex.go b/test/vendor/golang.org/x/net/http/httpguts/httplex.go index c79aa73f28..e7de24ee64 100644 --- a/test/vendor/golang.org/x/net/http/httpguts/httplex.go +++ b/test/vendor/golang.org/x/net/http/httpguts/httplex.go @@ -137,13 +137,11 @@ func trimOWS(x string) string { // contains token amongst its comma-separated tokens, ASCII // case-insensitively. func headerValueContainsToken(v string, token string) bool { - for comma := strings.IndexByte(v, ','); comma != -1; comma = strings.IndexByte(v, ',') { - if tokenEqual(trimOWS(v[:comma]), token) { - return true - } - v = v[comma+1:] + v = trimOWS(v) + if comma := strings.IndexByte(v, ','); comma != -1 { + return tokenEqual(trimOWS(v[:comma]), token) || headerValueContainsToken(v[comma+1:], token) } - return tokenEqual(trimOWS(v), token) + return tokenEqual(v, token) } // lowerASCII returns the ASCII lowercase version of b. diff --git a/test/vendor/golang.org/x/net/http2/Dockerfile b/test/vendor/golang.org/x/net/http2/Dockerfile index 8512245952..53fc525797 100644 --- a/test/vendor/golang.org/x/net/http2/Dockerfile +++ b/test/vendor/golang.org/x/net/http2/Dockerfile @@ -38,7 +38,7 @@ RUN make RUN make install WORKDIR /root -RUN wget https://curl.se/download/curl-7.45.0.tar.gz +RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz RUN tar -zxvf curl-7.45.0.tar.gz WORKDIR /root/curl-7.45.0 RUN ./configure --with-ssl --with-nghttp2=/usr/local diff --git a/test/vendor/golang.org/x/net/http2/README b/test/vendor/golang.org/x/net/http2/README new file mode 100644 index 0000000000..360d5aa379 --- /dev/null +++ b/test/vendor/golang.org/x/net/http2/README @@ -0,0 +1,20 @@ +This is a work-in-progress HTTP/2 implementation for Go. + +It will eventually live in the Go standard library and won't require +any changes to your code to use. It will just be automatic. + +Status: + +* The server support is pretty good. A few things are missing + but are being worked on. +* The client work has just started but shares a lot of code + is coming along much quicker. + +Docs are at https://godoc.org/golang.org/x/net/http2 + +Demo test server at https://http2.golang.org/ + +Help & bug reports welcome! + +Contributing: https://golang.org/doc/contribute.html +Bugs: https://golang.org/issue/new?title=x/net/http2:+ diff --git a/test/vendor/golang.org/x/net/http2/ascii.go b/test/vendor/golang.org/x/net/http2/ascii.go deleted file mode 100644 index 17caa20586..0000000000 --- a/test/vendor/golang.org/x/net/http2/ascii.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import "strings" - -// The HTTP protocols are defined in terms of ASCII, not Unicode. This file -// contains helper functions which may use Unicode-aware functions which would -// otherwise be unsafe and could introduce vulnerabilities if used improperly. - -// asciiEqualFold is strings.EqualFold, ASCII only. It reports whether s and t -// are equal, ASCII-case-insensitively. -func asciiEqualFold(s, t string) bool { - if len(s) != len(t) { - return false - } - for i := 0; i < len(s); i++ { - if lower(s[i]) != lower(t[i]) { - return false - } - } - return true -} - -// lower returns the ASCII lowercase version of b. -func lower(b byte) byte { - if 'A' <= b && b <= 'Z' { - return b + ('a' - 'A') - } - return b -} - -// isASCIIPrint returns whether s is ASCII and printable according to -// https://tools.ietf.org/html/rfc20#section-4.2. -func isASCIIPrint(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] < ' ' || s[i] > '~' { - return false - } - } - return true -} - -// asciiToLower returns the lowercase version of s if s is ASCII and printable, -// and whether or not it was. -func asciiToLower(s string) (lower string, ok bool) { - if !isASCIIPrint(s) { - return "", false - } - return strings.ToLower(s), true -} diff --git a/test/vendor/golang.org/x/net/http2/client_conn_pool.go b/test/vendor/golang.org/x/net/http2/client_conn_pool.go index 652bc11a02..3a67636fe2 100644 --- a/test/vendor/golang.org/x/net/http2/client_conn_pool.go +++ b/test/vendor/golang.org/x/net/http2/client_conn_pool.go @@ -7,9 +7,7 @@ package http2 import ( - "context" "crypto/tls" - "errors" "net/http" "sync" ) @@ -80,69 +78,61 @@ func (p *clientConnPool) getClientConn(req *http.Request, addr string, dialOnMis // It gets its own connection. traceGetConn(req, addr) const singleUse = true - cc, err := p.t.dialClientConn(req.Context(), addr, singleUse) + cc, err := p.t.dialClientConn(addr, singleUse) if err != nil { return nil, err } return cc, nil } - for { - p.mu.Lock() - for _, cc := range p.conns[addr] { - if st := cc.idleState(); st.canTakeNewRequest { - if p.shouldTraceGetConn(st) { - traceGetConn(req, addr) - } - p.mu.Unlock() - return cc, nil + p.mu.Lock() + for _, cc := range p.conns[addr] { + if st := cc.idleState(); st.canTakeNewRequest { + if p.shouldTraceGetConn(st) { + traceGetConn(req, addr) } - } - if !dialOnMiss { p.mu.Unlock() - return nil, ErrNoCachedConn + return cc, nil } - traceGetConn(req, addr) - call := p.getStartDialLocked(req.Context(), addr) + } + if !dialOnMiss { p.mu.Unlock() - <-call.done - if shouldRetryDial(call, req) { - continue - } - return call.res, call.err + return nil, ErrNoCachedConn } + traceGetConn(req, addr) + call := p.getStartDialLocked(addr) + p.mu.Unlock() + <-call.done + return call.res, call.err } // dialCall is an in-flight Transport dial call to a host. type dialCall struct { - _ incomparable - p *clientConnPool - // the context associated with the request - // that created this dialCall - ctx context.Context + _ incomparable + p *clientConnPool done chan struct{} // closed when done res *ClientConn // valid after done is closed err error // valid after done is closed } // requires p.mu is held. -func (p *clientConnPool) getStartDialLocked(ctx context.Context, addr string) *dialCall { +func (p *clientConnPool) getStartDialLocked(addr string) *dialCall { if call, ok := p.dialing[addr]; ok { // A dial is already in-flight. Don't start another. return call } - call := &dialCall{p: p, done: make(chan struct{}), ctx: ctx} + call := &dialCall{p: p, done: make(chan struct{})} if p.dialing == nil { p.dialing = make(map[string]*dialCall) } p.dialing[addr] = call - go call.dial(call.ctx, addr) + go call.dial(addr) return call } // run in its own goroutine. -func (c *dialCall) dial(ctx context.Context, addr string) { +func (c *dialCall) dial(addr string) { const singleUse = false // shared conn - c.res, c.err = c.p.t.dialClientConn(ctx, addr, singleUse) + c.res, c.err = c.p.t.dialClientConn(addr, singleUse) close(c.done) c.p.mu.Lock() @@ -286,28 +276,3 @@ type noDialClientConnPool struct{ *clientConnPool } func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { return p.getClientConn(req, addr, noDialOnMiss) } - -// shouldRetryDial reports whether the current request should -// retry dialing after the call finished unsuccessfully, for example -// if the dial was canceled because of a context cancellation or -// deadline expiry. -func shouldRetryDial(call *dialCall, req *http.Request) bool { - if call.err == nil { - // No error, no need to retry - return false - } - if call.ctx == req.Context() { - // If the call has the same context as the request, the dial - // should not be retried, since any cancellation will have come - // from this request. - return false - } - if !errors.Is(call.err, context.Canceled) && !errors.Is(call.err, context.DeadlineExceeded) { - // If the call error is not because of a context cancellation or a deadline expiry, - // the dial should not be retried. - return false - } - // Only retry if the error is a context cancellation error or deadline expiry - // and the context associated with the call was canceled or expired. - return call.ctx.Err() != nil -} diff --git a/test/vendor/golang.org/x/net/http2/go115.go b/test/vendor/golang.org/x/net/http2/go115.go deleted file mode 100644 index 908af1ab93..0000000000 --- a/test/vendor/golang.org/x/net/http2/go115.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.15 -// +build go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS -// connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - dialer := &tls.Dialer{ - Config: cfg, - } - cn, err := dialer.DialContext(ctx, network, addr) - if err != nil { - return nil, err - } - tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed - return tlsCn, nil -} diff --git a/test/vendor/golang.org/x/net/http2/headermap.go b/test/vendor/golang.org/x/net/http2/headermap.go index 9e12941da4..c3ff3fa1c7 100644 --- a/test/vendor/golang.org/x/net/http2/headermap.go +++ b/test/vendor/golang.org/x/net/http2/headermap.go @@ -6,6 +6,7 @@ package http2 import ( "net/http" + "strings" "sync" ) @@ -78,10 +79,10 @@ func buildCommonHeaderMaps() { } } -func lowerHeader(v string) (lower string, ascii bool) { +func lowerHeader(v string) string { buildCommonHeaderMapsOnce() if s, ok := commonLowerHeader[v]; ok { - return s, true + return s } - return asciiToLower(v) + return strings.ToLower(v) } diff --git a/test/vendor/golang.org/x/net/http2/not_go115.go b/test/vendor/golang.org/x/net/http2/not_go115.go deleted file mode 100644 index e6c04cf7ac..0000000000 --- a/test/vendor/golang.org/x/net/http2/not_go115.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.15 -// +build !go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext opens a TLS connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if cfg.InsecureSkipVerify { - return cn, nil - } - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - return cn, nil -} diff --git a/test/vendor/golang.org/x/net/http2/server.go b/test/vendor/golang.org/x/net/http2/server.go index 19e449cfae..e125bbd2a2 100644 --- a/test/vendor/golang.org/x/net/http2/server.go +++ b/test/vendor/golang.org/x/net/http2/server.go @@ -231,12 +231,13 @@ func ConfigureServer(s *http.Server, conf *Server) error { if s.TLSConfig == nil { s.TLSConfig = new(tls.Config) - } else if s.TLSConfig.CipherSuites != nil && s.TLSConfig.MinVersion < tls.VersionTLS13 { - // If they already provided a TLS 1.0–1.2 CipherSuite list, return an - // error if it is missing ECDHE_RSA_WITH_AES_128_GCM_SHA256 or - // ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. + } else if s.TLSConfig.CipherSuites != nil { + // If they already provided a CipherSuite list, return + // an error if it has a bad order or is missing + // ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. haveRequired := false - for _, cs := range s.TLSConfig.CipherSuites { + sawBad := false + for i, cs := range s.TLSConfig.CipherSuites { switch cs { case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, // Alternative MTI cipher to not discourage ECDSA-only servers. @@ -244,9 +245,14 @@ func ConfigureServer(s *http.Server, conf *Server) error { tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: haveRequired = true } + if isBadCipher(cs) { + sawBad = true + } else if sawBad { + return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs) + } } if !haveRequired { - return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)") + return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).") } } @@ -259,11 +265,15 @@ func ConfigureServer(s *http.Server, conf *Server) error { s.TLSConfig.PreferServerCipherSuites = true - if !strSliceContains(s.TLSConfig.NextProtos, NextProtoTLS) { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) + haveNPN := false + for _, p := range s.TLSConfig.NextProtos { + if p == NextProtoTLS { + haveNPN = true + break + } } - if !strSliceContains(s.TLSConfig.NextProtos, "http/1.1") { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, "http/1.1") + if !haveNPN { + s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) } if s.TLSNextProto == nil { @@ -816,7 +826,7 @@ func (sc *serverConn) serve() { }) sc.unackedSettings++ - // Each connection starts with initialWindowSize inflow tokens. + // Each connection starts with intialWindowSize inflow tokens. // If a higher value is configured, we add more tokens. if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 { sc.sendWindowUpdate(nil, int(diff)) @@ -856,15 +866,6 @@ func (sc *serverConn) serve() { case res := <-sc.wroteFrameCh: sc.wroteFrame(res) case res := <-sc.readFrameCh: - // Process any written frames before reading new frames from the client since a - // written frame could have triggered a new stream to be started. - if sc.writingFrameAsync { - select { - case wroteRes := <-sc.wroteFrameCh: - sc.wroteFrame(wroteRes) - default: - } - } if !sc.processFrameFromReader(res) { return } @@ -2788,12 +2789,8 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error { // but PUSH_PROMISE requests cannot have a body. // http://tools.ietf.org/html/rfc7540#section-8.2 // Also disallow Host, since the promised URL must be absolute. - if asciiEqualFold(k, "content-length") || - asciiEqualFold(k, "content-encoding") || - asciiEqualFold(k, "trailer") || - asciiEqualFold(k, "te") || - asciiEqualFold(k, "expect") || - asciiEqualFold(k, "host") { + switch strings.ToLower(k) { + case "content-length", "content-encoding", "trailer", "te", "expect", "host": return fmt.Errorf("promised request headers cannot include %q", k) } } diff --git a/test/vendor/golang.org/x/net/http2/transport.go b/test/vendor/golang.org/x/net/http2/transport.go index b261beb1d0..7688d72c39 100644 --- a/test/vendor/golang.org/x/net/http2/transport.go +++ b/test/vendor/golang.org/x/net/http2/transport.go @@ -264,8 +264,9 @@ type ClientConn struct { peerMaxHeaderListSize uint64 initialWindowSize uint32 - hbuf bytes.Buffer // HPACK encoder writes into this - henc *hpack.Encoder + hbuf bytes.Buffer // HPACK encoder writes into this + henc *hpack.Encoder + freeBuf [][]byte wmu sync.Mutex // held while writing; acquire AFTER mu if holding both werr error // first write error that has occurred @@ -385,13 +386,8 @@ func (cs *clientStream) abortRequestBodyWrite(err error) { } cc := cs.cc cc.mu.Lock() - if cs.stopReqBody == nil { - cs.stopReqBody = err - if cs.req.Body != nil { - cs.req.Body.Close() - } - cc.cond.Broadcast() - } + cs.stopReqBody = err + cc.cond.Broadcast() cc.mu.Unlock() } @@ -568,12 +564,12 @@ func canRetryError(err error) bool { return false } -func (t *Transport) dialClientConn(ctx context.Context, addr string, singleUse bool) (*ClientConn, error) { +func (t *Transport) dialClientConn(addr string, singleUse bool) (*ClientConn, error) { host, _, err := net.SplitHostPort(addr) if err != nil { return nil, err } - tconn, err := t.dialTLS(ctx)("tcp", addr, t.newTLSConfig(host)) + tconn, err := t.dialTLS()("tcp", addr, t.newTLSConfig(host)) if err != nil { return nil, err } @@ -594,24 +590,34 @@ func (t *Transport) newTLSConfig(host string) *tls.Config { return cfg } -func (t *Transport) dialTLS(ctx context.Context) func(string, string, *tls.Config) (net.Conn, error) { +func (t *Transport) dialTLS() func(string, string, *tls.Config) (net.Conn, error) { if t.DialTLS != nil { return t.DialTLS } - return func(network, addr string, cfg *tls.Config) (net.Conn, error) { - tlsCn, err := t.dialTLSWithContext(ctx, network, addr, cfg) - if err != nil { + return t.dialTLSDefault +} + +func (t *Transport) dialTLSDefault(network, addr string, cfg *tls.Config) (net.Conn, error) { + cn, err := tls.Dial(network, addr, cfg) + if err != nil { + return nil, err + } + if err := cn.Handshake(); err != nil { + return nil, err + } + if !cfg.InsecureSkipVerify { + if err := cn.VerifyHostname(cfg.ServerName); err != nil { return nil, err } - state := tlsCn.ConnectionState() - if p := state.NegotiatedProtocol; p != NextProtoTLS { - return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) - } - if !state.NegotiatedProtocolIsMutual { - return nil, errors.New("http2: could not negotiate protocol mutually") - } - return tlsCn, nil } + state := cn.ConnectionState() + if p := state.NegotiatedProtocol; p != NextProtoTLS { + return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) + } + if !state.NegotiatedProtocolIsMutual { + return nil, errors.New("http2: could not negotiate protocol mutually") + } + return cn, nil } // disableKeepAlives reports whether connections should be closed as @@ -917,6 +923,46 @@ func (cc *ClientConn) closeForLostPing() error { return cc.closeForError(err) } +const maxAllocFrameSize = 512 << 10 + +// frameBuffer returns a scratch buffer suitable for writing DATA frames. +// They're capped at the min of the peer's max frame size or 512KB +// (kinda arbitrarily), but definitely capped so we don't allocate 4GB +// bufers. +func (cc *ClientConn) frameScratchBuffer() []byte { + cc.mu.Lock() + size := cc.maxFrameSize + if size > maxAllocFrameSize { + size = maxAllocFrameSize + } + for i, buf := range cc.freeBuf { + if len(buf) >= int(size) { + cc.freeBuf[i] = nil + cc.mu.Unlock() + return buf[:size] + } + } + cc.mu.Unlock() + return make([]byte, size) +} + +func (cc *ClientConn) putFrameScratchBuffer(buf []byte) { + cc.mu.Lock() + defer cc.mu.Unlock() + const maxBufs = 4 // arbitrary; 4 concurrent requests per conn? investigate. + if len(cc.freeBuf) < maxBufs { + cc.freeBuf = append(cc.freeBuf, buf) + return + } + for i, old := range cc.freeBuf { + if old == nil { + cc.freeBuf[i] = buf + return + } + } + // forget about it. +} + // errRequestCanceled is a copy of net/http's errRequestCanceled because it's not // exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. var errRequestCanceled = errors.New("net/http: request canceled") @@ -959,7 +1005,7 @@ func checkConnHeaders(req *http.Request) error { if vv := req.Header["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") { return fmt.Errorf("http2: invalid Transfer-Encoding request header: %q", vv) } - if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !asciiEqualFold(vv[0], "close") && !asciiEqualFold(vv[0], "keep-alive")) { + if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !strings.EqualFold(vv[0], "close") && !strings.EqualFold(vv[0], "keep-alive")) { return fmt.Errorf("http2: invalid Connection request header: %q", vv) } return nil @@ -1115,28 +1161,40 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf return res, false, nil } - handleError := func(err error) (*http.Response, bool, error) { - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - <-bodyWriter.resc - } - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), err - } - for { select { case re := <-readLoopResCh: return handleReadLoopResponse(re) case <-respHeaderTimer: - return handleError(errTimeout) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), errTimeout case <-ctx.Done(): - return handleError(ctx.Err()) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), ctx.Err() case <-req.Cancel: - return handleError(errRequestCanceled) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), errRequestCanceled case <-cs.peerReset: // processResetStream already removed the // stream from the streams map; no need for @@ -1247,35 +1305,11 @@ var ( errReqBodyTooLong = errors.New("http2: request body larger than specified content length") ) -// frameScratchBufferLen returns the length of a buffer to use for -// outgoing request bodies to read/write to/from. -// -// It returns max(1, min(peer's advertised max frame size, -// Request.ContentLength+1, 512KB)). -func (cs *clientStream) frameScratchBufferLen(maxFrameSize int) int { - const max = 512 << 10 - n := int64(maxFrameSize) - if n > max { - n = max - } - if cl := actualContentLength(cs.req); cl != -1 && cl+1 < n { - // Add an extra byte past the declared content-length to - // give the caller's Request.Body io.Reader a chance to - // give us more bytes than they declared, so we can catch it - // early. - n = cl + 1 - } - if n < 1 { - return 1 - } - return int(n) // doesn't truncate; max is 512K -} - -var bufPool sync.Pool // of *[]byte - func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { cc := cs.cc sentEnd := false // whether we sent the final DATA frame w/ END_STREAM + buf := cc.frameScratchBuffer() + defer cc.putFrameScratchBuffer(buf) defer func() { traceWroteRequest(cs.trace, err) @@ -1283,13 +1317,7 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( // Request.Body is closed by the Transport, // and in multiple cases: server replies <=299 and >299 // while still writing request body - var cerr error - cc.mu.Lock() - if cs.stopReqBody == nil { - cs.stopReqBody = errStopReqBodyWrite - cerr = bodyCloser.Close() - } - cc.mu.Unlock() + cerr := bodyCloser.Close() if err == nil { err = cerr } @@ -1300,24 +1328,9 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( remainLen := actualContentLength(req) hasContentLen := remainLen != -1 - cc.mu.Lock() - maxFrameSize := int(cc.maxFrameSize) - cc.mu.Unlock() - - // Scratch buffer for reading into & writing from. - scratchLen := cs.frameScratchBufferLen(maxFrameSize) - var buf []byte - if bp, ok := bufPool.Get().(*[]byte); ok && len(*bp) >= scratchLen { - defer bufPool.Put(bp) - buf = *bp - } else { - buf = make([]byte, scratchLen) - defer bufPool.Put(&buf) - } - var sawEOF bool for !sawEOF { - n, err := body.Read(buf[:len(buf)]) + n, err := body.Read(buf[:len(buf)-1]) if hasContentLen { remainLen -= int64(n) if remainLen == 0 && err == nil { @@ -1328,9 +1341,8 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( // to send the END_STREAM bit early, double-check that we're actually // at EOF. Subsequent reads should return (0, EOF) at this point. // If either value is different, we return an error in one of two ways below. - var scratch [1]byte var n1 int - n1, err = body.Read(scratch[:]) + n1, err = body.Read(buf[n:]) remainLen -= int64(n1) } if remainLen < 0 { @@ -1400,6 +1412,10 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( } } + cc.mu.Lock() + maxFrameSize := int(cc.maxFrameSize) + cc.mu.Unlock() + cc.wmu.Lock() defer cc.wmu.Unlock() @@ -1515,21 +1531,19 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail var didUA bool for k, vv := range req.Header { - if asciiEqualFold(k, "host") || asciiEqualFold(k, "content-length") { + if strings.EqualFold(k, "host") || strings.EqualFold(k, "content-length") { // Host is :authority, already sent. // Content-Length is automatic, set below. continue - } else if asciiEqualFold(k, "connection") || - asciiEqualFold(k, "proxy-connection") || - asciiEqualFold(k, "transfer-encoding") || - asciiEqualFold(k, "upgrade") || - asciiEqualFold(k, "keep-alive") { + } else if strings.EqualFold(k, "connection") || strings.EqualFold(k, "proxy-connection") || + strings.EqualFold(k, "transfer-encoding") || strings.EqualFold(k, "upgrade") || + strings.EqualFold(k, "keep-alive") { // Per 8.1.2.2 Connection-Specific Header // Fields, don't send connection-specific // fields. We have already checked if any // are error-worthy so just ignore the rest. continue - } else if asciiEqualFold(k, "user-agent") { + } else if strings.EqualFold(k, "user-agent") { // Match Go's http1 behavior: at most one // User-Agent. If set to nil or empty string, // then omit it. Otherwise if not mentioned, @@ -1542,7 +1556,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail if vv[0] == "" { continue } - } else if asciiEqualFold(k, "cookie") { + } else if strings.EqualFold(k, "cookie") { // Per 8.1.2.5 To allow for better compression efficiency, the // Cookie header field MAY be split into separate header fields, // each with one or more cookie-pairs. @@ -1601,12 +1615,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail // Header list size is ok. Write the headers. enumerateHeaders(func(name, value string) { - name, ascii := asciiToLower(name) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - return - } + name = strings.ToLower(name) cc.writeHeader(name, value) if traceHeaders { traceWroteHeaderField(trace, name, value) @@ -1654,14 +1663,9 @@ func (cc *ClientConn) encodeTrailers(req *http.Request) ([]byte, error) { } for k, vv := range req.Trailer { - lowKey, ascii := asciiToLower(k) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - continue - } // Transfer-Encoding, etc.. have already been filtered at the // start of RoundTrip + lowKey := strings.ToLower(k) for _, v := range vv { cc.writeHeader(lowKey, v) } diff --git a/test/vendor/golang.org/x/net/http2/write.go b/test/vendor/golang.org/x/net/http2/write.go index 33f61398a1..3849bc2632 100644 --- a/test/vendor/golang.org/x/net/http2/write.go +++ b/test/vendor/golang.org/x/net/http2/write.go @@ -341,12 +341,7 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) { } for _, k := range keys { vv := h[k] - k, ascii := lowerHeader(k) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - continue - } + k = lowerHeader(k) if !validWireHeaderFieldName(k) { // Skip it as backup paranoia. Per // golang.org/issue/14048, these should diff --git a/test/vendor/golang.org/x/net/idna/idna10.0.0.go b/test/vendor/golang.org/x/net/idna/idna10.0.0.go index 5208ba6cb8..7e69ee1b22 100644 --- a/test/vendor/golang.org/x/net/idna/idna10.0.0.go +++ b/test/vendor/golang.org/x/net/idna/idna10.0.0.go @@ -67,14 +67,15 @@ func Transitional(transitional bool) Option { // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts // are longer than allowed by the RFC. -// -// This option corresponds to the VerifyDnsLength flag in UTS #46. func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } // RemoveLeadingDots removes leading label separators. Leading runes that map to // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. +// +// This is the behavior suggested by the UTS #46 and is adopted by some +// browsers. func RemoveLeadingDots(remove bool) Option { return func(o *options) { o.removeLeadingDots = remove } } @@ -82,8 +83,6 @@ func RemoveLeadingDots(remove bool) Option { // ValidateLabels sets whether to check the mandatory label validation criteria // as defined in Section 5.4 of RFC 5891. This includes testing for correct use // of hyphens ('-'), normalization, validity of runes, and the context rules. -// In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags -// in UTS #46. func ValidateLabels(enable bool) Option { return func(o *options) { // Don't override existing mappings, but set one that at least checks @@ -92,48 +91,25 @@ func ValidateLabels(enable bool) Option { o.mapping = normalize } o.trie = trie - o.checkJoiners = enable - o.checkHyphens = enable - if enable { - o.fromPuny = validateFromPunycode - } else { - o.fromPuny = nil - } - } -} - -// CheckHyphens sets whether to check for correct use of hyphens ('-') in -// labels. Most web browsers do not have this option set, since labels such as -// "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. -// -// This option corresponds to the CheckHyphens flag in UTS #46. -func CheckHyphens(enable bool) Option { - return func(o *options) { o.checkHyphens = enable } -} - -// CheckJoiners sets whether to check the ContextJ rules as defined in Appendix -// A of RFC 5892, concerning the use of joiner runes. -// -// This option corresponds to the CheckJoiners flag in UTS #46. -func CheckJoiners(enable bool) Option { - return func(o *options) { - o.trie = trie - o.checkJoiners = enable + o.validateLabels = enable + o.fromPuny = validateFromPunycode } } // StrictDomainName limits the set of permissible ASCII characters to those // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration, -// but is only useful if ValidateLabels is set. +// hyphen). This is set by default for MapForLookup and ValidateForRegistration. // // This option is useful, for instance, for browsers that allow characters // outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details. -// -// This option corresponds to the UseSTD3ASCIIRules flag in UTS #46. +// http://www.rfc-editor.org/std/std3.txt for more details This option +// corresponds to the UseSTD3ASCIIRules option in UTS #46. func StrictDomainName(use bool) Option { - return func(o *options) { o.useSTD3Rules = use } + return func(o *options) { + o.trie = trie + o.useSTD3Rules = use + o.fromPuny = validateFromPunycode + } } // NOTE: the following options pull in tables. The tables should not be linked @@ -141,8 +117,6 @@ func StrictDomainName(use bool) Option { // BidiRule enables the Bidi rule as defined in RFC 5893. Any application // that relies on proper validation of labels should include this rule. -// -// This option corresponds to the CheckBidi flag in UTS #46. func BidiRule() Option { return func(o *options) { o.bidirule = bidirule.ValidString } } @@ -178,8 +152,7 @@ func MapForLookup() Option { type options struct { transitional bool useSTD3Rules bool - checkHyphens bool - checkJoiners bool + validateLabels bool verifyDNSLength bool removeLeadingDots bool @@ -252,11 +225,8 @@ func (p *Profile) String() string { if p.useSTD3Rules { s += ":UseSTD3Rules" } - if p.checkHyphens { - s += ":CheckHyphens" - } - if p.checkJoiners { - s += ":CheckJoiners" + if p.validateLabels { + s += ":ValidateLabels" } if p.verifyDNSLength { s += ":VerifyDNSLength" @@ -284,29 +254,26 @@ var ( punycode = &Profile{} lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, + transitional: true, + useSTD3Rules: true, + validateLabels: true, + trie: trie, + fromPuny: validateFromPunycode, + mapping: validateAndMap, + bidirule: bidirule.ValidString, }} display = &Profile{options{ - useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, + useSTD3Rules: true, + validateLabels: true, + trie: trie, + fromPuny: validateFromPunycode, + mapping: validateAndMap, + bidirule: bidirule.ValidString, }} registration = &Profile{options{ useSTD3Rules: true, + validateLabels: true, verifyDNSLength: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateRegistration, @@ -373,7 +340,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { } isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight labels.set(u) - if err == nil && p.fromPuny != nil { + if err == nil && p.validateLabels { err = p.fromPuny(p, u) } if err == nil { @@ -714,18 +681,16 @@ func (p *Profile) validateLabel(s string) (err error) { } return nil } - if p.checkHyphens { - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - } - if !p.checkJoiners { + if !p.validateLabels { return nil } - trie := p.trie // p.checkJoiners is only set if trie is set. + trie := p.trie // p.validateLabels is only set if trie is set. + if len(s) > 4 && s[2] == '-' && s[3] == '-' { + return &labelError{s, "V2"} + } + if s[0] == '-' || s[len(s)-1] == '-' { + return &labelError{s, "V3"} + } // TODO: merge the use of this in the trie. v, sz := trie.lookupString(s) x := info(v) diff --git a/test/vendor/golang.org/x/net/idna/idna9.0.0.go b/test/vendor/golang.org/x/net/idna/idna9.0.0.go index 55f718f127..7c7456374c 100644 --- a/test/vendor/golang.org/x/net/idna/idna9.0.0.go +++ b/test/vendor/golang.org/x/net/idna/idna9.0.0.go @@ -66,14 +66,15 @@ func Transitional(transitional bool) Option { // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts // are longer than allowed by the RFC. -// -// This option corresponds to the VerifyDnsLength flag in UTS #46. func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } // RemoveLeadingDots removes leading label separators. Leading runes that map to // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. +// +// This is the behavior suggested by the UTS #46 and is adopted by some +// browsers. func RemoveLeadingDots(remove bool) Option { return func(o *options) { o.removeLeadingDots = remove } } @@ -81,8 +82,6 @@ func RemoveLeadingDots(remove bool) Option { // ValidateLabels sets whether to check the mandatory label validation criteria // as defined in Section 5.4 of RFC 5891. This includes testing for correct use // of hyphens ('-'), normalization, validity of runes, and the context rules. -// In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags -// in UTS #46. func ValidateLabels(enable bool) Option { return func(o *options) { // Don't override existing mappings, but set one that at least checks @@ -91,48 +90,25 @@ func ValidateLabels(enable bool) Option { o.mapping = normalize } o.trie = trie - o.checkJoiners = enable - o.checkHyphens = enable - if enable { - o.fromPuny = validateFromPunycode - } else { - o.fromPuny = nil - } - } -} - -// CheckHyphens sets whether to check for correct use of hyphens ('-') in -// labels. Most web browsers do not have this option set, since labels such as -// "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. -// -// This option corresponds to the CheckHyphens flag in UTS #46. -func CheckHyphens(enable bool) Option { - return func(o *options) { o.checkHyphens = enable } -} - -// CheckJoiners sets whether to check the ContextJ rules as defined in Appendix -// A of RFC 5892, concerning the use of joiner runes. -// -// This option corresponds to the CheckJoiners flag in UTS #46. -func CheckJoiners(enable bool) Option { - return func(o *options) { - o.trie = trie - o.checkJoiners = enable + o.validateLabels = enable + o.fromPuny = validateFromPunycode } } // StrictDomainName limits the set of permissable ASCII characters to those // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration, -// but is only useful if ValidateLabels is set. +// hyphen). This is set by default for MapForLookup and ValidateForRegistration. // // This option is useful, for instance, for browsers that allow characters // outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details. -// -// This option corresponds to the UseSTD3ASCIIRules flag in UTS #46. +// http://www.rfc-editor.org/std/std3.txt for more details This option +// corresponds to the UseSTD3ASCIIRules option in UTS #46. func StrictDomainName(use bool) Option { - return func(o *options) { o.useSTD3Rules = use } + return func(o *options) { + o.trie = trie + o.useSTD3Rules = use + o.fromPuny = validateFromPunycode + } } // NOTE: the following options pull in tables. The tables should not be linked @@ -140,8 +116,6 @@ func StrictDomainName(use bool) Option { // BidiRule enables the Bidi rule as defined in RFC 5893. Any application // that relies on proper validation of labels should include this rule. -// -// This option corresponds to the CheckBidi flag in UTS #46. func BidiRule() Option { return func(o *options) { o.bidirule = bidirule.ValidString } } @@ -178,8 +152,7 @@ func MapForLookup() Option { type options struct { transitional bool useSTD3Rules bool - checkHyphens bool - checkJoiners bool + validateLabels bool verifyDNSLength bool removeLeadingDots bool @@ -252,11 +225,8 @@ func (p *Profile) String() string { if p.useSTD3Rules { s += ":UseSTD3Rules" } - if p.checkHyphens { - s += ":CheckHyphens" - } - if p.checkJoiners { - s += ":CheckJoiners" + if p.validateLabels { + s += ":ValidateLabels" } if p.verifyDNSLength { s += ":VerifyDNSLength" @@ -285,10 +255,9 @@ var ( punycode = &Profile{} lookup = &Profile{options{ transitional: true, - removeLeadingDots: true, useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, + validateLabels: true, + removeLeadingDots: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateAndMap, @@ -296,9 +265,8 @@ var ( }} display = &Profile{options{ useSTD3Rules: true, + validateLabels: true, removeLeadingDots: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateAndMap, @@ -306,9 +274,8 @@ var ( }} registration = &Profile{options{ useSTD3Rules: true, + validateLabels: true, verifyDNSLength: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateRegistration, @@ -372,7 +339,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { continue } labels.set(u) - if err == nil && p.fromPuny != nil { + if err == nil && p.validateLabels { err = p.fromPuny(p, u) } if err == nil { @@ -662,18 +629,16 @@ func (p *Profile) validateLabel(s string) error { if p.bidirule != nil && !p.bidirule(s) { return &labelError{s, "B"} } - if p.checkHyphens { - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - } - if !p.checkJoiners { + if !p.validateLabels { return nil } - trie := p.trie // p.checkJoiners is only set if trie is set. + trie := p.trie // p.validateLabels is only set if trie is set. + if len(s) > 4 && s[2] == '-' && s[3] == '-' { + return &labelError{s, "V2"} + } + if s[0] == '-' || s[len(s)-1] == '-' { + return &labelError{s, "V3"} + } // TODO: merge the use of this in the trie. v, sz := trie.lookupString(s) x := info(v) diff --git a/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go b/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go index 8a7392c4a1..e4c62289f9 100644 --- a/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +++ b/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.10 // +build go1.10 package bidirule diff --git a/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go b/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go index bb0a920018..02b9e1e9d4 100644 --- a/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +++ b/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.10 // +build !go1.10 package bidirule diff --git a/test/vendor/golang.org/x/text/unicode/bidi/bidi.go b/test/vendor/golang.org/x/text/unicode/bidi/bidi.go index fd057601bd..e8edc54cc2 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/bidi.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/bidi.go @@ -12,14 +12,15 @@ // and without notice. package bidi // import "golang.org/x/text/unicode/bidi" -// TODO +// TODO: +// The following functionality would not be hard to implement, but hinges on +// the definition of a Segmenter interface. For now this is up to the user. +// - Iterate over paragraphs +// - Segmenter to iterate over runs directly from a given text. +// Also: // - Transformer for reordering? // - Transformer (validator, really) for Bidi Rule. -import ( - "bytes" -) - // This API tries to avoid dealing with embedding levels for now. Under the hood // these will be computed, but the question is to which extent the user should // know they exist. We should at some point allow the user to specify an @@ -48,9 +49,7 @@ const ( Neutral ) -type options struct { - defaultDirection Direction -} +type options struct{} // An Option is an option for Bidi processing. type Option func(*options) @@ -67,62 +66,12 @@ type Option func(*options) // DefaultDirection sets the default direction for a Paragraph. The direction is // overridden if the text contains directional characters. func DefaultDirection(d Direction) Option { - return func(opts *options) { - opts.defaultDirection = d - } + panic("unimplemented") } // A Paragraph holds a single Paragraph for Bidi processing. type Paragraph struct { - p []byte - o Ordering - opts []Option - types []Class - pairTypes []bracketType - pairValues []rune - runes []rune - options options -} - -// Initialize the p.pairTypes, p.pairValues and p.types from the input previously -// set by p.SetBytes() or p.SetString(). Also limit the input up to (and including) a paragraph -// separator (bidi class B). -// -// The function p.Order() needs these values to be set, so this preparation could be postponed. -// But since the SetBytes and SetStrings functions return the length of the input up to the paragraph -// separator, the whole input needs to be processed anyway and should not be done twice. -// -// The function has the same return values as SetBytes() / SetString() -func (p *Paragraph) prepareInput() (n int, err error) { - p.runes = bytes.Runes(p.p) - bytecount := 0 - // clear slices from previous SetString or SetBytes - p.pairTypes = nil - p.pairValues = nil - p.types = nil - - for _, r := range p.runes { - props, i := LookupRune(r) - bytecount += i - cls := props.Class() - if cls == B { - return bytecount, nil - } - p.types = append(p.types, cls) - if props.IsOpeningBracket() { - p.pairTypes = append(p.pairTypes, bpOpen) - p.pairValues = append(p.pairValues, r) - } else if props.IsBracket() { - // this must be a closing bracket, - // since IsOpeningBracket is not true - p.pairTypes = append(p.pairTypes, bpClose) - p.pairValues = append(p.pairValues, r) - } else { - p.pairTypes = append(p.pairTypes, bpNone) - p.pairValues = append(p.pairValues, 0) - } - } - return bytecount, nil + // buffers } // SetBytes configures p for the given paragraph text. It replaces text @@ -131,150 +80,70 @@ func (p *Paragraph) prepareInput() (n int, err error) { // consumed from b including this separator. Error may be non-nil if options are // given. func (p *Paragraph) SetBytes(b []byte, opts ...Option) (n int, err error) { - p.p = b - p.opts = opts - return p.prepareInput() + panic("unimplemented") } -// SetString configures s for the given paragraph text. It replaces text -// previously set by SetBytes or SetString. If s contains a paragraph separator +// SetString configures p for the given paragraph text. It replaces text +// previously set by SetBytes or SetString. If b contains a paragraph separator // it will only process the first paragraph and report the number of bytes -// consumed from s including this separator. Error may be non-nil if options are +// consumed from b including this separator. Error may be non-nil if options are // given. func (p *Paragraph) SetString(s string, opts ...Option) (n int, err error) { - p.p = []byte(s) - p.opts = opts - return p.prepareInput() + panic("unimplemented") } // IsLeftToRight reports whether the principle direction of rendering for this // paragraphs is left-to-right. If this returns false, the principle direction // of rendering is right-to-left. func (p *Paragraph) IsLeftToRight() bool { - return p.Direction() == LeftToRight + panic("unimplemented") } // Direction returns the direction of the text of this paragraph. // // The direction may be LeftToRight, RightToLeft, Mixed, or Neutral. func (p *Paragraph) Direction() Direction { - return p.o.Direction() + panic("unimplemented") } -// TODO: what happens if the position is > len(input)? This should return an error. - // RunAt reports the Run at the given position of the input text. // // This method can be used for computing line breaks on paragraphs. func (p *Paragraph) RunAt(pos int) Run { - c := 0 - runNumber := 0 - for i, r := range p.o.runes { - c += len(r) - if pos < c { - runNumber = i - } - } - return p.o.Run(runNumber) -} - -func calculateOrdering(levels []level, runes []rune) Ordering { - var curDir Direction - - prevDir := Neutral - prevI := 0 - - o := Ordering{} - // lvl = 0,2,4,...: left to right - // lvl = 1,3,5,...: right to left - for i, lvl := range levels { - if lvl%2 == 0 { - curDir = LeftToRight - } else { - curDir = RightToLeft - } - if curDir != prevDir { - if i > 0 { - o.runes = append(o.runes, runes[prevI:i]) - o.directions = append(o.directions, prevDir) - o.startpos = append(o.startpos, prevI) - } - prevI = i - prevDir = curDir - } - } - o.runes = append(o.runes, runes[prevI:]) - o.directions = append(o.directions, prevDir) - o.startpos = append(o.startpos, prevI) - return o + panic("unimplemented") } // Order computes the visual ordering of all the runs in a Paragraph. func (p *Paragraph) Order() (Ordering, error) { - if len(p.types) == 0 { - return Ordering{}, nil - } - - for _, fn := range p.opts { - fn(&p.options) - } - lvl := level(-1) - if p.options.defaultDirection == RightToLeft { - lvl = 1 - } - para, err := newParagraph(p.types, p.pairTypes, p.pairValues, lvl) - if err != nil { - return Ordering{}, err - } - - levels := para.getLevels([]int{len(p.types)}) - - p.o = calculateOrdering(levels, p.runes) - return p.o, nil + panic("unimplemented") } // Line computes the visual ordering of runs for a single line starting and // ending at the given positions in the original text. func (p *Paragraph) Line(start, end int) (Ordering, error) { - lineTypes := p.types[start:end] - para, err := newParagraph(lineTypes, p.pairTypes[start:end], p.pairValues[start:end], -1) - if err != nil { - return Ordering{}, err - } - levels := para.getLevels([]int{len(lineTypes)}) - o := calculateOrdering(levels, p.runes[start:end]) - return o, nil + panic("unimplemented") } // An Ordering holds the computed visual order of runs of a Paragraph. Calling // SetBytes or SetString on the originating Paragraph invalidates an Ordering. // The methods of an Ordering should only be called by one goroutine at a time. -type Ordering struct { - runes [][]rune - directions []Direction - startpos []int -} +type Ordering struct{} // Direction reports the directionality of the runs. // // The direction may be LeftToRight, RightToLeft, Mixed, or Neutral. func (o *Ordering) Direction() Direction { - return o.directions[0] + panic("unimplemented") } // NumRuns returns the number of runs. func (o *Ordering) NumRuns() int { - return len(o.runes) + panic("unimplemented") } // Run returns the ith run within the ordering. func (o *Ordering) Run(i int) Run { - r := Run{ - runes: o.runes[i], - direction: o.directions[i], - startpos: o.startpos[i], - } - return r + panic("unimplemented") } // TODO: perhaps with options. @@ -286,19 +155,16 @@ func (o *Ordering) Run(i int) Run { // A Run is a continuous sequence of characters of a single direction. type Run struct { - runes []rune - direction Direction - startpos int } // String returns the text of the run in its original order. func (r *Run) String() string { - return string(r.runes) + panic("unimplemented") } // Bytes returns the text of the run in its original order. func (r *Run) Bytes() []byte { - return []byte(r.String()) + panic("unimplemented") } // TODO: methods for @@ -308,52 +174,25 @@ func (r *Run) Bytes() []byte { // Direction reports the direction of the run. func (r *Run) Direction() Direction { - return r.direction + panic("unimplemented") } -// Pos returns the position of the Run within the text passed to SetBytes or SetString of the +// Position of the Run within the text passed to SetBytes or SetString of the // originating Paragraph value. func (r *Run) Pos() (start, end int) { - return r.startpos, r.startpos + len(r.runes) - 1 + panic("unimplemented") } // AppendReverse reverses the order of characters of in, appends them to out, // and returns the result. Modifiers will still follow the runes they modify. // Brackets are replaced with their counterparts. func AppendReverse(out, in []byte) []byte { - ret := make([]byte, len(in)+len(out)) - copy(ret, out) - inRunes := bytes.Runes(in) - - for i, r := range inRunes { - prop, _ := LookupRune(r) - if prop.IsBracket() { - inRunes[i] = prop.reverseBracket(r) - } - } - - for i, j := 0, len(inRunes)-1; i < j; i, j = i+1, j-1 { - inRunes[i], inRunes[j] = inRunes[j], inRunes[i] - } - copy(ret[len(out):], string(inRunes)) - - return ret + panic("unimplemented") } // ReverseString reverses the order of characters in s and returns a new string. // Modifiers will still follow the runes they modify. Brackets are replaced with // their counterparts. func ReverseString(s string) string { - input := []rune(s) - li := len(input) - ret := make([]rune, li) - for i, r := range input { - prop, _ := LookupRune(r) - if prop.IsBracket() { - ret[li-i-1] = prop.reverseBracket(r) - } else { - ret[li-i-1] = r - } - } - return string(ret) + panic("unimplemented") } diff --git a/test/vendor/golang.org/x/text/unicode/bidi/core.go b/test/vendor/golang.org/x/text/unicode/bidi/core.go index e4c0811016..50deb6600a 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/core.go @@ -4,10 +4,7 @@ package bidi -import ( - "fmt" - "log" -) +import "log" // This implementation is a port based on the reference implementation found at: // https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/ @@ -100,20 +97,13 @@ type paragraph struct { // rune (suggested is the rune of the open bracket for opening and matching // close brackets, after normalization). The embedding levels are optional, but // may be supplied to encode embedding levels of styled text. -func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, levels level) (*paragraph, error) { - var err error - if err = validateTypes(types); err != nil { - return nil, err - } - if err = validatePbTypes(pairTypes); err != nil { - return nil, err - } - if err = validatePbValues(pairValues, pairTypes); err != nil { - return nil, err - } - if err = validateParagraphEmbeddingLevel(levels); err != nil { - return nil, err - } +// +// TODO: return an error. +func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, levels level) *paragraph { + validateTypes(types) + validatePbTypes(pairTypes) + validatePbValues(pairValues, pairTypes) + validateParagraphEmbeddingLevel(levels) p := ¶graph{ initialTypes: append([]Class(nil), types...), @@ -125,7 +115,7 @@ func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, lev resultTypes: append([]Class(nil), types...), } p.run() - return p, nil + return p } func (p *paragraph) Len() int { return len(p.initialTypes) } @@ -1011,61 +1001,58 @@ func typeForLevel(level level) Class { return R } -func validateTypes(types []Class) error { +// TODO: change validation to not panic + +func validateTypes(types []Class) { if len(types) == 0 { - return fmt.Errorf("types is null") + log.Panic("types is null") } for i, t := range types[:len(types)-1] { if t == B { - return fmt.Errorf("B type before end of paragraph at index: %d", i) + log.Panicf("B type before end of paragraph at index: %d", i) } } - return nil } -func validateParagraphEmbeddingLevel(embeddingLevel level) error { +func validateParagraphEmbeddingLevel(embeddingLevel level) { if embeddingLevel != implicitLevel && embeddingLevel != 0 && embeddingLevel != 1 { - return fmt.Errorf("illegal paragraph embedding level: %d", embeddingLevel) + log.Panicf("illegal paragraph embedding level: %d", embeddingLevel) } - return nil } -func validateLineBreaks(linebreaks []int, textLength int) error { +func validateLineBreaks(linebreaks []int, textLength int) { prev := 0 for i, next := range linebreaks { if next <= prev { - return fmt.Errorf("bad linebreak: %d at index: %d", next, i) + log.Panicf("bad linebreak: %d at index: %d", next, i) } prev = next } if prev != textLength { - return fmt.Errorf("last linebreak was %d, want %d", prev, textLength) + log.Panicf("last linebreak was %d, want %d", prev, textLength) } - return nil } -func validatePbTypes(pairTypes []bracketType) error { +func validatePbTypes(pairTypes []bracketType) { if len(pairTypes) == 0 { - return fmt.Errorf("pairTypes is null") + log.Panic("pairTypes is null") } for i, pt := range pairTypes { switch pt { case bpNone, bpOpen, bpClose: default: - return fmt.Errorf("illegal pairType value at %d: %v", i, pairTypes[i]) + log.Panicf("illegal pairType value at %d: %v", i, pairTypes[i]) } } - return nil } -func validatePbValues(pairValues []rune, pairTypes []bracketType) error { +func validatePbValues(pairValues []rune, pairTypes []bracketType) { if pairValues == nil { - return fmt.Errorf("pairValues is null") + log.Panic("pairValues is null") } if len(pairTypes) != len(pairValues) { - return fmt.Errorf("pairTypes is different length from pairValues") + log.Panic("pairTypes is different length from pairValues") } - return nil } diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go index 42fa8d72ce..d8c94e1bd1 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go index 56a0e1ea21..16b11db538 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go index baacf32b43..647f2d4279 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go index f248effae1..c937d0976f 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.16 // +build go1.16 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go index f517fdb202..0ca0193ebe 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index f5a0788277..26fbd55a12 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go index cb7239c437..2c58f09baa 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go index 11b2733001..7e1ae096e5 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go index 96a130d30e..9ea1b42140 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.16 // +build go1.16 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 0175eae50a..9429069291 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package norm diff --git a/test/vendor/modules.txt b/test/vendor/modules.txt index 1cf0218fda..cb8f330aeb 100644 --- a/test/vendor/modules.txt +++ b/test/vendor/modules.txt @@ -6,7 +6,7 @@ github.com/Microsoft/go-winio/pkg/guid github.com/Microsoft/go-winio/pkg/process github.com/Microsoft/go-winio/pkg/security github.com/Microsoft/go-winio/vhd -# github.com/Microsoft/hcsshim v0.8.23 => ../ +# github.com/Microsoft/hcsshim v0.9.1 => ../ ## explicit github.com/Microsoft/hcsshim github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options @@ -242,7 +242,7 @@ go.opencensus.io/trace go.opencensus.io/trace/internal go.opencensus.io/trace/propagation go.opencensus.io/trace/tracestate -# golang.org/x/net v0.0.0-20210825183410-e898025ed96a +# golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 golang.org/x/net/context/ctxhttp golang.org/x/net/http/httpguts golang.org/x/net/http2 @@ -262,7 +262,7 @@ golang.org/x/sys/windows golang.org/x/sys/windows/registry golang.org/x/sys/windows/svc golang.org/x/sys/windows/svc/mgr -# golang.org/x/text v0.3.6 +# golang.org/x/text v0.3.4 golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi diff --git a/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go new file mode 100644 index 0000000000..38dc837c6e --- /dev/null +++ b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go @@ -0,0 +1,4 @@ +package manifest + +// This is so that tests can include the .syso to manifest them to pick up the right Windows build +// TODO: Auto-generation of the .syso through rsrc or similar. diff --git a/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso new file mode 100644 index 0000000000..0e9857245b Binary files /dev/null and b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso differ diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go index 4e6c4b2362..82da6c6a89 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go @@ -21,6 +21,9 @@ import "github.com/opencontainers/image-spec/specs-go" type Index struct { specs.Versioned + // MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json` + MediaType string `json:"mediaType,omitempty"` + // Manifests references platform specific manifests. Manifests []Descriptor `json:"manifests"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go index 7ff32c40ba..d72d15ce4b 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go @@ -20,6 +20,9 @@ import "github.com/opencontainers/image-spec/specs-go" type Manifest struct { specs.Versioned + // MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json` + MediaType string `json:"mediaType,omitempty"` + // Config references a configuration object for a container, by digest. // The referenced configuration object is a JSON blob that the runtime uses to set up the container. Config Descriptor `json:"config"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index 5d493df233..0d9543f160 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -22,7 +22,7 @@ const ( // VersionMinor is for functionality in a backwards-compatible manner VersionMinor = 0 // VersionPatch is for backwards-compatible bug fixes - VersionPatch = 1 + VersionPatch = 2 // VersionDev indicates development branch. Releases will be empty string. VersionDev = "" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9ee12f8ef4..fa4e850327 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,6 +9,8 @@ github.com/Microsoft/go-winio/pkg/guid github.com/Microsoft/go-winio/pkg/process github.com/Microsoft/go-winio/pkg/security github.com/Microsoft/go-winio/vhd +# github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 => ./test +github.com/Microsoft/hcsshim/test/testutil/manifest # github.com/cenkalti/backoff/v4 v4.1.1 github.com/cenkalti/backoff/v4 # github.com/containerd/cgroups v1.0.1 @@ -113,7 +115,7 @@ github.com/mattn/go-shellwords github.com/moby/sys/mountinfo # github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/go-digest -# github.com/opencontainers/image-spec v1.0.1 +# github.com/opencontainers/image-spec v1.0.2 github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 # github.com/opencontainers/runc v1.0.2