From cf61374e856e098344f0eb35183497e00f97c455 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 23 Apr 2020 19:24:36 -0400 Subject: [PATCH 1/2] bump(*): Pick up changes to onsi/ginkgo for stack traces on panic The performance fix for ginkgo hides stack traces - pick up the fix from the upstream. --- .../github.com/certifi/gocertifi/.travis.yml | 13 - vendor/github.com/certifi/gocertifi/LICENSE | 376 +------ vendor/github.com/certifi/gocertifi/README.md | 20 +- .../github.com/certifi/gocertifi/certifi.go | 625 +++-------- .../certifi/gocertifi/certifi_test.go | 8 +- vendor/github.com/certifi/gocertifi/gen.go | 39 +- vendor/github.com/certifi/gocertifi/go.mod | 3 - .../containerd/continuity/.travis.yml | 28 +- .../github.com/containerd/continuity/Makefile | 41 +- .../containerd/continuity/fs/copy.go | 4 - .../containerd/continuity/fs/copy_linux.go | 5 +- .../containerd/continuity/fs/copy_unix.go | 2 +- .../fs/{stat_darwinfreebsd.go => stat_bsd.go} | 0 .../{stat_linuxopenbsd.go => stat_linux.go} | 2 - .../github.com/containerd/continuity/go.mod | 23 - .../github.com/containerd/continuity/go.sum | 57 - .../containerd/continuity/sysx/nodata_unix.go | 2 +- .../containerd/continuity/sysx/xattr.go | 68 +- .../containerd/continuity/vendor.conf | 13 + .../fsouza/go-dockerclient/.gitattributes | 1 - .../fsouza/go-dockerclient/.github/stale.yml | 9 - .../.github/workflows/main.yml | 55 - .../fsouza/go-dockerclient/.golangci.yaml | 30 - .../fsouza/go-dockerclient/.travis.yml | 32 + .../github.com/fsouza/go-dockerclient/AUTHORS | 25 - .../github.com/fsouza/go-dockerclient/LICENSE | 19 +- .../fsouza/go-dockerclient/Makefile | 34 +- .../{README.md => README.markdown} | 70 +- .../fsouza/go-dockerclient/appveyor.yml | 20 + .../github.com/fsouza/go-dockerclient/auth.go | 84 +- .../fsouza/go-dockerclient/auth_test.go | 88 +- .../fsouza/go-dockerclient/build_test.go | 7 +- .../fsouza/go-dockerclient/change_test.go | 12 +- .../fsouza/go-dockerclient/client.go | 174 +--- .../go-dockerclient/client_stress_test.go | 13 +- .../fsouza/go-dockerclient/client_test.go | 289 ++---- .../fsouza/go-dockerclient/client_unix.go | 18 +- .../go-dockerclient/client_unix_test.go | 4 +- .../fsouza/go-dockerclient/client_windows.go | 19 +- .../go-dockerclient/client_windows_test.go | 4 +- .../fsouza/go-dockerclient/container.go | 175 ++-- .../fsouza/go-dockerclient/container_test.go | 546 +++++----- .../go-dockerclient/container_unix_test.go | 34 - .../fsouza/go-dockerclient/distribution.go | 3 +- .../go-dockerclient/distribution_test.go | 4 - .../github.com/fsouza/go-dockerclient/env.go | 2 +- .../fsouza/go-dockerclient/env_test.go | 205 ++-- .../fsouza/go-dockerclient/event.go | 25 +- .../fsouza/go-dockerclient/event_test.go | 4 +- .../fsouza/go-dockerclient/example_test.go | 5 +- .../github.com/fsouza/go-dockerclient/exec.go | 32 +- .../fsouza/go-dockerclient/exec_test.go | 82 +- .../github.com/fsouza/go-dockerclient/go.mod | 23 - .../github.com/fsouza/go-dockerclient/go.sum | 185 ---- .../fsouza/go-dockerclient/helpers_test.go | 54 - .../fsouza/go-dockerclient/image.go | 170 ++- .../fsouza/go-dockerclient/image_test.go | 67 +- .../go-dockerclient/integration_test.go | 75 +- .../go-dockerclient/integration_unix_test.go | 18 - .../integration_windows_test.go | 17 - .../github.com/fsouza/go-dockerclient/misc.go | 50 +- .../fsouza/go-dockerclient/misc_test.go | 60 +- .../fsouza/go-dockerclient/network.go | 38 +- .../fsouza/go-dockerclient/network_test.go | 18 +- .../{swarm_node.go => node.go} | 10 +- .../{swarm_node_test.go => node_test.go} | 25 +- .../fsouza/go-dockerclient/plugin.go | 460 -------- .../fsouza/go-dockerclient/plugin_test.go | 371 ------- .../fsouza/go-dockerclient/registry_auth.go | 10 - .../{swarm_service.go => service.go} | 30 +- ...{swarm_service_test.go => service_test.go} | 77 +- .../fsouza/go-dockerclient/swarm.go | 12 +- .../fsouza/go-dockerclient/swarm_configs.go | 171 --- .../go-dockerclient/swarm_configs_test.go | 242 ----- .../fsouza/go-dockerclient/swarm_secrets.go | 171 --- .../go-dockerclient/swarm_secrets_test.go | 276 ----- .../fsouza/go-dockerclient/swarm_test.go | 19 +- .../fsouza/go-dockerclient/system.go | 73 -- .../fsouza/go-dockerclient/system_test.go | 108 -- .../github.com/fsouza/go-dockerclient/tar.go | 15 +- .../{swarm_task.go => task.go} | 6 +- .../{swarm_task_test.go => task_test.go} | 15 +- .../fsouza/go-dockerclient/testing/server.go | 411 +++----- .../go-dockerclient/testing/server_test.go | 978 +++++++----------- .../fsouza/go-dockerclient/testing/swarm.go | 37 +- .../go-dockerclient/testing/swarm_test.go | 156 ++- .../github.com/fsouza/go-dockerclient/tls.go | 15 +- .../travis-scripts/install-docker.bash | 18 + .../travis-scripts/run-tests.bash | 11 + .../fsouza/go-dockerclient/volume.go | 57 +- .../fsouza/go-dockerclient/volume_test.go | 47 +- .../github.com/getsentry/raven-go/README.md | 7 - .../github.com/getsentry/raven-go/client.go | 22 +- .../getsentry/raven-go/client_test.go | 36 - .../gonum/graph/.github/ISSUE_TEMPLATE.md | 4 - .../graph/.github/PULL_REQUEST_TEMPLATE.md | 4 - vendor/github.com/gonum/graph/README.md | 4 +- .../gonum/graph/community/louvain_common.go | 3 - vendor/github.com/gonum/graph/doc.go | 3 - .../gonum/graph/encoding/dot/dot.go | 3 - .../gonum/graph/ex/fdpclust/main.go | 3 - .../gonum/graph/formats/dot/ast/ast.go | 3 - .../github.com/gonum/graph/formats/dot/dot.go | 3 - .../graph/formats/dot/internal/astx/astx.go | 3 - .../github.com/gonum/graph/graphs/gen/gen.go | 3 - .../gonum/graph/internal/linear/linear.go | 3 - .../gonum/graph/internal/ordered/sort.go | 3 - .../gonum/graph/internal/set/set.go | 3 - .../github.com/gonum/graph/network/network.go | 3 - vendor/github.com/gonum/graph/path/doc.go | 3 - .../gonum/graph/path/dynamic/doc.go | 3 - .../gonum/graph/path/internal/grid.go | 3 - .../github.com/gonum/graph/simple/simple.go | 3 - vendor/github.com/gonum/graph/topo/topo.go | 3 - .../gonum/graph/traverse/traverse.go | 3 - vendor/github.com/onsi/ginkgo/ginkgo_dsl.go | 4 +- .../internal/codelocation/code_location.go | 7 + .../onsi/ginkgo/internal/leafnodes/runner.go | 4 +- vendor/github.com/openshift/api/README.md | 6 +- .../openshift/api/build/v1/types.go | 8 +- ...config-operator_01_authentication.crd.yaml | 2 +- ...config-operator_01_infrastructure.crd.yaml | 154 ++- .../api/config/v1/types_authentication.go | 2 +- .../openshift/api/config/v1/types_feature.go | 1 + .../api/config/v1/types_features_test.go | 4 + .../api/config/v1/types_infrastructure.go | 129 +++ .../api/config/v1/zz_generated.deepcopy.go | 215 +++- .../v1/zz_generated.swagger_doc_generated.go | 106 +- vendor/github.com/openshift/api/go.mod | 6 +- vendor/github.com/openshift/api/go.sum | 12 +- ...ss-operator_00-ingresscontroller.crd.yaml} | 252 +++-- ..._00-ingresscontroller.crd.yaml-merge-patch | 20 + .../api/operator/v1/types_ingress.go | 131 +++ .../api/operator/v1/zz_generated.deepcopy.go | 101 ++ .../v1/zz_generated.swagger_doc_generated.go | 50 + .../openshift/apiserver-library-go/go.mod | 60 +- .../openshift/apiserver-library-go/go.sum | 99 +- vendor/github.com/openshift/client-go/go.mod | 8 +- vendor/github.com/openshift/client-go/go.sum | 10 +- vendor/github.com/openshift/library-go/go.mod | 16 +- vendor/github.com/openshift/library-go/go.sum | 25 +- .../pkg/apiserver/httprequest/httprequest.go | 2 +- .../pkg/controller/controllercmd/builder.go | 29 + .../pkg/controller/controllercmd/cmd.go | 1 + .../pkg/operator/certrotation/signer_test.go | 1 + .../pkg/operator/certrotation/target_test.go | 2 + .../controllers/state_controller_test.go | 1 + .../encryption/encryptionconfig/secret.go | 1 + .../operator/encryption/secrets/secrets.go | 1 + .../operator/encryption/testing/helpers.go | 1 + .../operator/resource/resourceapply/apps.go | 142 ++- .../operator/resource/resourceapply/core.go | 28 +- .../resource/resourceapply/core_test.go | 66 +- .../resourcesync_controller_test.go | 6 +- .../staticpodstate_controller.go | 27 +- .../library-go/test/library/metrics/query.go | 2 +- vendor/github.com/pkg/profile/.travis.yml | 2 +- vendor/github.com/pkg/profile/go.mod | 3 - vendor/github.com/pkg/profile/mutex.go | 13 + vendor/github.com/pkg/profile/mutex17.go | 9 + vendor/github.com/pkg/profile/profile.go | 29 +- vendor/github.com/pkg/profile/trace.go | 8 + vendor/github.com/pkg/profile/trace16.go | 10 + vendor/gopkg.in/asn1-ber.v1/.travis.yml | 8 +- vendor/gopkg.in/asn1-ber.v1/ber.go | 20 - vendor/gopkg.in/asn1-ber.v1/ber_test.go | 21 - vendor/gopkg.in/asn1-ber.v1/go.mod | 3 - .../pkg/util/proto/validation/types.go | 2 +- 168 files changed, 3452 insertions(+), 6598 deletions(-) delete mode 100644 vendor/github.com/certifi/gocertifi/.travis.yml delete mode 100644 vendor/github.com/certifi/gocertifi/go.mod rename vendor/github.com/containerd/continuity/fs/{stat_darwinfreebsd.go => stat_bsd.go} (100%) rename vendor/github.com/containerd/continuity/fs/{stat_linuxopenbsd.go => stat_linux.go} (97%) delete mode 100644 vendor/github.com/containerd/continuity/go.mod delete mode 100644 vendor/github.com/containerd/continuity/go.sum create mode 100644 vendor/github.com/containerd/continuity/vendor.conf delete mode 100644 vendor/github.com/fsouza/go-dockerclient/.gitattributes delete mode 100644 vendor/github.com/fsouza/go-dockerclient/.github/stale.yml delete mode 100644 vendor/github.com/fsouza/go-dockerclient/.github/workflows/main.yml delete mode 100644 vendor/github.com/fsouza/go-dockerclient/.golangci.yaml create mode 100644 vendor/github.com/fsouza/go-dockerclient/.travis.yml rename vendor/github.com/fsouza/go-dockerclient/{README.md => README.markdown} (52%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/appveyor.yml delete mode 100644 vendor/github.com/fsouza/go-dockerclient/go.mod delete mode 100644 vendor/github.com/fsouza/go-dockerclient/go.sum delete mode 100644 vendor/github.com/fsouza/go-dockerclient/helpers_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/integration_unix_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/integration_windows_test.go rename vendor/github.com/fsouza/go-dockerclient/{swarm_node.go => node.go} (91%) rename vendor/github.com/fsouza/go-dockerclient/{swarm_node_test.go => node_test.go} (90%) delete mode 100644 vendor/github.com/fsouza/go-dockerclient/plugin.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/plugin_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/registry_auth.go rename vendor/github.com/fsouza/go-dockerclient/{swarm_service.go => service.go} (89%) rename vendor/github.com/fsouza/go-dockerclient/{swarm_service_test.go => service_test.go} (89%) delete mode 100644 vendor/github.com/fsouza/go-dockerclient/swarm_configs.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/swarm_configs_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/swarm_secrets_test.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/system.go delete mode 100644 vendor/github.com/fsouza/go-dockerclient/system_test.go rename vendor/github.com/fsouza/go-dockerclient/{swarm_task.go => task.go} (91%) rename vendor/github.com/fsouza/go-dockerclient/{swarm_task_test.go => task_test.go} (96%) create mode 100755 vendor/github.com/fsouza/go-dockerclient/travis-scripts/install-docker.bash create mode 100755 vendor/github.com/fsouza/go-dockerclient/travis-scripts/run-tests.bash delete mode 100644 vendor/github.com/gonum/graph/.github/ISSUE_TEMPLATE.md delete mode 100644 vendor/github.com/gonum/graph/.github/PULL_REQUEST_TEMPLATE.md rename vendor/github.com/openshift/api/operator/v1/{0000_50_ingress-operator_00-custom-resource-definition.yaml => 0000_50_ingress-operator_00-ingresscontroller.crd.yaml} (87%) create mode 100644 vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml-merge-patch delete mode 100644 vendor/github.com/pkg/profile/go.mod create mode 100644 vendor/github.com/pkg/profile/mutex.go create mode 100644 vendor/github.com/pkg/profile/mutex17.go create mode 100644 vendor/github.com/pkg/profile/trace.go create mode 100644 vendor/github.com/pkg/profile/trace16.go delete mode 100644 vendor/gopkg.in/asn1-ber.v1/go.mod diff --git a/vendor/github.com/certifi/gocertifi/.travis.yml b/vendor/github.com/certifi/gocertifi/.travis.yml deleted file mode 100644 index c41119d55df3..000000000000 --- a/vendor/github.com/certifi/gocertifi/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -language: go -go: -- tip -- 1.12.x -- 1.11.x -- 1.10.x -- 1.9.x -- 1.8.x -sudo: false - -# Forks will use that path for checkout -go_import_path: github.com/certifi/gocertifi diff --git a/vendor/github.com/certifi/gocertifi/LICENSE b/vendor/github.com/certifi/gocertifi/LICENSE index 14e2f777f6c3..cfd5dcbbb157 100644 --- a/vendor/github.com/certifi/gocertifi/LICENSE +++ b/vendor/github.com/certifi/gocertifi/LICENSE @@ -1,373 +1,3 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. +This Source Code Form is subject to the terms of the Mozilla Public License, +v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain +one at http://mozilla.org/MPL/2.0/. diff --git a/vendor/github.com/certifi/gocertifi/README.md b/vendor/github.com/certifi/gocertifi/README.md index b392d35346e3..1c01b11021b6 100644 --- a/vendor/github.com/certifi/gocertifi/README.md +++ b/vendor/github.com/certifi/gocertifi/README.md @@ -9,14 +9,14 @@ This is the same CA bundle that ships with the Golang specific port of [certifi](https://github.com/kennethreitz/certifi). The CA bundle is derived from Mozilla's canonical set. -## Usage +## Usage You can use the `gocertifi` package as follows: ```go import "github.com/certifi/gocertifi" -certPool, err := gocertifi.CACerts() +cert_pool, err := gocertifi.CACerts() ``` You can use the returned `*x509.CertPool` as part of an HTTP transport, for example: @@ -29,22 +29,8 @@ import ( // Setup an HTTP client with a custom transport transport := &http.Transport{ - Proxy: ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - ForceAttemptHTTP2: true, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, + TLSClientConfig: &tls.Config{RootCAs: cert_pool}, } -// or, starting with go1.13 simply use: -// transport := http.DefaultTransport.(*http.Transport).Clone() - -transport.TLSClientConfig = &tls.Config{RootCAs: certPool} client := &http.Client{Transport: transport} // Make an HTTP request using our custom transport diff --git a/vendor/github.com/certifi/gocertifi/certifi.go b/vendor/github.com/certifi/gocertifi/certifi.go index a43244aaf5ef..edf32b45f043 100644 --- a/vendor/github.com/certifi/gocertifi/certifi.go +++ b/vendor/github.com/certifi/gocertifi/certifi.go @@ -1,12 +1,15 @@ -// Code generated by go generate; DO NOT EDIT. -// 2020-02-11 10:00:50.717122 -0800 PST m=+0.664468880 +// Code generated by go generate; DO NOT EDIT +// 2018-08-28 09:03:06.460975 -0700 PDT m=+0.705532595 // https://mkcert.org/generate/ package gocertifi -//go:generate go run gen.go "https://mkcert.org/generate/" +//go:generate go run gen.go -import "crypto/x509" +import ( + "crypto/x509" + "errors" +) const pemcerts string = ` @@ -337,6 +340,36 @@ OCiNUW7dFGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH QMAJKOSLakhT2+zNVVXxxvjpoixMptEmX36vWkzaH6byHCx+rgIW0lbQL1dTR+iS -----END CERTIFICATE----- +# Issuer: CN=Visa eCommerce Root O=VISA OU=Visa International Service Association +# Subject: CN=Visa eCommerce Root O=VISA OU=Visa International Service Association +# Label: "Visa eCommerce Root" +# Serial: 25952180776285836048024890241505565794 +# MD5 Fingerprint: fc:11:b8:d8:08:93:30:00:6d:23:f9:7e:eb:52:1e:02 +# SHA1 Fingerprint: 70:17:9b:86:8c:00:a4:fa:60:91:52:22:3f:9f:3e:32:bd:e0:05:62 +# SHA256 Fingerprint: 69:fa:c9:bd:55:fb:0a:c7:8d:53:bb:ee:5c:f1:d5:97:98:9f:d0:aa:ab:20:a2:51:51:bd:f1:73:3e:e7:d1:22 +-----BEGIN CERTIFICATE----- +MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBr +MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl +cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv +bW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2WhcNMjIwNjI0MDAxNjEyWjBrMQsw +CQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5h +dGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1l +cmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h +2mCxlCfLF9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4E +lpF7sDPwsRROEW+1QK8bRaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdV +ZqW1LS7YgFmypw23RuwhY/81q6UCzyr0TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq +299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI/k4+oKsGGelT84ATB+0t +vz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzsGHxBvfaL +dXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUF +AAOCAQEAX/FBfXxcCLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcR +zCSs00Rsca4BIGsDoo8Ytyk6feUWYFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3 +LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pzzkWKsKZJ/0x9nXGIxHYdkFsd +7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBuYQa7FkKMcPcw +++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt +398znM/jra6O1I7mT1GvFpLgXPYHDw== +-----END CERTIFICATE----- + # Issuer: CN=AAA Certificate Services O=Comodo CA Limited # Subject: CN=AAA Certificate Services O=Comodo CA Limited # Label: "Comodo AAA Services root" @@ -782,6 +815,36 @@ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep +OkuE6N36B9K -----END CERTIFICATE----- +# Issuer: CN=Class 2 Primary CA O=Certplus +# Subject: CN=Class 2 Primary CA O=Certplus +# Label: "Certplus Class 2 Primary CA" +# Serial: 177770208045934040241468760488327595043 +# MD5 Fingerprint: 88:2c:8c:52:b8:a2:3c:f3:f7:bb:03:ea:ae:ac:42:0b +# SHA1 Fingerprint: 74:20:74:41:72:9c:dd:92:ec:79:31:d8:23:10:8d:c2:81:92:e2:bb +# SHA256 Fingerprint: 0f:99:3c:8a:ef:97:ba:af:56:87:14:0e:d5:9a:d1:82:1b:b4:af:ac:f0:aa:9a:58:b5:d5:7a:33:8a:3a:fb:cb +-----BEGIN CERTIFICATE----- +MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAw +PTELMAkGA1UEBhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFz +cyAyIFByaW1hcnkgQ0EwHhcNOTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9 +MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2VydHBsdXMxGzAZBgNVBAMTEkNsYXNz +IDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANxQ +ltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR5aiR +VhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyL +kcAbmXuZVg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCd +EgETjdyAYveVqUSISnFOYFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yas +H7WLO7dDWWuwJKZtkIvEcupdM5i3y95ee++U8Rs+yskhwcWYAqqi9lt3m/V+llU0 +HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRMECDAGAQH/AgEKMAsGA1Ud +DwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJYIZIAYb4 +QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMu +Y29tL0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/ +AN9WM2K191EBkOvDP9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8 +yfFC82x/xXp8HVGIutIKPidd3i1RTtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMR +FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA +ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB +kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 +l7+ijrRU +-----END CERTIFICATE----- + # Issuer: CN=DST Root CA X3 O=Digital Signature Trust Co. # Subject: CN=DST Root CA X3 O=Digital Signature Trust Co. # Label: "DST Root CA X3" @@ -1200,6 +1263,36 @@ t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== -----END CERTIFICATE----- +# Issuer: CN=Deutsche Telekom Root CA 2 O=Deutsche Telekom AG OU=T-TeleSec Trust Center +# Subject: CN=Deutsche Telekom Root CA 2 O=Deutsche Telekom AG OU=T-TeleSec Trust Center +# Label: "Deutsche Telekom Root CA 2" +# Serial: 38 +# MD5 Fingerprint: 74:01:4a:91:b1:08:c4:58:ce:47:cd:f0:dd:11:53:08 +# SHA1 Fingerprint: 85:a4:08:c0:9c:19:3e:5d:51:58:7d:cd:d6:13:30:fd:8c:de:37:bf +# SHA256 Fingerprint: b6:19:1a:50:d0:c3:97:7f:7d:a9:9b:cd:aa:c8:6a:22:7d:ae:b9:67:9e:c7:0b:a3:b0:c9:d9:22:71:c1:70:d3 +-----BEGIN CERTIFICATE----- +MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEc +MBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2Vj +IFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENB +IDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5MjM1OTAwWjBxMQswCQYDVQQGEwJE +RTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxl +U2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290 +IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEU +ha88EOQ5bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhC +QN/Po7qCWWqSG6wcmtoIKyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1Mjwr +rFDa1sPeg5TKqAyZMg4ISFZbavva4VhYAUlfckE8FQYBjl2tqriTtM2e66foai1S +NNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aKSe5TBY8ZTNXeWHmb0moc +QqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTVjlsB9WoH +txa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAP +BgNVHRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC +AQEAlGRZrTlk5ynrE/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756Abrsp +tJh6sTtU6zkXR34ajgv8HzFZMQSyzhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpa +IzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8rZ7/gFnkm0W09juwzTkZmDLl +6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4Gdyd1Lx+4ivn+ +xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU +Cm26OWMohpLzGITY+9HPBVZkVw== +-----END CERTIFICATE----- + # Issuer: CN=Cybertrust Global Root O=Cybertrust, Inc # Subject: CN=Cybertrust Global Root O=Cybertrust, Inc # Label: "Cybertrust Global Root" @@ -2151,45 +2244,6 @@ t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 -----END CERTIFICATE----- -# Issuer: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes -# Subject: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes -# Label: "EC-ACC" -# Serial: -23701579247955709139626555126524820479 -# MD5 Fingerprint: eb:f5:9d:29:0d:61:f9:42:1f:7c:c2:ba:6d:e3:15:09 -# SHA1 Fingerprint: 28:90:3a:63:5b:52:80:fa:e6:77:4c:0b:6d:a7:d6:ba:a6:4a:f2:e8 -# SHA256 Fingerprint: 88:49:7f:01:60:2f:31:54:24:6a:e2:8c:4d:5a:ef:10:f1:d8:7e:bb:76:62:6f:4a:e0:b7:f9:5b:a7:96:87:99 ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB -8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy -dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1 -YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3 -dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh -IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD -LUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQG -EwJFUzE7MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8g -KE5JRiBRLTA4MDExNzYtSSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBD -ZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZlZ2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQu -bmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJhcnF1aWEgRW50aXRhdHMg -ZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUNDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R -85iKw5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm -4CgPukLjbo73FCeTae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaV -HMf5NLWUhdWZXqBIoH7nF2W4onW4HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNd -QlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0aE9jD2z3Il3rucO2n5nzbcc8t -lGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw0JDnJwIDAQAB -o4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4 -opvpXY0wfwYDVR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBo -dHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidW -ZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAwDQYJKoZIhvcN -AQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJlF7W2u++AVtd0x7Y -/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNaAl6k -SBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhy -Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS -Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl -nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI= ------END CERTIFICATE----- - # Issuer: CN=Hellenic Academic and Research Institutions RootCA 2011 O=Hellenic Academic and Research Institutions Cert. Authority # Subject: CN=Hellenic Academic and Research Institutions RootCA 2011 O=Hellenic Academic and Research Institutions Cert. Authority # Label: "Hellenic Academic and Research Institutions RootCA 2011" @@ -3443,6 +3497,46 @@ AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ 5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su -----END CERTIFICATE----- +# Issuer: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 +# Subject: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 +# Label: "Certinomis - Root CA" +# Serial: 1 +# MD5 Fingerprint: 14:0a:fd:8d:a8:28:b5:38:69:db:56:7e:61:22:03:3f +# SHA1 Fingerprint: 9d:70:bb:01:a5:a4:a0:18:11:2e:f7:1c:01:b9:32:c5:34:e7:88:a8 +# SHA256 Fingerprint: 2a:99:f5:bc:11:74:b7:3c:bb:1d:62:08:84:e0:1c:34:e5:1c:cb:39:78:da:12:5f:0e:33:26:88:83:bf:41:58 +-----BEGIN CERTIFICATE----- +MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjET +MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAb +BgNVBAMTFENlcnRpbm9taXMgLSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMz +MTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMx +FzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRDZXJ0aW5vbWlzIC0g +Um9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQosP5L2 +fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJfl +LieY6pOod5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQV +WZUKxkd8aRi5pwP5ynapz8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDF +TKWrteoB4owuZH9kb/2jJZOLyKIOSY008B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb +5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09xRLWtwHkziOC/7aOgFLSc +CbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE6OXWk6Ri +wsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJ +wx3tFvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SG +m/lg0h9tkQPTYKbVPZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4 +F2iw4lNVYC2vPsKD2NkJK/DAZNuHi5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZng +WVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I6tNxIqSSaHh0 +2TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF +AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/ +0KGRHCwPT5iVWVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWw +F6YSjNRieOpWauwK0kDDPAUwPk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZS +g081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAXlCOotQqSD7J6wWAsOMwaplv/8gzj +qh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJy29SWwNyhlCVCNSN +h4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9Iff/ +ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8V +btaw5BngDwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwj +Y/M50n92Uaf0yKHxDHYiI0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ +8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nMcyrDflOR1m749fPH0FFNjkulW+YZFzvW +gQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVrhkIGuUE= +-----END CERTIFICATE----- + # Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Label: "OISTE WISeKey Global Root GB CA" @@ -4219,445 +4313,18 @@ rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 -----END CERTIFICATE----- -# Issuer: CN=GTS Root R1 O=Google Trust Services LLC -# Subject: CN=GTS Root R1 O=Google Trust Services LLC -# Label: "GTS Root R1" -# Serial: 146587175971765017618439757810265552097 -# MD5 Fingerprint: 82:1a:ef:d4:d2:4a:f2:9f:e2:3d:97:06:14:70:72:85 -# SHA1 Fingerprint: e1:c9:50:e6:ef:22:f8:4c:56:45:72:8b:92:20:60:d7:d5:a7:a3:e8 -# SHA256 Fingerprint: 2a:57:54:71:e3:13:40:bc:21:58:1c:bd:2c:f1:3e:15:84:63:20:3e:ce:94:bc:f9:d3:cc:19:6b:f0:9a:54:72 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBH -MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM -QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy -MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl -cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM -f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vX -mX7wCl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7 -zUjwTcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0P -fyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtc -vfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4 -Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUsp -zBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOO -Rc92wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYW -k70paDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+ -DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgF -lQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBADiW -Cu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1 -d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6Z -XPYfcX3v73svfuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZR -gyFmxhE+885H7pwoHyXa/6xmld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3 -d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9bgsiG1eGZbYwE8na6SfZu6W0eX6Dv -J4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq4BjFbkerQUIpm/Zg -DdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWErtXvM -+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyy -F62ARPBopY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9 -SQ98POyDGCBDTtWTurQ0sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdws -E3PYJ/HQcu51OyLemGhmW/HGY0dVHLqlCFF1pkgl ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R2 O=Google Trust Services LLC -# Subject: CN=GTS Root R2 O=Google Trust Services LLC -# Label: "GTS Root R2" -# Serial: 146587176055767053814479386953112547951 -# MD5 Fingerprint: 44:ed:9a:0e:a4:09:3b:00:f2:ae:4c:a3:c6:61:b0:8b -# SHA1 Fingerprint: d2:73:96:2a:2a:5e:39:9f:73:3f:e1:c7:1e:64:3f:03:38:34:fc:4d -# SHA256 Fingerprint: c4:5d:7b:b0:8e:6d:67:e6:2e:42:35:11:0b:56:4e:5f:78:fd:92:ef:05:8c:84:0a:ea:4e:64:55:d7:58:5c:60 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBH -MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM -QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy -MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl -cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv -CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3Kg -GjSY6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9Bu -XvAuMC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOd -re7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXu -PuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1 -mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K -8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqj -x5RWIr9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsR -nTKaG73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0 -kzCqgc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9Ok -twIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBALZp -8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT -vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiT -z9D2PGcDFWEJ+YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiA -pJiS4wGWAqoC7o87xdFtCjMwc3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvb -pxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3DaWsYDQvTtN6LwG1BUSw7YhN4ZKJmB -R64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5rn/WkhLx3+WuXrD5R -RaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56GtmwfuNmsk -0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC -5AwiWVIQ7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiF -izoHCBy69Y9Vmhh1fuXsgWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLn -yOd/xCxgXS/Dr55FBcOEArf9LAhST4Ldo/DUhgkC ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R3 O=Google Trust Services LLC -# Subject: CN=GTS Root R3 O=Google Trust Services LLC -# Label: "GTS Root R3" -# Serial: 146587176140553309517047991083707763997 -# MD5 Fingerprint: 1a:79:5b:6b:04:52:9c:5d:c7:74:33:1b:25:9a:f9:25 -# SHA1 Fingerprint: 30:d4:24:6f:07:ff:db:91:89:8a:0b:e9:49:66:11:eb:8c:5e:46:e5 -# SHA256 Fingerprint: 15:d5:b8:77:46:19:ea:7d:54:ce:1c:a6:d0:b0:c4:03:e0:37:a9:17:f1:31:e8:a0:4e:1e:6b:7a:71:ba:bc:e5 ------BEGIN CERTIFICATE----- -MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout -736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2A -DDL24CejQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud -DgQWBBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFuk -fCPAlaUs3L6JbyO5o91lAFJekazInXJ0glMLfalAvWhgxeG4VDvBNhcl2MG9AjEA -njWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOaKaqW04MjyaR7YbPMAuhd ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R4 O=Google Trust Services LLC -# Subject: CN=GTS Root R4 O=Google Trust Services LLC -# Label: "GTS Root R4" -# Serial: 146587176229350439916519468929765261721 -# MD5 Fingerprint: 5d:b6:6a:c4:60:17:24:6a:1a:99:a8:4b:ee:5e:b4:26 -# SHA1 Fingerprint: 2a:1d:60:27:d9:4a:b1:0a:1c:4d:91:5c:cd:33:a0:cb:3e:2d:54:cb -# SHA256 Fingerprint: 71:cc:a5:39:1f:9e:79:4b:04:80:25:30:b3:63:e1:21:da:8a:30:43:bb:26:66:2f:ea:4d:ca:7f:c9:51:a4:bd ------BEGIN CERTIFICATE----- -MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu -hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/l -xKvRHYqjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud -DgQWBBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0 -CMRw3J5QdCHojXohw0+WbhXRIjVhLfoIN+4Zba3bssx9BzT1YBkstTTZbyACMANx -sbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11xzPKwTdb+mciUqXWi4w== ------END CERTIFICATE----- - -# Issuer: CN=UCA Global G2 Root O=UniTrust -# Subject: CN=UCA Global G2 Root O=UniTrust -# Label: "UCA Global G2 Root" -# Serial: 124779693093741543919145257850076631279 -# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 -# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a -# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH -bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x -CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds -b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr -b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 -kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm -VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R -VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc -C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj -tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY -D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv -j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl -NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 -iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP -O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV -ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj -L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 -1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl -1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU -b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV -PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj -y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb -EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg -DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI -+Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy -YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX -UB+K+wb1whnw0A== ------END CERTIFICATE----- - -# Issuer: CN=UCA Extended Validation Root O=UniTrust -# Subject: CN=UCA Extended Validation Root O=UniTrust -# Label: "UCA Extended Validation Root" -# Serial: 106100277556486529736699587978573607008 -# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 -# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a -# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF -eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx -MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV -BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog -D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS -sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop -O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk -sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi -c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj -VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz -KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ -TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G -sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs -1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD -fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN -l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR -ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ -VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 -c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp -4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s -t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj -2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO -vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C -xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx -cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM -fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax ------END CERTIFICATE----- - -# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Label: "Certigna Root CA" -# Serial: 269714418870597844693661054334862075617 -# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 -# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 -# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 ------BEGIN CERTIFICATE----- -MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw -WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw -MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x -MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD -VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX -BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO -ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M -CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu -I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm -TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh -C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf -ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz -IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT -Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k -JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 -hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB -GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of -1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov -L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo -dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr -aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq -hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L -6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG -HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 -0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB -lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi -o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 -gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v -faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 -Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh -jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw -3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign Root CA - G1" -# Serial: 235931866688319308814040 -# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac -# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c -# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 ------BEGIN CERTIFICATE----- -MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD -VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU -ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH -MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO -MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv -Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz -f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO -8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq -d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM -tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt -Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB -o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x -PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM -wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d -GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH -6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby -RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx -iN66zB+Afko= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign ECC Root CA - G3" -# Serial: 287880440101571086945156 -# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 -# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 -# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b ------BEGIN CERTIFICATE----- -MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG -EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo -bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g -RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ -TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s -b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw -djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 -WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS -fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB -zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq -hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB -CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD -+JbNR6iC8hZVdyR+EhCVBCyj ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Label: "emSign Root CA - C1" -# Serial: 825510296613316004955058 -# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 -# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 -# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG -A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg -SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v -dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ -BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ -HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH -3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH -GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c -xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 -aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq -TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 -/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 -kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG -YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT -+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo -WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Label: "emSign ECC Root CA - C3" -# Serial: 582948710642506000014504 -# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 -# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 -# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 ------BEGIN CERTIFICATE----- -MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG -EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx -IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND -IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci -MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti -sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O -BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB -Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c -3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J -0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== ------END CERTIFICATE----- - -# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Label: "Hongkong Post Root CA 3" -# Serial: 46170865288971385588281144162979347873371282084 -# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 -# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 -# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 ------BEGIN CERTIFICATE----- -MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL -BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ -SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n -a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 -NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT -CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u -Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO -dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI -VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV -9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY -2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY -vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt -bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb -x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ -l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK -TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj -Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e -i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw -DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG -7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk -MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr -gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk -GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS -3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm -Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ -l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c -JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP -L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa -LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG -mpv0 ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - G4" -# Serial: 289383649854506086828220374796556676440 -# MD5 Fingerprint: 89:53:f1:83:23:b7:7c:8e:05:f1:8c:71:38:4e:1f:88 -# SHA1 Fingerprint: 14:88:4e:86:26:37:b0:26:af:59:62:5c:40:77:ec:35:29:ba:96:01 -# SHA256 Fingerprint: db:35:17:d1:f6:73:2a:2d:5a:b9:7c:53:3e:c7:07:79:ee:32:70:a6:2f:b4:ac:42:38:37:24:60:e6:f0:1e:88 ------BEGIN CERTIFICATE----- -MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw -gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL -Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg -MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw -BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 -MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 -c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ -bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg -Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B -AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ -2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E -T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j -5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM -C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T -DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX -wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A -2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm -nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 -dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl -N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj -c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS -5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS -Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr -hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ -B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI -AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw -H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ -b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk -2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol -IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk -5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY -n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== ------END CERTIFICATE----- - ` -// CACerts builds an X.509 certificate pool containing the -// certificate bundle from https://mkcert.org/generate/ fetch on 2020-02-11 10:00:50.717122 -0800 PST m=+0.664468880. -// Returns nil on error along with an appropriate error code. +var ErrParseFailed = errors.New("gocertifi: error when parsing certificates") + +// CACerts builds an X.509 certificate pool containing the Mozilla CA +// Certificate bundle. Returns nil on error along with an appropriate error +// code. func CACerts() (*x509.CertPool, error) { pool := x509.NewCertPool() - pool.AppendCertsFromPEM([]byte(pemcerts)) + ok := pool.AppendCertsFromPEM([]byte(pemcerts)) + if !ok { + return nil, ErrParseFailed + } return pool, nil } diff --git a/vendor/github.com/certifi/gocertifi/certifi_test.go b/vendor/github.com/certifi/gocertifi/certifi_test.go index 955f7f25b94d..a071ad86aa07 100644 --- a/vendor/github.com/certifi/gocertifi/certifi_test.go +++ b/vendor/github.com/certifi/gocertifi/certifi_test.go @@ -1,14 +1,10 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - package gocertifi import "testing" func TestGetCerts(t *testing.T) { - certPool, err := CACerts() - if certPool == nil || err != nil || len(certPool.Subjects()) == 0 { + cert_pool, err := CACerts() + if (cert_pool == nil) || (err != nil) { t.Errorf("Failed to return the certificates.") } } diff --git a/vendor/github.com/certifi/gocertifi/gen.go b/vendor/github.com/certifi/gocertifi/gen.go index 589a9780e5fe..a3bbbd78951d 100644 --- a/vendor/github.com/certifi/gocertifi/gen.go +++ b/vendor/github.com/certifi/gocertifi/gen.go @@ -1,28 +1,18 @@ // +build ignore -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - package main import ( - "crypto/x509" "io/ioutil" "log" "net/http" "os" - "strings" "text/template" "time" ) func main() { - if len(os.Args) != 2 || !strings.HasPrefix(os.Args[1], "https://") { - log.Fatal("usage: go run gen.go ") - } - url := os.Args[1] - + const url = "https://mkcert.org/generate/" resp, err := http.Get(url) if err != nil { log.Fatal(err) @@ -34,11 +24,6 @@ func main() { bundle, err := ioutil.ReadAll(resp.Body) - pool := x509.NewCertPool() - if !pool.AppendCertsFromPEM(bundle) { - log.Fatalf("can't parse cerficiates from %s", url) - } - fp, err := os.Create("certifi.go") if err != nil { log.Fatal(err) @@ -56,26 +41,34 @@ func main() { }) } -var tmpl = template.Must(template.New("").Parse(`// Code generated by go generate; DO NOT EDIT. +var tmpl = template.Must(template.New("").Parse(`// Code generated by go generate; DO NOT EDIT // {{ .Timestamp }} // {{ .URL }} package gocertifi -//go:generate go run gen.go "{{ .URL }}" +//go:generate go run gen.go -import "crypto/x509" +import ( + "crypto/x509" + "errors" +) const pemcerts string = ` + "`" + ` {{ .Bundle }} ` + "`" + ` -// CACerts builds an X.509 certificate pool containing the -// certificate bundle from {{ .URL }} fetch on {{ .Timestamp }}. -// Returns nil on error along with an appropriate error code. +var ErrParseFailed = errors.New("gocertifi: error when parsing certificates") + +// CACerts builds an X.509 certificate pool containing the Mozilla CA +// Certificate bundle. Returns nil on error along with an appropriate error +// code. func CACerts() (*x509.CertPool, error) { pool := x509.NewCertPool() - pool.AppendCertsFromPEM([]byte(pemcerts)) + ok := pool.AppendCertsFromPEM([]byte(pemcerts)) + if !ok { + return nil, ErrParseFailed + } return pool, nil } `)) diff --git a/vendor/github.com/certifi/gocertifi/go.mod b/vendor/github.com/certifi/gocertifi/go.mod deleted file mode 100644 index 6d045a2aeacc..000000000000 --- a/vendor/github.com/certifi/gocertifi/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/certifi/gocertifi - -go 1.12 diff --git a/vendor/github.com/containerd/continuity/.travis.yml b/vendor/github.com/containerd/continuity/.travis.yml index 6248f031168d..c601f807e3b2 100644 --- a/vendor/github.com/containerd/continuity/.travis.yml +++ b/vendor/github.com/containerd/continuity/.travis.yml @@ -2,44 +2,32 @@ language: go sudo: required go: + - 1.9.x + - 1.10.x - 1.11.x - - 1.12.x - - 1.13.x - tip go_import_path: github.com/containerd/continuity env: - global: - - GO111MODULE=on - jobs: # NOTE: we cannot set GOOS directly (because gimme overrides the value) - TRAVIS_GOOS=windows - TRAVIS_GOOS=linux - TRAVIS_GOOS=darwin install: - - pushd / - - GO111MODULE=off go get -u github.com/vbatts/git-validation - - GO111MODULE=off go get -u github.com/kunalkushwaha/ltag - - popd + - go get -u github.com/vbatts/git-validation + - go get -u github.com/kunalkushwaha/ltag + - go get -u github.com/LK4D4/vndr before_script: - pushd ..; git clone https://github.com/containerd/project; popd script: - export GOOS=${TRAVIS_GOOS} + - DCO_VERBOSITY=-q ../project/script/validate/dco + - ../project/script/validate/fileheader ../project/ + - ../project/script/validate/vendor - make build binaries - if [ "$GOOS" = "linux" ]; then make vet test; fi - - if [ "$GOOS" = "linux" ]; then sudo PATH=$PATH GOPATH=$GOPATH make root-test; fi - if [ "$GOOS" != "linux" ]; then make test-compile; fi - -jobs: - include: - - stage: validate - script: - - DCO_VERBOSITY=-q ../project/script/validate/dco - - ../project/script/validate/fileheader ../project/ - - ../project/script/validate/vendor - go: 1.13.x - env: TRAVIS_GOOS=linux diff --git a/vendor/github.com/containerd/continuity/Makefile b/vendor/github.com/containerd/continuity/Makefile index d180c85856ea..c935b7680741 100644 --- a/vendor/github.com/containerd/continuity/Makefile +++ b/vendor/github.com/containerd/continuity/Makefile @@ -18,22 +18,11 @@ PREFIX?=$(shell pwd) # Used to populate version variable in main package. VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) -GO_LDFLAGS=-ldflags "-X `go list -mod=vendor ./version`.Version=$(VERSION)" - -PKG=github.com/containerd/continuity - -PACKAGES=$(shell go list -mod=vendor ./... | grep -v /vendor/) -TEST_REQUIRES_ROOT_PACKAGES=$(filter \ - ${PACKAGES}, \ - $(shell \ - for f in $$(git grep -l testutil.RequiresRoot | grep -v Makefile); do \ - d="$$(dirname $$f)"; \ - [ "$$d" = "." ] && echo "${PKG}" && continue; \ - echo "${PKG}/$$d"; \ - done | sort -u) \ - ) - -.PHONY: clean all fmt vet lint build test binaries +GO_LDFLAGS=-ldflags "-X `go list ./version`.Version=$(VERSION)" + +PACKAGES=$(shell go list ./... | grep -v /vendor/) + +.PHONY: clean all fmt vet lint build test binaries setup .DEFAULT: default # skip lint at the moment all: AUTHORS clean fmt vet fmt build test binaries @@ -47,16 +36,20 @@ version/version.go: ${PREFIX}/bin/continuity: version/version.go $(shell find . -type f -name '*.go') @echo "+ $@" - @go build -mod=vendor -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./cmd/continuity + @go build -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./cmd/continuity + +setup: + @echo "+ $@" + @go get -u github.com/golang/lint/golint generate: - go generate -mod=vendor $(PACKAGES) + go generate $(PACKAGES) # Depends on binaries because vet will silently fail if it can't load compiled # imports vet: binaries @echo "+ $@" - @go vet -mod=vendor $(PACKAGES) + @go vet $(PACKAGES) fmt: @echo "+ $@" @@ -69,19 +62,15 @@ lint: build: @echo "+ $@" - @go build -mod=vendor -v ${GO_LDFLAGS} $(PACKAGES) + @go build -v ${GO_LDFLAGS} $(PACKAGES) test: @echo "+ $@" - @go test -mod=vendor $(PACKAGES) - -root-test: - @echo "+ $@" - @go test ${TEST_REQUIRES_ROOT_PACKAGES} -test.root + @go test $(PACKAGES) test-compile: @echo "+ $@" - @for pkg in $(PACKAGES); do go test -mod=vendor -c $$pkg; done + @for pkg in $(PACKAGES); do go test -c $$pkg; done binaries: ${PREFIX}/bin/continuity @echo "+ $@" diff --git a/vendor/github.com/containerd/continuity/fs/copy.go b/vendor/github.com/containerd/continuity/fs/copy.go index 818bba2cda20..97053d7e5c47 100644 --- a/vendor/github.com/containerd/continuity/fs/copy.go +++ b/vendor/github.com/containerd/continuity/fs/copy.go @@ -104,10 +104,6 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er return errors.Wrapf(err, "failed to copy file info for %s", dst) } - if err := copyXAttrs(dst, src, o.xeh); err != nil { - return errors.Wrap(err, "failed to copy xattrs") - } - for _, fi := range fis { source := filepath.Join(src, fi.Name()) target := filepath.Join(dst, fi.Name()) diff --git a/vendor/github.com/containerd/continuity/fs/copy_linux.go b/vendor/github.com/containerd/continuity/fs/copy_linux.go index 72bae7d4e499..81c71522aa17 100644 --- a/vendor/github.com/containerd/continuity/fs/copy_linux.go +++ b/vendor/github.com/containerd/continuity/fs/copy_linux.go @@ -51,10 +51,7 @@ func copyFileInfo(fi os.FileInfo, name string) error { } } - timespec := []unix.Timespec{ - unix.NsecToTimespec(syscall.TimespecToNsec(StatAtime(st))), - unix.NsecToTimespec(syscall.TimespecToNsec(StatMtime(st))), - } + timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))} if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil { return errors.Wrapf(err, "failed to utime %s", name) } diff --git a/vendor/github.com/containerd/continuity/fs/copy_unix.go b/vendor/github.com/containerd/continuity/fs/copy_unix.go index a5de89261f62..73c01a46ddd7 100644 --- a/vendor/github.com/containerd/continuity/fs/copy_unix.go +++ b/vendor/github.com/containerd/continuity/fs/copy_unix.go @@ -1,4 +1,4 @@ -// +build darwin freebsd openbsd solaris +// +build solaris darwin freebsd /* Copyright The containerd Authors. diff --git a/vendor/github.com/containerd/continuity/fs/stat_darwinfreebsd.go b/vendor/github.com/containerd/continuity/fs/stat_bsd.go similarity index 100% rename from vendor/github.com/containerd/continuity/fs/stat_darwinfreebsd.go rename to vendor/github.com/containerd/continuity/fs/stat_bsd.go diff --git a/vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go b/vendor/github.com/containerd/continuity/fs/stat_linux.go similarity index 97% rename from vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go rename to vendor/github.com/containerd/continuity/fs/stat_linux.go index c68df6e586cd..4a678dd1fd46 100644 --- a/vendor/github.com/containerd/continuity/fs/stat_linuxopenbsd.go +++ b/vendor/github.com/containerd/continuity/fs/stat_linux.go @@ -1,5 +1,3 @@ -// +build linux openbsd - /* Copyright The containerd Authors. diff --git a/vendor/github.com/containerd/continuity/go.mod b/vendor/github.com/containerd/continuity/go.mod deleted file mode 100644 index 86a7f148cb1b..000000000000 --- a/vendor/github.com/containerd/continuity/go.mod +++ /dev/null @@ -1,23 +0,0 @@ -module github.com/containerd/continuity - -go 1.11 - -require ( - bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 - github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 - github.com/golang/protobuf v1.2.0 - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/onsi/ginkgo v1.10.1 // indirect - github.com/onsi/gomega v1.7.0 // indirect - github.com/opencontainers/go-digest v1.0.0-rc1 - github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7 - github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2 - github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee - github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95 // indirect - github.com/stretchr/testify v1.4.0 // indirect - golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3 // indirect - golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f - golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e - gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect - gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect -) diff --git a/vendor/github.com/containerd/continuity/go.sum b/vendor/github.com/containerd/continuity/go.sum deleted file mode 100644 index 97ef1d757c10..000000000000 --- a/vendor/github.com/containerd/continuity/go.sum +++ /dev/null @@ -1,57 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 h1:SC+c6A1qTFstO9qmB86mPV2IpYme/2ZoEQ0hrP+wo+Q= -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7 h1:RcqIXZDN7Vz5lgK7+0h3MFF2JNgEu4h91palXJLJ354= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2 h1:a07zp0wovcAE2jH+wlD22JLqUH6Rdl8Aon+NiyPxE+0= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee h1:GQkkv3XSnxhAMjdq2wLfEnptEVr+2BNvmHizILHn+d4= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95 h1:j8jxLbQ0+T1DFggy6XoGvyUnrJWPR/JybflPvu5rwS4= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3 h1:f4/ZD59VsBOaJmWeI2yqtHvJhmRRPzi73C88ZtfhAIk= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go b/vendor/github.com/containerd/continuity/sysx/nodata_unix.go index de4b3d50ceda..b26f5b3d0394 100644 --- a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go +++ b/vendor/github.com/containerd/continuity/sysx/nodata_unix.go @@ -1,4 +1,4 @@ -// +build darwin freebsd openbsd +// +build darwin freebsd /* Copyright The containerd Authors. diff --git a/vendor/github.com/containerd/continuity/sysx/xattr.go b/vendor/github.com/containerd/continuity/sysx/xattr.go index db6fe70fe927..9e4326dcfe3f 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr.go @@ -20,6 +20,7 @@ package sysx import ( "bytes" + "syscall" "golang.org/x/sys/unix" ) @@ -65,53 +66,60 @@ func LGetxattr(path, attr string) ([]byte, error) { return getxattrAll(path, attr, unix.Lgetxattr) } -const defaultXattrBufferSize = 128 +const defaultXattrBufferSize = 5 type listxattrFunc func(path string, dest []byte) (int, error) func listxattrAll(path string, listFunc listxattrFunc) ([]string, error) { - buf := make([]byte, defaultXattrBufferSize) - n, err := listFunc(path, buf) - for err == unix.ERANGE { - // Buffer too small, use zero-sized buffer to get the actual size - n, err = listFunc(path, []byte{}) + var p []byte // nil on first execution + + for { + n, err := listFunc(path, p) // first call gets buffer size. if err != nil { return nil, err } - buf = make([]byte, n) - n, err = listFunc(path, buf) - } - if err != nil { - return nil, err - } - ps := bytes.Split(bytes.TrimSuffix(buf[:n], []byte{0}), []byte{0}) - var entries []string - for _, p := range ps { - if len(p) > 0 { - entries = append(entries, string(p)) + if n > len(p) { + p = make([]byte, n) + continue + } + + p = p[:n] + + ps := bytes.Split(bytes.TrimSuffix(p, []byte{0}), []byte{0}) + var entries []string + for _, p := range ps { + s := string(p) + if s != "" { + entries = append(entries, s) + } } - } - return entries, nil + return entries, nil + } } type getxattrFunc func(string, string, []byte) (int, error) func getxattrAll(path, attr string, getFunc getxattrFunc) ([]byte, error) { - buf := make([]byte, defaultXattrBufferSize) - n, err := getFunc(path, attr, buf) - for err == unix.ERANGE { - // Buffer too small, use zero-sized buffer to get the actual size - n, err = getFunc(path, attr, []byte{}) + p := make([]byte, defaultXattrBufferSize) + for { + n, err := getFunc(path, attr, p) if err != nil { + if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERANGE { + p = make([]byte, len(p)*2) // this can't be ideal. + continue // try again! + } + return nil, err } - buf = make([]byte, n) - n, err = getFunc(path, attr, buf) - } - if err != nil { - return nil, err + + // realloc to correct size and repeat + if n > len(p) { + p = make([]byte, n) + continue + } + + return p[:n], nil } - return buf[:n], nil } diff --git a/vendor/github.com/containerd/continuity/vendor.conf b/vendor/github.com/containerd/continuity/vendor.conf new file mode 100644 index 000000000000..5bd88d5fd76d --- /dev/null +++ b/vendor/github.com/containerd/continuity/vendor.conf @@ -0,0 +1,13 @@ +bazil.org/fuse 371fbbdaa8987b715bdd21d6adc4c9b20155f748 +github.com/dustin/go-humanize bb3d318650d48840a39aa21a027c6630e198e626 +github.com/golang/protobuf 1e59b77b52bf8e4b449a57e6f79f21226d571845 +github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 +github.com/opencontainers/go-digest 279bed98673dd5bef374d3b6e4b09e2af76183bf +github.com/pkg/errors f15c970de5b76fac0b59abb32d62c17cc7bed265 +github.com/sirupsen/logrus 89742aefa4b206dcf400792f3bd35b542998eb3b +github.com/spf13/cobra 2da4a54c5ceefcee7ca5dd0eea1e18a3b6366489 +github.com/spf13/pflag 4c012f6dcd9546820e378d0bdda4d8fc772cdfea +golang.org/x/crypto 9f005a07e0d31d45e6656d241bb5c0f2efd4bc94 +golang.org/x/net a337091b0525af65de94df2eb7e98bd9962dcbe2 +golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c +golang.org/x/sys 77b0e4315053a57ed2962443614bdb28db152054 diff --git a/vendor/github.com/fsouza/go-dockerclient/.gitattributes b/vendor/github.com/fsouza/go-dockerclient/.gitattributes deleted file mode 100644 index 6313b56c5784..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto eol=lf diff --git a/vendor/github.com/fsouza/go-dockerclient/.github/stale.yml b/vendor/github.com/fsouza/go-dockerclient/.github/stale.yml deleted file mode 100644 index 47e004a09534..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/.github/stale.yml +++ /dev/null @@ -1,9 +0,0 @@ -daysUntilStale: 30 -daysUntilClose: 5 -exemptLabels: - - bug -staleLabel: stale -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. -closeComment: false diff --git a/vendor/github.com/fsouza/go-dockerclient/.github/workflows/main.yml b/vendor/github.com/fsouza/go-dockerclient/.github/workflows/main.yml deleted file mode 100644 index b5d679c1372a..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/.github/workflows/main.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - branches: - - master - schedule: - - cron: "0 0 * * 4" - -jobs: - test: - strategy: - matrix: - go_version: - - 1.13 - - 1.14 - os: - - macos - - ubuntu - - windows - goarch: - - 386 - - amd64 - exclude: - - os: macos - goarch: 386 - - name: test (${{ matrix.os }}/go-${{ matrix.go_version }}/${{ matrix.goarch }}) - runs-on: ${{ matrix.os }}-latest - steps: - - uses: actions/setup-go@master - id: go - with: - stable: false - go-version: ${{ matrix.go_version }} - - - uses: actions/checkout@master - - - run: go mod download - - - run: make lint - env: - GOFLAGS: -mod=readonly - - - run: make gotest - env: - GOARCH: ${{ matrix.goarch }} - GOPROXY: off - - - run: make integration - if: matrix.os != 'macos' && matrix.goarch == 'amd64' - env: - GOFLAGS: -mod=readonly diff --git a/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml b/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml deleted file mode 100644 index 3a21b76f7733..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml +++ /dev/null @@ -1,30 +0,0 @@ -run: - deadline: 5m - - skip-dirs: - - internal - -issues: - exclude-rules: - - path: _test\.go - linters: - - bodyclose - - goconst - - gosec - - scopelint - - path: testing[/\\].+\.go - linters: - - gosec - -linters: - enable-all: true - disable: - - dupl - - errcheck - - funlen - - gochecknoglobals - - gocognit - - goconst - - gomnd - - lll - - wsl diff --git a/vendor/github.com/fsouza/go-dockerclient/.travis.yml b/vendor/github.com/fsouza/go-dockerclient/.travis.yml new file mode 100644 index 000000000000..f8f29964dc93 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.travis.yml @@ -0,0 +1,32 @@ +language: go +sudo: required +go: + - 1.8.x + - 1.9.x + - tip +os: + - linux + - osx +env: + matrix: + - GOARCH=amd64 DOCKER_PKG_VERSION=17.06.0~ce-0~ubuntu + - GOARCH=386 DOCKER_PKG_VERSION=17.06.0~ce-0~ubuntu + - GOARCH=amd64 DOCKER_PKG_VERSION=17.05.0~ce-0~ubuntu-trusty + - GOARCH=386 DOCKER_PKG_VERSION=17.05.0~ce-0~ubuntu-trusty + global: + - GO_TEST_FLAGS=-race + - DOCKER_HOST=tcp://127.0.0.1:2375 +install: + - make testdeps + - travis_retry travis-scripts/install-docker.bash +script: + - travis-scripts/run-tests.bash +services: + - docker +matrix: + fast_finish: true + exclude: + - os: osx + env: GOARCH=amd64 DOCKER_PKG_VERSION=17.05.0~ce-0~ubuntu-trusty + - os: osx + env: GOARCH=386 DOCKER_PKG_VERSION=17.05.0~ce-0~ubuntu-trusty diff --git a/vendor/github.com/fsouza/go-dockerclient/AUTHORS b/vendor/github.com/fsouza/go-dockerclient/AUTHORS index 08f89afde5bd..c1c38d9a5ad4 100644 --- a/vendor/github.com/fsouza/go-dockerclient/AUTHORS +++ b/vendor/github.com/fsouza/go-dockerclient/AUTHORS @@ -2,9 +2,7 @@ Abhishek Chanda Adam Bell-Hanssen -Adnan Khan Adrien Kohlbecker -Aithal Aldrin Leal Alex Dadgar Alfonso Acosta @@ -15,7 +13,6 @@ Andrews Medina Andrey Sibiryov Andy Goldstein Anirudh Aithal -Antoine Brechon Antonio Murdaca Artem Sidorenko Arthur Rodrigues @@ -25,7 +22,6 @@ Ben Parees Benno van den Berg Bradley Cicenas Brendan Fosberry -Brett Buddin Brian Lalor Brian P. Hamachek Brian Palmer @@ -43,26 +39,20 @@ Chris Bednarski Chris Stavropoulos Christian Stewart Christophe Mourette -Clayton Coleman Clint Armstrong CMGS Colin Hebert Craig Jellick -Damien Lespiau Damon Wang Dan Williams Daniel, Dao Quang Minh -Daniel Black Daniel Garcia -Daniel Hess Daniel Hiltgen -Daniel Nephin Daniel Tsui Darren Shepherd Dave Choi David Huie Dawn Chen -Denis Makogon Derek Petersen Dinesh Subhraveti Drew Wells @@ -70,7 +60,6 @@ Ed Elias G. Schneevoigt Erez Horev Eric Anderson -Eric Fode Eric J. Holmes Eric Mountain Erwin van Eyk @@ -78,20 +67,17 @@ Ethan Mosbaugh Ewout Prangsma Fabio Rehm Fatih Arslan -Faye Salwin Felipe Oliveira Flavia Missi Florent Aide Francisco Souza Frank Groeneveld -George MacRorie George Moura Grégoire Delattre Guilherme Rezende Guillermo Álvarez Fernández Harry Zhang He Simei -Isaac Schnitzer Ivan Mikushin James Bardin James Nugent @@ -119,8 +105,6 @@ Kevin Xu Kim, Hirokuni Kostas Lekkas Kyle Allan -Kyle Quest -Yunhee Lee Liron Levin Lior Yankovich Liu Peng @@ -129,7 +113,6 @@ Lucas Clemente Lucas Weiblen Lyon Hill Mantas Matelis -Manuel Vogel Marguerite des Trois Maisons Mariusz Borsa Martin Sweeney @@ -139,7 +122,6 @@ Michal Fojtik Mike Dillon Mrunal Patel Nate Jones -Nathan Pemberton Nguyen Sy Thanh Son Nicholas Van Wiggeren Nick Ethier @@ -149,10 +131,8 @@ Orivej Desh Paul Bellamy Paul Morie Paul Weil -Peng Yin Peter Edge Peter Jihoon Kim -Peter Teich Phil Lu Philippe Lafoucrière Radek Simko @@ -170,7 +150,6 @@ Sam Rijs Sami Wagiaalla Samuel Archambault Samuel Karp -Sebastian Borza Seth Jennings Shane Xie Silas Sewell @@ -182,24 +161,20 @@ Sridhar Ratnakumar Steven Jack Summer Mousa Sunjin Lee -Sunny Swaroop Ramachandra Tarsis Azevedo Tim Schindler Timothy St. Clair Tobi Knaup Tom Wilkie -Tomas Knappek Tonic ttyh061 upccup Victor Marmol -Vijay Krishnan Vincenzo Prignano Vlad Alexandru Ionescu Weitao Zhou Wiliam Souza Ye Yin -Yosuke Otosu Yu, Zou Yuriy Bogdanov diff --git a/vendor/github.com/fsouza/go-dockerclient/LICENSE b/vendor/github.com/fsouza/go-dockerclient/LICENSE index 7a70a8c40742..545174c18f79 100644 --- a/vendor/github.com/fsouza/go-dockerclient/LICENSE +++ b/vendor/github.com/fsouza/go-dockerclient/LICENSE @@ -1,19 +1,18 @@ -Copyright (c) 2013-2020, go-dockerclient authors +Copyright (c) 2013-2017, go-dockerclient authors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR diff --git a/vendor/github.com/fsouza/go-dockerclient/Makefile b/vendor/github.com/fsouza/go-dockerclient/Makefile index bd38394646cb..483aa1bb4a2f 100644 --- a/vendor/github.com/fsouza/go-dockerclient/Makefile +++ b/vendor/github.com/fsouza/go-dockerclient/Makefile @@ -1,27 +1,41 @@ .PHONY: \ all \ lint \ + vet \ + fmt \ + fmtcheck \ pretest \ test \ - integration - - -ifeq "$(strip $(shell go env GOARCH))" "amd64" -RACE_FLAG := -race -endif + integration \ + clean all: test lint: - cd /tmp && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@latest - golangci-lint run + @ go get -v github.com/golang/lint/golint + [ -z "$$(golint . | grep -v 'type name will be used as docker.DockerInfo' | grep -v 'context.Context should be the first' | tee /dev/stderr)" ] + +vet: + go vet ./... + +fmt: + gofmt -s -w . -pretest: lint +fmtcheck: + [ -z "$$(gofmt -s -d . | tee /dev/stderr)" ] + +testdeps: + go get -d -t ./... + +pretest: testdeps lint vet fmtcheck gotest: - go test $(RACE_FLAG) -vet all ./... + go test $(GO_TEST_FLAGS) ./... test: pretest gotest integration: go test -tags docker_integration -run TestIntegration -v + +clean: + go clean ./... diff --git a/vendor/github.com/fsouza/go-dockerclient/README.md b/vendor/github.com/fsouza/go-dockerclient/README.markdown similarity index 52% rename from vendor/github.com/fsouza/go-dockerclient/README.md rename to vendor/github.com/fsouza/go-dockerclient/README.markdown index b44ff79a5eee..a9ffc17a0f63 100644 --- a/vendor/github.com/fsouza/go-dockerclient/README.md +++ b/vendor/github.com/fsouza/go-dockerclient/README.markdown @@ -1,35 +1,20 @@ # go-dockerclient -[![Build Status](https://github.com/fsouza/go-dockerclient/workflows/Build/badge.svg)](https://github.com/fsouza/go-dockerclient/actions?query=branch:master+workflow:Build) -[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/fsouza/go-dockerclient) +[![Travis Build Status](https://travis-ci.org/fsouza/go-dockerclient.svg?branch=master)](https://travis-ci.org/fsouza/go-dockerclient) +[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4m374pti06ubg2l7?svg=true)](https://ci.appveyor.com/project/fsouza/go-dockerclient) +[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/fsouza/go-dockerclient) This package presents a client for the Docker remote API. It also provides support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/). +It currently supports the Docker API up to version 1.23. This package also provides support for docker's network API, which is a simple -passthrough to the libnetwork remote API. +passthrough to the libnetwork remote API. Note that docker's network API is +only available in docker 1.8 and above, and only enabled in docker if +DOCKER_EXPERIMENTAL is defined during the docker build process. For more details, check the [remote API -documentation](https://docs.docker.com/engine/api/latest/). - -## Difference between go-dockerclient and the official SDK - -Link for the official SDK: https://docs.docker.com/develop/sdk/ - -go-dockerclient was created before Docker had an official Go SDK and is -still maintained and active because it's still used out there. New features in -the Docker API do not get automatically implemented here: it's based on demand, -if someone wants it, they can file an issue or a PR and the feature may get -implemented/merged. - -For new projects, using the official SDK is probably more appropriate as -go-dockerclient lags behind the official SDK. - -When using the official SDK, keep in mind that because of how the its -dependencies are organized, you may need some extra steps in order to be able -to import it in your projects (see -[#784](https://github.com/fsouza/go-dockerclient/issues/784) and -[moby/moby#28269](https://github.com/moby/moby/issues/28269)). +documentation](http://docs.docker.com/engine/reference/api/docker_remote_api/). ## Example @@ -39,11 +24,12 @@ package main import ( "fmt" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func main() { - client, err := docker.NewClientFromEnv() + endpoint := "unix:///var/run/docker.sock" + client, err := docker.NewClient(endpoint) if err != nil { panic(err) } @@ -74,11 +60,11 @@ package main import ( "fmt" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func main() { - const endpoint = "tcp://[ip]:[port]" + endpoint := "tcp://[ip]:[port]" path := os.Getenv("DOCKER_CERT_PATH") ca := fmt.Sprintf("%s/ca.pem", path) cert := fmt.Sprintf("%s/cert.pem", path) @@ -90,8 +76,7 @@ func main() { If using [docker-machine](https://docs.docker.com/machine/), or another application that exports environment variables `DOCKER_HOST`, -`DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH`, `DOCKER_API_VERSION`, you can use -NewClientFromEnv. +`DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH`, you can use NewClientFromEnv. ```go @@ -100,14 +85,11 @@ package main import ( "fmt" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func main() { - client, err := docker.NewClientFromEnv() - if err != nil { - // handle err - } + client, _ := docker.NewClientFromEnv() // use client } ``` @@ -120,22 +102,14 @@ All development commands can be seen in the [Makefile](Makefile). Commited code must pass: -* [golangci-lint](https://github.com/golangci/golangci-lint) +* [golint](https://github.com/golang/lint) (with some exceptions, see the Makefile). +* [go vet](https://golang.org/cmd/vet/) +* [gofmt](https://golang.org/cmd/gofmt) * [go test](https://golang.org/cmd/go/#hdr-Test_packages) -Running ``make test`` will run all checks, as well as install any required -dependencies. - -## Modules - -go-dockerclient supports Go modules. - -If you're using dep, you can check the [releases -page](https://github.com/fsouza/go-dockerclient/releases) for the latest -release fully compatible with dep. - -With other vendoring tools, users need to specify go-dockerclient's -dependencies manually. +Running `make test` will check all of these. If your editor does not +automatically call ``gofmt -s``, `make fmt` will format all go files in this +repository. ## Using with Docker 1.9 and Go 1.4 diff --git a/vendor/github.com/fsouza/go-dockerclient/appveyor.yml b/vendor/github.com/fsouza/go-dockerclient/appveyor.yml new file mode 100644 index 000000000000..60867690dd1a --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/appveyor.yml @@ -0,0 +1,20 @@ +version: '{build}' +platform: x64 +clone_depth: 2 +clone_folder: c:\gopath\src\github.com\fsouza\go-dockerclient +environment: + GOPATH: c:\gopath + matrix: + - GOVERSION: 1.8.4 + - GOVERSION: 1.9.1 +install: + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - rmdir c:\go /s /q + - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip + - 7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL +build_script: + - go get -race -d -t ./... +test_script: + - go test -race ./... +matrix: + fast_finish: true diff --git a/vendor/github.com/fsouza/go-dockerclient/auth.go b/vendor/github.com/fsouza/go-dockerclient/auth.go index 2712700168e4..03d192b79227 100644 --- a/vendor/github.com/fsouza/go-dockerclient/auth.go +++ b/vendor/github.com/fsouza/go-dockerclient/auth.go @@ -9,16 +9,16 @@ import ( "encoding/base64" "encoding/json" "errors" + "fmt" "io" "io/ioutil" - "net/http" "os" "path" "strings" ) // ErrCannotParseDockercfg is the error returned by NewAuthConfigurations when the dockercfg cannot be parsed. -var ErrCannotParseDockercfg = errors.New("failed to read authentication from dockercfg") +var ErrCannotParseDockercfg = errors.New("Failed to read authentication from dockercfg") // AuthConfiguration represents authentication options to use in the PushImage // method. It represents the authentication in the Docker index server. @@ -27,22 +27,6 @@ type AuthConfiguration struct { Password string `json:"password,omitempty"` Email string `json:"email,omitempty"` ServerAddress string `json:"serveraddress,omitempty"` - - // IdentityToken can be supplied with the identitytoken response of the AuthCheck call - // see https://pkg.go.dev/github.com/docker/docker/api/types?tab=doc#AuthConfig - // It can be used in place of password not in conjunction with it - IdentityToken string `json:"identitytoken,omitempty"` - - // RegistryToken can be supplied with the registrytoken - RegistryToken string `json:"registrytoken,omitempty"` -} - -func (c AuthConfiguration) isEmpty() bool { - return c == AuthConfiguration{} -} - -func (c AuthConfiguration) headerKey() string { - return "X-Registry-Auth" } // AuthConfigurations represents authentication options to use for the @@ -51,33 +35,15 @@ type AuthConfigurations struct { Configs map[string]AuthConfiguration `json:"configs"` } -func (c AuthConfigurations) isEmpty() bool { - return len(c.Configs) == 0 -} - -func (c AuthConfigurations) headerKey() string { - return "X-Registry-Config" -} - // AuthConfigurations119 is used to serialize a set of AuthConfigurations // for Docker API >= 1.19. type AuthConfigurations119 map[string]AuthConfiguration -func (c AuthConfigurations119) isEmpty() bool { - return len(c) == 0 -} - -func (c AuthConfigurations119) headerKey() string { - return "X-Registry-Config" -} - // dockerConfig represents a registry authentation configuration from the // .dockercfg file. type dockerConfig struct { - Auth string `json:"auth"` - Email string `json:"email"` - IdentityToken string `json:"identitytoken"` - RegistryToken string `json:"registrytoken"` + Auth string `json:"auth"` + Email string `json:"email"` } // NewAuthConfigurationsFromFile returns AuthConfigurations from a path containing JSON @@ -93,11 +59,9 @@ func NewAuthConfigurationsFromFile(path string) (*AuthConfigurations, error) { func cfgPaths(dockerConfigEnv string, homeEnv string) []string { var paths []string if dockerConfigEnv != "" { - paths = append(paths, path.Join(dockerConfigEnv, "plaintext-passwords.json")) paths = append(paths, path.Join(dockerConfigEnv, "config.json")) } if homeEnv != "" { - paths = append(paths, path.Join(homeEnv, ".docker", "plaintext-passwords.json")) paths = append(paths, path.Join(homeEnv, ".docker", "config.json")) paths = append(paths, path.Join(homeEnv, ".dockercfg")) } @@ -110,13 +74,10 @@ func cfgPaths(dockerConfigEnv string, homeEnv string) []string { // - $HOME/.docker/config.json // - $HOME/.dockercfg func NewAuthConfigurationsFromDockerCfg() (*AuthConfigurations, error) { - pathsToTry := cfgPaths(os.Getenv("DOCKER_CONFIG"), os.Getenv("HOME")) - if len(pathsToTry) < 1 { - return nil, errors.New("no docker configuration found") - } - + err := fmt.Errorf("No docker configuration found") var auths *AuthConfigurations - var err error + + pathsToTry := cfgPaths(os.Getenv("DOCKER_CONFIG"), os.Getenv("HOME")) for _, path := range pathsToTry { auths, err = NewAuthConfigurationsFromFile(path) if err == nil { @@ -167,47 +128,22 @@ func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) { c := &AuthConfigurations{ Configs: make(map[string]AuthConfiguration), } - for reg, conf := range confs { - if conf.Auth == "" { - continue - } - - // support both padded and unpadded encoding data, err := base64.StdEncoding.DecodeString(conf.Auth) if err != nil { - data, err = base64.StdEncoding.WithPadding(base64.NoPadding).DecodeString(conf.Auth) - } - if err != nil { - return nil, errors.New("error decoding plaintext credentials") + return nil, err } - userpass := strings.SplitN(string(data), ":", 2) if len(userpass) != 2 { return nil, ErrCannotParseDockercfg } - - authConfig := AuthConfiguration{ + c.Configs[reg] = AuthConfiguration{ Email: conf.Email, Username: userpass[0], Password: userpass[1], ServerAddress: reg, } - - // if identitytoken provided then zero the password and set it - if conf.IdentityToken != "" { - authConfig.Password = "" - authConfig.IdentityToken = conf.IdentityToken - } - - // if registrytoken provided then zero the password and set it - if conf.RegistryToken != "" { - authConfig.Password = "" - authConfig.RegistryToken = conf.RegistryToken - } - c.Configs[reg] = authConfig } - return c, nil } @@ -227,7 +163,7 @@ func (c *Client) AuthCheck(conf *AuthConfiguration) (AuthStatus, error) { if conf == nil { return authStatus, errors.New("conf is nil") } - resp, err := c.do(http.MethodPost, "/auth", doOptions{data: conf}) + resp, err := c.do("POST", "/auth", doOptions{data: conf}) if err != nil { return authStatus, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/auth_test.go b/vendor/github.com/fsouza/go-dockerclient/auth_test.go index 999fc1854c03..ba846f655d9c 100644 --- a/vendor/github.com/fsouza/go-dockerclient/auth_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/auth_test.go @@ -17,25 +17,21 @@ import ( func TestAuthConfigurationSearchPath(t *testing.T) { t.Parallel() - testData := []struct { + var testData = []struct { dockerConfigEnv string homeEnv string expectedPaths []string }{ {"", "", []string{}}, - {"", "home", []string{path.Join("home", ".docker", "plaintext-passwords.json"), path.Join("home", ".docker", "config.json"), path.Join("home", ".dockercfg")}}, - {"docker_config", "", []string{path.Join("docker_config", "plaintext-passwords.json"), path.Join("docker_config", "config.json")}}, - {"a", "b", []string{path.Join("a", "plaintext-passwords.json"), path.Join("a", "config.json"), path.Join("b", ".docker", "plaintext-passwords.json"), path.Join("b", ".docker", "config.json"), path.Join("b", ".dockercfg")}}, + {"", "home", []string{path.Join("home", ".docker", "config.json"), path.Join("home", ".dockercfg")}}, + {"docker_config", "", []string{path.Join("docker_config", "config.json")}}, + {"a", "b", []string{path.Join("a", "config.json"), path.Join("b", ".docker", "config.json"), path.Join("b", ".dockercfg")}}, } for _, tt := range testData { - tt := tt - t.Run(tt.dockerConfigEnv+tt.homeEnv, func(t *testing.T) { - t.Parallel() - paths := cfgPaths(tt.dockerConfigEnv, tt.homeEnv) - if got, want := strings.Join(paths, ","), strings.Join(tt.expectedPaths, ","); got != want { - t.Errorf("cfgPaths: wrong result. Want: %s. Got: %s", want, got) - } - }) + paths := cfgPaths(tt.dockerConfigEnv, tt.homeEnv) + if got, want := strings.Join(paths, ","), strings.Join(tt.expectedPaths, ","); got != want { + t.Errorf("cfgPaths: wrong result. Want: %s. Got: %s", want, got) + } } } @@ -47,7 +43,7 @@ func TestAuthConfigurationsFromFile(t *testing.T) { } defer os.RemoveAll(tmpDir) authString := base64.StdEncoding.EncodeToString([]byte("user:pass")) - content := fmt.Sprintf(`{"auths":{"foo": {"auth": "%s"}}}`, authString) + content := fmt.Sprintf("{\"auths\":{\"foo\": {\"auth\": \"%s\"}}}", authString) configFile := path.Join(tmpDir, "docker_config") if err = ioutil.WriteFile(configFile, []byte(content), 0600); err != nil { t.Errorf("Error writing auth config for TestAuthConfigurationsFromFile: %s", err) @@ -100,29 +96,6 @@ func TestAuthBadConfig(t *testing.T) { } } -func TestAuthMixedWithKeyChain(t *testing.T) { - t.Parallel() - auth := base64.StdEncoding.EncodeToString([]byte("user:pass")) - read := strings.NewReader(fmt.Sprintf(`{"auths":{"docker.io":{},"localhost:5000":{"auth":"%s"}},"credsStore":"osxkeychain"}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != nil { - t.Fatal(err) - } - c, ok := ac.Configs["localhost:5000"] - if !ok { - t.Error("NewAuthConfigurations: Expected Configs to contain localhost:5000") - } - if got, want := c.Username, "user"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Username: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.Password, "pass"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Password: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.ServerAddress, "localhost:5000"; got != want { - t.Errorf(`AuthConfigurations.Configs["localhost:5000"].ServerAddress: wrong result. Want %q. Got %q`, want, got) - } -} - func TestAuthAndOtherFields(t *testing.T) { t.Parallel() auth := base64.StdEncoding.EncodeToString([]byte("user:pass")) @@ -152,7 +125,6 @@ func TestAuthAndOtherFields(t *testing.T) { t.Errorf(`AuthConfigurations.Configs["docker.io"].ServerAddress: wrong result. Want %q. Got %q`, want, got) } } - func TestAuthConfig(t *testing.T) { t.Parallel() auth := base64.StdEncoding.EncodeToString([]byte("user:pass")) @@ -179,48 +151,6 @@ func TestAuthConfig(t *testing.T) { } } -func TestAuthConfigIdentityToken(t *testing.T) { - t.Parallel() - auth := base64.StdEncoding.EncodeToString([]byte("someuser:")) - read := strings.NewReader(fmt.Sprintf(`{"auths":{"docker.io":{"auth":"%s","identitytoken":"sometoken"}}}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != nil { - t.Fatal(err) - } - - c, ok := ac.Configs["docker.io"] - if !ok { - t.Error("NewAuthConfigurations: Expected Configs to contain docker.io") - } - if got, want := c.Username, "someuser"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Username: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.IdentityToken, "sometoken"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].IdentityToken: wrong result. Want %q. Got %q`, want, got) - } -} - -func TestAuthConfigRegistryToken(t *testing.T) { - t.Parallel() - auth := base64.StdEncoding.EncodeToString([]byte("someuser:")) - read := strings.NewReader(fmt.Sprintf(`{"auths":{"docker.io":{"auth":"%s","registrytoken":"sometoken"}}}`, auth)) - ac, err := NewAuthConfigurations(read) - if err != nil { - t.Fatal(err) - } - - c, ok := ac.Configs["docker.io"] - if !ok { - t.Error("NewAuthConfigurations: Expected Configs to contain docker.io") - } - if got, want := c.Username, "someuser"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].Username: wrong result. Want %q. Got %q`, want, got) - } - if got, want := c.RegistryToken, "sometoken"; got != want { - t.Errorf(`AuthConfigurations.Configs["docker.io"].RegistryToken: wrong result. Want %q. Got %q`, want, got) - } -} - func TestAuthCheck(t *testing.T) { t.Parallel() fakeRT := &FakeRoundTripper{status: http.StatusOK} diff --git a/vendor/github.com/fsouza/go-dockerclient/build_test.go b/vendor/github.com/fsouza/go-dockerclient/build_test.go index 6e2038319299..174cca4a6d7e 100644 --- a/vendor/github.com/fsouza/go-dockerclient/build_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/build_test.go @@ -136,12 +136,13 @@ func TestBuildImageSendXRegistryConfig(t *testing.T) { }, } - encodedConfig := "eyJjb25maWdzIjp7InF1YXkuaW8iOnsidXNlcm5hbWUiOiJmb28iLCJwYXNzd29yZCI6ImJhciIsImVtYWlsIjoiYmF6Iiwic2VydmVyYWRkcmVzcyI6InF1YXkuaW8ifX19" + encodedConfig := "eyJjb25maWdzIjp7InF1YXkuaW8iOnsidXNlcm5hbWUiOiJmb28iLCJwYXNzd29yZCI6ImJhciIsImVtYWlsIjoiYmF6Iiwic2VydmVyYWRkcmVzcyI6InF1YXkuaW8ifX19Cg==" + if err := client.BuildImage(opts); err != nil { t.Fatal(err) } - xRegistryConfig := fakeRT.requests[0].Header.Get("X-Registry-Config") + xRegistryConfig := fakeRT.requests[0].Header["X-Registry-Config"][0] if xRegistryConfig != encodedConfig { t.Errorf( "BuildImage: X-Registry-Config not set currectly: expected %q, got %q", @@ -151,7 +152,7 @@ func TestBuildImageSendXRegistryConfig(t *testing.T) { } } -func unpackBodyTarball(req io.Reader) (tmpdir string, err error) { +func unpackBodyTarball(req io.ReadCloser) (tmpdir string, err error) { tmpdir, err = ioutil.TempDir("", "go-dockerclient-test") if err != nil { return diff --git a/vendor/github.com/fsouza/go-dockerclient/change_test.go b/vendor/github.com/fsouza/go-dockerclient/change_test.go index 484f51456f99..203d332f991f 100644 --- a/vendor/github.com/fsouza/go-dockerclient/change_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/change_test.go @@ -8,7 +8,7 @@ import "testing" func TestChangeString(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { change Change expected string }{ @@ -18,12 +18,8 @@ func TestChangeString(t *testing.T) { {Change{"/etc/passwd", 33}, " /etc/passwd"}, } for _, tt := range tests { - test := tt - t.Run(test.expected, func(t *testing.T) { - t.Parallel() - if got := test.change.String(); got != test.expected { - t.Errorf("Change.String(): want %q. Got %q.", test.expected, got) - } - }) + if got := tt.change.String(); got != tt.expected { + t.Errorf("Change.String(): want %q. Got %q.", tt.expected, got) + } } } diff --git a/vendor/github.com/fsouza/go-dockerclient/client.go b/vendor/github.com/fsouza/go-dockerclient/client.go index 825ba38abba5..b404953fc44f 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client.go +++ b/vendor/github.com/fsouza/go-dockerclient/client.go @@ -10,7 +10,6 @@ package docker import ( "bufio" "bytes" - "context" "crypto/tls" "crypto/x509" "encoding/json" @@ -31,9 +30,12 @@ import ( "sync/atomic" "time" + "github.com/docker/docker/opts" "github.com/docker/docker/pkg/homedir" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/stdcopy" + "golang.org/x/net/context" + "golang.org/x/net/context/ctxhttp" ) const ( @@ -54,12 +56,9 @@ var ( ErrInactivityTimeout = errors.New("inactivity time exceeded timeout") apiVersion112, _ = NewAPIVersion("1.12") - apiVersion118, _ = NewAPIVersion("1.18") apiVersion119, _ = NewAPIVersion("1.19") - apiVersion121, _ = NewAPIVersion("1.21") apiVersion124, _ = NewAPIVersion("1.24") apiVersion125, _ = NewAPIVersion("1.25") - apiVersion135, _ = NewAPIVersion("1.35") ) // APIVersion is an internal representation of a version of the Remote API. @@ -71,7 +70,7 @@ type APIVersion []int // and are integer numbers. func NewAPIVersion(input string) (APIVersion, error) { if !strings.Contains(input, ".") { - return nil, fmt.Errorf("unable to parse version %q", input) + return nil, fmt.Errorf("Unable to parse version %q", input) } raw := strings.Split(input, "-") arr := strings.Split(raw[0], ".") @@ -80,7 +79,7 @@ func NewAPIVersion(input string) (APIVersion, error) { for i, val := range arr { ret[i], err = strconv.Atoi(val) if err != nil { - return nil, fmt.Errorf("unable to parse version %q: %q is not an integer", input, val) + return nil, fmt.Errorf("Unable to parse version %q: %q is not an integer", input, val) } } return ret, nil @@ -219,19 +218,11 @@ func NewVersionedClient(endpoint string, apiVersionString string) (*Client, erro eventMonitor: new(eventMonitoringState), requestedAPIVersion: requestedAPIVersion, } - c.initializeNativeClient(defaultTransport) + c.initializeNativeClient() return c, nil } -// WithTransport replaces underlying HTTP client of Docker Client by accepting -// a function that returns pointer to a transport object. -func (c *Client) WithTransport(trFunc func() *http.Transport) { - c.initializeNativeClient(trFunc) -} - -// NewVersionnedTLSClient is like NewVersionedClient, but with ann extra n. -// -// Deprecated: Use NewVersionedTLSClient instead. +// NewVersionnedTLSClient has been DEPRECATED, please use NewVersionedTLSClient. func NewVersionnedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error) { return NewVersionedTLSClient(endpoint, cert, key, ca, apiVersionString) } @@ -264,19 +255,16 @@ func NewVersionedTLSClient(endpoint string, cert, key, ca, apiVersionString stri } // NewClientFromEnv returns a Client instance ready for communication created from -// Docker's default logic for the environment variables DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, -// and DOCKER_API_VERSION. +// Docker's default logic for the environment variables DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT_PATH. // // See https://github.com/docker/docker/blob/1f963af697e8df3a78217f6fdbf67b8123a7db94/docker/docker.go#L68. // See https://github.com/docker/compose/blob/81707ef1ad94403789166d2fe042c8a718a4c748/compose/cli/docker_client.py#L7. -// See https://github.com/moby/moby/blob/28d7dba41d0c0d9c7f0dafcc79d3c59f2b3f5dc3/client/options.go#L51 func NewClientFromEnv() (*Client, error) { - apiVersionString := os.Getenv("DOCKER_API_VERSION") - client, err := NewVersionedClientFromEnv(apiVersionString) + client, err := NewVersionedClientFromEnv("") if err != nil { return nil, err } - client.SkipServerVersionCheck = apiVersionString == "" + client.SkipServerVersionCheck = true return client, nil } @@ -333,7 +321,7 @@ func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, } else { caPool := x509.NewCertPool() if !caPool.AppendCertsFromPEM(caPEMCert) { - return nil, errors.New("could not add RootCA pem") + return nil, errors.New("Could not add RootCA pem") } tlsConfig.RootCAs = caPool } @@ -351,7 +339,7 @@ func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, eventMonitor: new(eventMonitoringState), requestedAPIVersion: requestedAPIVersion, } - c.initializeNativeClient(defaultTransport) + c.initializeNativeClient() return c, nil } @@ -391,7 +379,7 @@ func (c *Client) Endpoint() string { // // See https://goo.gl/wYfgY1 for more details. func (c *Client) Ping() error { - return c.PingWithContext(context.TODO()) + return c.PingWithContext(nil) } // PingWithContext pings the docker server @@ -400,7 +388,7 @@ func (c *Client) Ping() error { // See https://goo.gl/wYfgY1 for more details. func (c *Client) PingWithContext(ctx context.Context) error { path := "/_ping" - resp, err := c.do(http.MethodGet, path, doOptions{context: ctx}) + resp, err := c.do("GET", path, doOptions{context: ctx}) if err != nil { return err } @@ -412,13 +400,13 @@ func (c *Client) PingWithContext(ctx context.Context) error { } func (c *Client) getServerAPIVersionString() (version string, err error) { - resp, err := c.do(http.MethodGet, "/version", doOptions{}) + resp, err := c.do("GET", "/version", doOptions{}) if err != nil { return "", err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("received unexpected status %d while trying to retrieve the server version", resp.StatusCode) + return "", fmt.Errorf("Received unexpected status %d while trying to retrieve the server version", resp.StatusCode) } var versionResponse map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&versionResponse); err != nil { @@ -468,7 +456,7 @@ func (c *Client) do(method, path string, doOptions doOptions) (*http.Response, e req.Header.Set("User-Agent", userAgent) if doOptions.data != nil { req.Header.Set("Content-Type", "application/json") - } else if method == http.MethodPost { + } else if method == "POST" { req.Header.Set("Content-Type", "plain/text") } @@ -481,7 +469,7 @@ func (c *Client) do(method, path string, doOptions doOptions) (*http.Response, e ctx = context.Background() } - resp, err := c.HTTPClient.Do(req.WithContext(ctx)) + resp, err := ctxhttp.Do(ctx, c.HTTPClient, req) if err != nil { if strings.Contains(err.Error(), "connection refused") { return nil, ErrConnectionRefused @@ -523,7 +511,7 @@ func chooseError(ctx context.Context, err error) error { } func (c *Client) stream(method, path string, streamOptions streamOptions) error { - if (method == http.MethodPost || method == http.MethodPut) && streamOptions.in == nil { + if (method == "POST" || method == "PUT") && streamOptions.in == nil { streamOptions.in = bytes.NewReader(nil) } if path != "/version" && !c.SkipServerVersionCheck && c.expectedAPIVersion == nil { @@ -532,25 +520,12 @@ func (c *Client) stream(method, path string, streamOptions streamOptions) error return err } } - return c.streamURL(method, c.getURL(path), streamOptions) -} - -func (c *Client) streamURL(method, url string, streamOptions streamOptions) error { - if (method == http.MethodPost || method == http.MethodPut) && streamOptions.in == nil { - streamOptions.in = bytes.NewReader(nil) - } - if !c.SkipServerVersionCheck && c.expectedAPIVersion == nil { - err := c.checkAPIVersion() - if err != nil { - return err - } - } - req, err := http.NewRequest(method, url, streamOptions.in) + req, err := http.NewRequest(method, c.getURL(path), streamOptions.in) if err != nil { return err } req.Header.Set("User-Agent", userAgent) - if method == http.MethodPost { + if method == "POST" { req.Header.Set("Content-Type", "plain/text") } for key, val := range streamOptions.headers { @@ -609,19 +584,18 @@ func (c *Client) streamURL(method, url string, streamOptions streamOptions) erro return chooseError(subCtx, err) } - defer resp.Body.Close() } else { - if resp, err = c.HTTPClient.Do(req.WithContext(subCtx)); err != nil { + if resp, err = ctxhttp.Do(subCtx, c.HTTPClient, req); err != nil { if strings.Contains(err.Error(), "connection refused") { return ErrConnectionRefused } return chooseError(subCtx, err) } - defer resp.Body.Close() if streamOptions.reqSent != nil { close(streamOptions.reqSent) } } + defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 400 { return newError(resp) } @@ -657,7 +631,11 @@ func handleStreamResponse(resp *http.Response, streamOptions *streamOptions) err _, err = io.Copy(streamOptions.stdout, resp.Body) return err } - if st, ok := streamOptions.stdout.(stream); ok { + if st, ok := streamOptions.stdout.(interface { + io.Writer + FD() uintptr + IsTerminal() bool + }); ok { err = jsonmessage.DisplayJSONMessagesToStream(resp.Body, st, nil) } else { err = jsonmessage.DisplayJSONMessagesStream(resp.Body, streamOptions.stdout, 0, false, nil) @@ -665,12 +643,6 @@ func handleStreamResponse(resp *http.Response, streamOptions *streamOptions) err return err } -type stream interface { - io.Writer - FD() uintptr - IsTerminal() bool -} - type proxyReader struct { io.ReadCloser calls uint64 @@ -780,10 +752,8 @@ func (c *Client) hijack(method, path string, hijackOptions hijackOptions) (Close errs := make(chan error, 1) quit := make(chan struct{}) go func() { - //nolint:staticcheck clientconn := httputil.NewClientConn(dial, nil) defer clientconn.Close() - //nolint:bodyclose clientconn.Do(req) if hijackOptions.success != nil { hijackOptions.success <- struct{}{} @@ -878,29 +848,6 @@ func (c *Client) getURL(path string) string { return fmt.Sprintf("%s%s", urlStr, path) } -func (c *Client) getPath(basepath string, opts interface{}) (string, error) { - queryStr, requiredAPIVersion := queryStringVersion(opts) - return c.pathVersionCheck(basepath, queryStr, requiredAPIVersion) -} - -func (c *Client) pathVersionCheck(basepath, queryStr string, requiredAPIVersion APIVersion) (string, error) { - urlStr := strings.TrimRight(c.endpointURL.String(), "/") - if c.endpointURL.Scheme == unixProtocol || c.endpointURL.Scheme == namedPipeProtocol { - urlStr = "" - } - if c.requestedAPIVersion != nil { - if c.requestedAPIVersion.GreaterThanOrEqualTo(requiredAPIVersion) { - return fmt.Sprintf("%s/v%s%s?%s", urlStr, c.requestedAPIVersion, basepath, queryStr), nil - } - return "", fmt.Errorf("API %s requires version %s, requested version %s is insufficient", - basepath, requiredAPIVersion, c.requestedAPIVersion) - } - if requiredAPIVersion != nil { - return fmt.Sprintf("%s/v%s%s?%s", urlStr, requiredAPIVersion, basepath, queryStr), nil - } - return fmt.Sprintf("%s%s?%s", urlStr, basepath, queryStr), nil -} - // getFakeNativeURL returns the URL needed to make an HTTP request over a UNIX // domain socket to the given path. func (c *Client) getFakeNativeURL(path string) string { @@ -917,18 +864,24 @@ func (c *Client) getFakeNativeURL(path string) string { return fmt.Sprintf("%s%s", urlStr, path) } -func queryStringVersion(opts interface{}) (string, APIVersion) { +type jsonMessage struct { + Status string `json:"status,omitempty"` + Progress string `json:"progress,omitempty"` + Error string `json:"error,omitempty"` + Stream string `json:"stream,omitempty"` +} + +func queryString(opts interface{}) string { if opts == nil { - return "", nil + return "" } value := reflect.ValueOf(opts) if value.Kind() == reflect.Ptr { value = value.Elem() } if value.Kind() != reflect.Struct { - return "", nil + return "" } - var apiVersion APIVersion items := url.Values(map[string][]string{}) for i := 0; i < value.NumField(); i++ { field := value.Type().Field(i) @@ -941,80 +894,49 @@ func queryStringVersion(opts interface{}) (string, APIVersion) { } else if key == "-" { continue } - if addQueryStringValue(items, key, value.Field(i)) { - verstr := field.Tag.Get("ver") - if verstr != "" { - ver, _ := NewAPIVersion(verstr) - if apiVersion == nil { - apiVersion = ver - } else if ver.GreaterThan(apiVersion) { - apiVersion = ver - } - } - } + addQueryStringValue(items, key, value.Field(i)) } - return items.Encode(), apiVersion -} - -func queryString(opts interface{}) string { - s, _ := queryStringVersion(opts) - return s + return items.Encode() } -func addQueryStringValue(items url.Values, key string, v reflect.Value) bool { +func addQueryStringValue(items url.Values, key string, v reflect.Value) { switch v.Kind() { case reflect.Bool: if v.Bool() { items.Add(key, "1") - return true } case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if v.Int() > 0 { items.Add(key, strconv.FormatInt(v.Int(), 10)) - return true - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - if v.Uint() > 0 { - items.Add(key, strconv.FormatUint(v.Uint(), 10)) - return true } case reflect.Float32, reflect.Float64: if v.Float() > 0 { items.Add(key, strconv.FormatFloat(v.Float(), 'f', -1, 64)) - return true } case reflect.String: if v.String() != "" { items.Add(key, v.String()) - return true } case reflect.Ptr: if !v.IsNil() { if b, err := json.Marshal(v.Interface()); err == nil { items.Add(key, string(b)) - return true } } case reflect.Map: if len(v.MapKeys()) > 0 { if b, err := json.Marshal(v.Interface()); err == nil { items.Add(key, string(b)) - return true } } case reflect.Array, reflect.Slice: vLen := v.Len() - var valuesAdded int if vLen > 0 { for i := 0; i < vLen; i++ { - if addQueryStringValue(items, key, v.Index(i)) { - valuesAdded++ - } + addQueryStringValue(items, key, v.Index(i)) } } - return valuesAdded > 0 } - return false } // Error represents failures in the API. It represents a failure from the API. @@ -1024,20 +946,12 @@ type Error struct { } func newError(resp *http.Response) *Error { - type ErrMsg struct { - Message string `json:"message"` - } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { return &Error{Status: resp.StatusCode, Message: fmt.Sprintf("cannot read body, err: %v", err)} } - var emsg ErrMsg - err = json.Unmarshal(data, &emsg) - if err != nil { - return &Error{Status: resp.StatusCode, Message: string(data)} - } - return &Error{Status: resp.StatusCode, Message: emsg.Message} + return &Error{Status: resp.StatusCode, Message: string(data)} } func (e *Error) Error() string { @@ -1095,7 +1009,7 @@ func getDockerEnv() (*dockerEnv, error) { dockerHost := os.Getenv("DOCKER_HOST") var err error if dockerHost == "" { - dockerHost = defaultHost + dockerHost = opts.DefaultHost } dockerTLSVerify := os.Getenv("DOCKER_TLS_VERIFY") != "" var dockerCertPath string diff --git a/vendor/github.com/fsouza/go-dockerclient/client_stress_test.go b/vendor/github.com/fsouza/go-dockerclient/client_stress_test.go index 21cb33108bd6..ae0e4e575bb4 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_stress_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_stress_test.go @@ -22,7 +22,7 @@ func TestClientDoConcurrentStress(t *testing.T) { t.Parallel() var reqs []*http.Request var mu sync.Mutex - handler := http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) { + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mu.Lock() reqs = append(reqs, r) mu.Unlock() @@ -36,7 +36,7 @@ func TestClientDoConcurrentStress(t *testing.T) { defer cleanup() nativeSrvs = append(nativeSrvs, srv) } - tests := []struct { + var tests = []struct { testCase string srv *httptest.Server scheme string @@ -52,7 +52,6 @@ func TestClientDoConcurrentStress(t *testing.T) { {testCase: "native with client-only tls", srv: nativeSrvs[2], scheme: nativeProtocol, withTLSServer: false, withTLSClient: nativeProtocol == unixProtocol}, // TLS client only works with unix protocol } for _, tt := range tests { - tt := tt t.Run(tt.testCase, func(t *testing.T) { reqs = nil var client *Client @@ -90,17 +89,17 @@ func TestClientDoConcurrentStress(t *testing.T) { waiters := make(chan CloseWaiter, n) for i := 0; i < n; i++ { path := fmt.Sprintf("/%05d", i) - paths = append(paths, http.MethodGet+path) - paths = append(paths, http.MethodPost+path) + paths = append(paths, "GET"+path) + paths = append(paths, "POST"+path) paths = append(paths, "HEAD"+path) wg.Add(1) go func() { defer wg.Done() - _, clientErr := client.do(http.MethodGet, path, doOptions{}) + _, clientErr := client.do("GET", path, doOptions{}) if clientErr != nil { errsCh <- clientErr } - clientErr = client.stream(http.MethodPost, path, streamOptions{}) + clientErr = client.stream("POST", path, streamOptions{}) if clientErr != nil { errsCh <- clientErr } diff --git a/vendor/github.com/fsouza/go-dockerclient/client_test.go b/vendor/github.com/fsouza/go-dockerclient/client_test.go index 56c5fca662b2..5989c49ffdf0 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_test.go @@ -6,10 +6,7 @@ package docker import ( "bytes" - "context" - "errors" "fmt" - "io" "io/ioutil" "net/http" "net/http/httptest" @@ -22,7 +19,7 @@ import ( "testing" "time" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/net/context" ) func TestNewAPIClient(t *testing.T) { @@ -219,17 +216,13 @@ func TestNewClientInvalidEndpoint(t *testing.T) { "https://localhost:-20", } for _, c := range cases { - testCase := c - t.Run(testCase, func(t *testing.T) { - t.Parallel() - client, err := NewClient(testCase) - if client != nil { - t.Errorf("Want client for invalid endpoint, got %#v.", client) - } - if !errors.Is(err, ErrInvalidEndpoint) { - t.Errorf("NewClient(%q): Got invalid error for invalid endpoint. Want %#v. Got %#v.", testCase, ErrInvalidEndpoint, err) - } - }) + client, err := NewClient(c) + if client != nil { + t.Errorf("Want client for invalid endpoint, got %#v.", client) + } + if !reflect.DeepEqual(err, ErrInvalidEndpoint) { + t.Errorf("NewClient(%q): Got invalid error for invalid endpoint. Want %#v. Got %#v.", c, ErrInvalidEndpoint, err) + } } } @@ -237,22 +230,19 @@ func TestNewClientNoSchemeEndpoint(t *testing.T) { t.Parallel() cases := []string{"localhost", "localhost:8080"} for _, c := range cases { - testCase := c - t.Run(testCase, func(t *testing.T) { - client, err := NewClient(testCase) - if client == nil { - t.Errorf("Want client for scheme-less endpoint, got ") - } - if err != nil { - t.Errorf("Got unexpected error scheme-less endpoint: %q", err) - } - }) + client, err := NewClient(c) + if client == nil { + t.Errorf("Want client for scheme-less endpoint, got ") + } + if err != nil { + t.Errorf("Got unexpected error scheme-less endpoint: %q", err) + } } } func TestNewTLSClient(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { endpoint string expected string }{ @@ -262,18 +252,14 @@ func TestNewTLSClient(t *testing.T) { {"http://localhost:4000", "https"}, } for _, tt := range tests { - test := tt - t.Run(test.endpoint, func(t *testing.T) { - t.Parallel() - client, err := newTLSClient(test.endpoint) - if err != nil { - t.Error(err) - } - got := client.endpointURL.Scheme - if got != test.expected { - t.Errorf("endpointURL.Scheme: Got %s. Want %s.", got, test.expected) - } - }) + client, err := newTLSClient(tt.endpoint) + if err != nil { + t.Error(err) + } + got := client.endpointURL.Scheme + if got != tt.expected { + t.Errorf("endpointURL.Scheme: Got %s. Want %s.", got, tt.expected) + } } } @@ -290,7 +276,7 @@ func TestEndpoint(t *testing.T) { func TestGetURL(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { endpoint string path string expected string @@ -303,23 +289,19 @@ func TestGetURL(t *testing.T) { {nativeRealEndpoint, "/containers", "/containers"}, } for _, tt := range tests { - test := tt - t.Run(test.endpoint+test.path, func(t *testing.T) { - t.Parallel() - client, _ := NewClient(test.endpoint) - client.endpoint = test.endpoint - client.SkipServerVersionCheck = true - got := client.getURL(test.path) - if got != test.expected { - t.Errorf("getURL(%q): Got %s. Want %s.", test.path, got, test.expected) - } - }) + client, _ := NewClient(tt.endpoint) + client.endpoint = tt.endpoint + client.SkipServerVersionCheck = true + got := client.getURL(tt.path) + if got != tt.expected { + t.Errorf("getURL(%q): Got %s. Want %s.", tt.path, got, tt.expected) + } } } func TestGetFakeNativeURL(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { endpoint string path string expected string @@ -329,17 +311,13 @@ func TestGetFakeNativeURL(t *testing.T) { {nativeRealEndpoint, "/containers/ps", "http://unix.sock/containers/ps"}, } for _, tt := range tests { - test := tt - t.Run(test.path, func(t *testing.T) { - t.Parallel() - client, _ := NewClient(test.endpoint) - client.endpoint = test.endpoint - client.SkipServerVersionCheck = true - got := client.getFakeNativeURL(test.path) - if got != test.expected { - t.Errorf("getURL(%q): Got %s. Want %s.", test.path, got, test.expected) - } - }) + client, _ := NewClient(tt.endpoint) + client.endpoint = tt.endpoint + client.SkipServerVersionCheck = true + got := client.getFakeNativeURL(tt.path) + if got != tt.expected { + t.Errorf("getURL(%q): Got %s. Want %s.", tt.path, got, tt.expected) + } } } @@ -366,48 +344,36 @@ func TestQueryString(t *testing.T) { v := float32(2.4) f32QueryString := fmt.Sprintf("w=%s&x=10&y=10.35", strconv.FormatFloat(float64(v), 'f', -1, 64)) jsonPerson := url.QueryEscape(`{"Name":"gopher","age":4}`) - tests := []struct { - input interface{} - want string - wantAPI APIVersion + var tests = []struct { + input interface{} + want string }{ - {&ListContainersOptions{All: true}, "all=1", nil}, - {ListContainersOptions{All: true}, "all=1", nil}, - {ListContainersOptions{Before: "something"}, "before=something", nil}, - {ListContainersOptions{Before: "something", Since: "other"}, "before=something&since=other", nil}, - {ListContainersOptions{Filters: map[string][]string{"status": {"paused", "running"}}}, "filters=%7B%22status%22%3A%5B%22paused%22%2C%22running%22%5D%7D", nil}, - {dumb{X: 10, Y: 10.35000}, "x=10&y=10.35", apiVersion119}, - {dumb{W: v, X: 10, Y: 10.35000}, f32QueryString, apiVersion124}, - {dumb{X: 10, Y: 10.35000, Z: 10}, "x=10&y=10.35&zee=10", apiVersion119}, - {dumb{v: 4, X: 10, Y: 10.35000}, "x=10&y=10.35", apiVersion119}, - {dumb{T: 10, Y: 10.35000}, "y=10.35", nil}, - {dumb{Person: &person{Name: "gopher", Age: 4}}, "p=" + jsonPerson, nil}, - {nil, "", nil}, - {10, "", nil}, - {"not_a_struct", "", nil}, + {&ListContainersOptions{All: true}, "all=1"}, + {ListContainersOptions{All: true}, "all=1"}, + {ListContainersOptions{Before: "something"}, "before=something"}, + {ListContainersOptions{Before: "something", Since: "other"}, "before=something&since=other"}, + {ListContainersOptions{Filters: map[string][]string{"status": {"paused", "running"}}}, "filters=%7B%22status%22%3A%5B%22paused%22%2C%22running%22%5D%7D"}, + {dumb{X: 10, Y: 10.35000}, "x=10&y=10.35"}, + {dumb{W: v, X: 10, Y: 10.35000}, f32QueryString}, + {dumb{X: 10, Y: 10.35000, Z: 10}, "x=10&y=10.35&zee=10"}, + {dumb{v: 4, X: 10, Y: 10.35000}, "x=10&y=10.35"}, + {dumb{T: 10, Y: 10.35000}, "y=10.35"}, + {dumb{Person: &person{Name: "gopher", Age: 4}}, "p=" + jsonPerson}, + {nil, ""}, + {10, ""}, + {"not_a_struct", ""}, } for _, tt := range tests { - test := tt - t.Run("", func(t *testing.T) { - t.Parallel() - got := queryString(test.input) - if got != test.want { - t.Errorf("queryString(%v). Want %q. Got %q.", test.input, test.want, got) - } - gotstring, gotAPI := queryStringVersion(test.input) - if gotstring != test.want { - t.Errorf("queryStringVersion(%v). Want %q. Got %q.", test.input, test.want, gotstring) - } - if gotAPI.compare(test.wantAPI) != 0 { - t.Errorf("queryStringVersion(%v). Want API %q. Got API %q.", test.input, test.wantAPI, gotAPI) - } - }) + got := queryString(tt.input) + if got != tt.want { + t.Errorf("queryString(%v). Want %q. Got %q.", tt.input, tt.want, got) + } } } func TestAPIVersions(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { a string b string expectedALessThanB bool @@ -435,25 +401,21 @@ func TestAPIVersions(t *testing.T) { } for _, tt := range tests { - test := tt - t.Run(test.a+test.b, func(t *testing.T) { - t.Parallel() - a, _ := NewAPIVersion(test.a) - b, _ := NewAPIVersion(test.b) - - if test.expectedALessThanB && !a.LessThan(b) { - t.Errorf("Expected %#v < %#v", a, b) - } - if test.expectedALessThanOrEqualToB && !a.LessThanOrEqualTo(b) { - t.Errorf("Expected %#v <= %#v", a, b) - } - if test.expectedAGreaterThanB && !a.GreaterThan(b) { - t.Errorf("Expected %#v > %#v", a, b) - } - if test.expectedAGreaterThanOrEqualToB && !a.GreaterThanOrEqualTo(b) { - t.Errorf("Expected %#v >= %#v", a, b) - } - }) + a, _ := NewAPIVersion(tt.a) + b, _ := NewAPIVersion(tt.b) + + if tt.expectedALessThanB && !a.LessThan(b) { + t.Errorf("Expected %#v < %#v", a, b) + } + if tt.expectedALessThanOrEqualToB && !a.LessThanOrEqualTo(b) { + t.Errorf("Expected %#v <= %#v", a, b) + } + if tt.expectedAGreaterThanB && !a.GreaterThan(b) { + t.Errorf("Expected %#v > %#v", a, b) + } + if tt.expectedAGreaterThanOrEqualToB && !a.GreaterThanOrEqualTo(b) { + t.Errorf("Expected %#v >= %#v", a, b) + } } } @@ -497,7 +459,7 @@ func TestPingFailingWrongStatus(t *testing.T) { func TestPingErrorWithNativeClient(t *testing.T) { t.Parallel() - srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("aaaaaaaaaaa-invalid-aaaaaaaaaaa")) })) if err != nil { @@ -519,7 +481,7 @@ func TestPingErrorWithNativeClient(t *testing.T) { func TestClientStreamTimeoutNotHit(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { for i := 0; i < 5; i++ { fmt.Fprintf(w, "%d\n", i) if f, ok := w.(http.Flusher); ok { @@ -528,13 +490,12 @@ func TestClientStreamTimeoutNotHit(t *testing.T) { time.Sleep(100 * time.Millisecond) } })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } var w bytes.Buffer - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ setRawTerminal: true, stdout: &w, inactivityTimeout: 300 * time.Millisecond, @@ -551,7 +512,7 @@ func TestClientStreamTimeoutNotHit(t *testing.T) { func TestClientStreamInactivityTimeout(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { for i := 0; i < 5; i++ { fmt.Fprintf(w, "%d\n", i) if f, ok := w.(http.Flusher); ok { @@ -560,13 +521,12 @@ func TestClientStreamInactivityTimeout(t *testing.T) { time.Sleep(500 * time.Millisecond) } })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } var w bytes.Buffer - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ setRawTerminal: true, stdout: &w, inactivityTimeout: 100 * time.Millisecond, @@ -583,26 +543,25 @@ func TestClientStreamInactivityTimeout(t *testing.T) { func TestClientStreamContextDeadline(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "abc\n") if f, ok := w.(http.Flusher); ok { f.Flush() } - time.Sleep(time.Second) + time.Sleep(500 * time.Millisecond) fmt.Fprint(w, "def\n") if f, ok := w.(http.Flusher); ok { f.Flush() } })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } var w bytes.Buffer - ctx, cancel := context.WithTimeout(context.Background(), 400*time.Millisecond) + ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond) defer cancel() - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ setRawTerminal: true, stdout: &w, context: ctx, @@ -619,7 +578,7 @@ func TestClientStreamContextDeadline(t *testing.T) { func TestClientStreamContextCancel(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "abc\n") if f, ok := w.(http.Flusher); ok { f.Flush() @@ -630,7 +589,6 @@ func TestClientStreamContextCancel(t *testing.T) { f.Flush() } })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) @@ -641,7 +599,7 @@ func TestClientStreamContextCancel(t *testing.T) { time.Sleep(200 * time.Millisecond) cancel() }() - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ setRawTerminal: true, stdout: &w, context: ctx, @@ -690,16 +648,15 @@ var mockPullOutput = `{"status":"Pulling from tsuru/static","id":"latest"} func TestClientStreamJSONDecode(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(mockPullOutput)) })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } var w bytes.Buffer - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ stdout: &w, useJSONDecoder: true, }) @@ -742,51 +699,46 @@ func (b *terminalBuffer) IsTerminal() bool { } func TestClientStreamJSONDecodeWithTerminal(t *testing.T) { - if !terminal.IsTerminal(int(os.Stdout.Fd())) { - t.Skip("requires a terminal") - } t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(mockPullOutput)) })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } var w terminalBuffer - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ stdout: &w, useJSONDecoder: true, }) if err != nil { t.Fatal(err) } - const expected = "latest: Pulling from tsuru/static\n\n" + - "\x1b[1A\x1b[2K\ra6aa3b66376f: Already exists \r\x1b[1B\n" + - "\x1b[1A\x1b[2K\r106572778bf7: Pulling fs layer \r\x1b[1B\n" + - "\x1b[1A\x1b[2K\rbac681833e51: Pulling fs layer \r\x1b[1B\n" + - "\x1b[1A\x1b[2K\r7302e23ef08a: Pulling fs layer \r\x1b[1B\x1b[2A\x1b[2K\rbac681833e51: Downloading [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[2K\rbac681833e51: Verifying Checksum \r\x1b[2B\x1b[2A\x1b[2K\rbac681833e51: Download complete \r\x1b[2B\x1b[3A\x1b[2K\r106572778bf7: Downloading [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[2K\r106572778bf7: Verifying Checksum \r\x1b[3B\x1b[3A\x1b[2K\r106572778bf7: Download complete \r\x1b[3B\x1b[3A\x1b[2K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[2K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[1A\x1b[2K\r7302e23ef08a: Downloading [> ] 233kB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Downloading [=> ] 462.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Downloading [====================> ] 8.491MB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Downloading [=================================================> ] 20.88MB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Verifying Checksum \r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Download complete \r\x1b[1B\x1b[3A\x1b[2K\r106572778bf7: Pull complete \r\x1b[3B\x1b[2A\x1b[2K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[2K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[2K\rbac681833e51: Pull complete \r\x1b[2B\x1b[1A\x1b[2K\r7302e23ef08a: Extracting [> ] 229.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Extracting [=> ] 458.8kB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Extracting [==========================> ] 11.24MB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Extracting [==================================================>] 21.06MB/21.06MB\r\x1b[1B\x1b[1A\x1b[2K\r7302e23ef08a: Pull complete \r\x1b[1BDigest: sha256:b754472891aa7e33fc0214e3efa988174f2c2289285fcae868b7ec8b6675fc77\n" + + expected := "latest: Pulling from tsuru/static\n\n" + + "\x1b[1A\x1b[1K\x1b[K\ra6aa3b66376f: Already exists \r\x1b[1B\n" + + "\x1b[1A\x1b[1K\x1b[K\r106572778bf7: Pulling fs layer \r\x1b[1B\n" + + "\x1b[1A\x1b[1K\x1b[K\rbac681833e51: Pulling fs layer \r\x1b[1B\n" + + "\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Pulling fs layer \r\x1b[1B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Downloading [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Verifying Checksum \r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Download complete \r\x1b[2B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Downloading [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Verifying Checksum \r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Download complete \r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [> ] 233kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [=> ] 462.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [====================> ] 8.491MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [=================================================> ] 20.88MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Verifying Checksum \r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Download complete \r\x1b[1B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Pull complete \r\x1b[3B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Pull complete \r\x1b[2B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [> ] 229.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [=> ] 458.8kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [==========================> ] 11.24MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [==================================================>] 21.06MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Pull complete \r\x1b[1BDigest: sha256:b754472891aa7e33fc0214e3efa988174f2c2289285fcae868b7ec8b6675fc77\n" + "Status: Downloaded newer image for 192.168.50.4:5000/tsuru/static\n" result := w.String() if result != expected { - t.Fatalf("wrong stream result\nwant %q\ngot: %q", expected, result) + t.Fatalf("expected stream result %q, got: %q", expected, result) } } func TestClientDoContextDeadline(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(500 * time.Millisecond) })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) } ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) defer cancel() - _, err = client.do(http.MethodPost, "/image/create", doOptions{ + _, err = client.do("POST", "/image/create", doOptions{ context: ctx, }) if err != context.DeadlineExceeded { @@ -796,10 +748,9 @@ func TestClientDoContextDeadline(t *testing.T) { func TestClientDoContextCancel(t *testing.T) { t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(500 * time.Millisecond) })) - defer srv.Close() client, err := NewClient(srv.URL) if err != nil { t.Fatal(err) @@ -809,7 +760,7 @@ func TestClientDoContextCancel(t *testing.T) { time.Sleep(100 * time.Millisecond) cancel() }() - _, err = client.do(http.MethodPost, "/image/create", doOptions{ + _, err = client.do("POST", "/image/create", doOptions{ context: ctx, }) if err != context.Canceled { @@ -819,7 +770,7 @@ func TestClientDoContextCancel(t *testing.T) { func TestClientStreamTimeoutNativeClient(t *testing.T) { t.Parallel() - srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { for i := 0; i < 5; i++ { fmt.Fprintf(w, "%d\n", i) if f, ok := w.(http.Flusher); ok { @@ -839,10 +790,10 @@ func TestClientStreamTimeoutNativeClient(t *testing.T) { t.Fatal(err) } var w bytes.Buffer - err = client.stream(http.MethodPost, "/image/create", streamOptions{ + err = client.stream("POST", "/image/create", streamOptions{ setRawTerminal: true, stdout: &w, - inactivityTimeout: 50 * time.Millisecond, + inactivityTimeout: 100 * time.Millisecond, }) if err != ErrInactivityTimeout { t.Fatalf("expected request canceled error, got: %s", err) @@ -854,32 +805,6 @@ func TestClientStreamTimeoutNativeClient(t *testing.T) { } } -func TestClientStreamJSONDecoderEOFOutputWriter(t *testing.T) { - t.Parallel() - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { - fmt.Fprint(w, "{}") - time.Sleep(500 * time.Millisecond) - })) - defer srv.Close() - client, err := NewClient(srv.URL) - if err != nil { - t.Fatal(err) - } - var w eofWriter - err = client.stream(http.MethodPost, "/image/create", streamOptions{ - setRawTerminal: true, - useJSONDecoder: true, - stdout: &w, - }) - if err != nil { - t.Fatal(err) - } -} - -type eofWriter struct{} - -func (w eofWriter) Write(b []byte) (int, error) { return len(b), io.EOF } - type FakeRoundTripper struct { message string status int @@ -913,8 +838,8 @@ type person struct { type dumb struct { T int `qs:"-"` v int - W float32 `ver:"1.24"` - X int `ver:"1.19"` + W float32 + X int Y float64 Z int `qs:"zee"` Person *person `qs:"p"` diff --git a/vendor/github.com/fsouza/go-dockerclient/client_unix.go b/vendor/github.com/fsouza/go-dockerclient/client_unix.go index cd2034304bed..ab73cf2b0d69 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_unix.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_unix.go @@ -9,23 +9,21 @@ package docker import ( "context" "net" - "net/http" ) -const defaultHost = "unix:///var/run/docker.sock" - // initializeNativeClient initializes the native Unix domain socket client on // Unix-style operating systems -func (c *Client) initializeNativeClient(trFunc func() *http.Transport) { +func (c *Client) initializeNativeClient() { if c.endpointURL.Scheme != unixProtocol { return } - sockPath := c.endpointURL.Path - - tr := trFunc() - tr.Proxy = nil - tr.DialContext = func(_ context.Context, network, addr string) (net.Conn, error) { - return c.Dialer.Dial(unixProtocol, sockPath) + socketPath := c.endpointURL.Path + tr := defaultTransport() + tr.Dial = func(network, addr string) (net.Conn, error) { + return c.Dialer.Dial(unixProtocol, socketPath) + } + tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { + return c.Dialer.Dial(unixProtocol, socketPath) } c.HTTPClient.Transport = tr } diff --git a/vendor/github.com/fsouza/go-dockerclient/client_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/client_unix_test.go index 1f1886fd1450..e085eb78becc 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_unix_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_unix_test.go @@ -23,7 +23,7 @@ const ( func TestNewTSLAPIClientUnixEndpoint(t *testing.T) { t.Parallel() - srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + srv, cleanup, err := newNativeServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("ok")) })) if err != nil { @@ -40,7 +40,7 @@ func TestNewTSLAPIClientUnixEndpoint(t *testing.T) { if client.endpoint != endpoint { t.Errorf("Expected endpoint %s. Got %s.", endpoint, client.endpoint) } - rsp, err := client.do(http.MethodGet, "/", doOptions{}) + rsp, err := client.do("GET", "/", doOptions{}) if err != nil { t.Fatal(err) } diff --git a/vendor/github.com/fsouza/go-dockerclient/client_windows.go b/vendor/github.com/fsouza/go-dockerclient/client_windows.go index 731d5c9628c4..c9ecc187dada 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_windows.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_windows.go @@ -2,21 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build windows + package docker import ( "context" "net" - "net/http" "time" - winio "github.com/Microsoft/go-winio" + "github.com/Microsoft/go-winio" ) -const ( - defaultHost = "npipe:////./pipe/docker_engine" - namedPipeConnectTimeout = 2 * time.Second -) +const namedPipeConnectTimeout = 2 * time.Second type pipeDialer struct { dialFunc func(network, addr string) (net.Conn, error) @@ -27,18 +25,17 @@ func (p pipeDialer) Dial(network, address string) (net.Conn, error) { } // initializeNativeClient initializes the native Named Pipe client for Windows -func (c *Client) initializeNativeClient(trFunc func() *http.Transport) { +func (c *Client) initializeNativeClient() { if c.endpointURL.Scheme != namedPipeProtocol { return } namedPipePath := c.endpointURL.Path - //nolint:unparam - dialFunc := func(_, addr string) (net.Conn, error) { + dialFunc := func(network, addr string) (net.Conn, error) { timeout := namedPipeConnectTimeout return winio.DialPipe(namedPipePath, &timeout) } - tr := trFunc() - tr.Proxy = nil + tr := defaultTransport() + tr.Dial = dialFunc tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { return dialFunc(network, addr) } diff --git a/vendor/github.com/fsouza/go-dockerclient/client_windows_test.go b/vendor/github.com/fsouza/go-dockerclient/client_windows_test.go index 2880e63788a1..d2ea62ac0a8b 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_windows_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_windows_test.go @@ -1,3 +1,5 @@ +// +build windows + // Copyright 2016 go-dockerclient authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -10,7 +12,7 @@ import ( "net/http/httptest" "sync" - winio "github.com/Microsoft/go-winio" + "github.com/Microsoft/go-winio" ) const ( diff --git a/vendor/github.com/fsouza/go-dockerclient/container.go b/vendor/github.com/fsouza/go-dockerclient/container.go index 0300661a0ebc..afa49ca83a9a 100644 --- a/vendor/github.com/fsouza/go-dockerclient/container.go +++ b/vendor/github.com/fsouza/go-dockerclient/container.go @@ -5,7 +5,6 @@ package docker import ( - "context" "encoding/json" "errors" "fmt" @@ -16,7 +15,8 @@ import ( "strings" "time" - units "github.com/docker/go-units" + "github.com/docker/go-units" + "golang.org/x/net/context" ) // ErrContainerAlreadyExists is the error returned by CreateContainer when the @@ -52,8 +52,7 @@ type APIMount struct { Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"` Mode string `json:"Mode,omitempty" yaml:"Mode,omitempty" toml:"Mode,omitempty"` RW bool `json:"RW,omitempty" yaml:"RW,omitempty" toml:"RW,omitempty"` - Propagation string `json:"Propagation,omitempty" yaml:"Propagation,omitempty" toml:"Propagation,omitempty"` - Type string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"` + Propogation string `json:"Propogation,omitempty" yaml:"Propogation,omitempty" toml:"Propogation,omitempty"` } // APIContainers represents each container in the list returned by @@ -85,7 +84,7 @@ type NetworkList struct { // See https://goo.gl/kaOHGw for more details. func (c *Client) ListContainers(opts ListContainersOptions) ([]APIContainers, error) { path := "/containers/json?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) + resp, err := c.do("GET", path, doOptions{context: opts.Context}) if err != nil { return nil, err } @@ -301,10 +300,8 @@ type Config struct { ExposedPorts map[Port]struct{} `json:"ExposedPorts,omitempty" yaml:"ExposedPorts,omitempty" toml:"ExposedPorts,omitempty"` PublishService string `json:"PublishService,omitempty" yaml:"PublishService,omitempty" toml:"PublishService,omitempty"` StopSignal string `json:"StopSignal,omitempty" yaml:"StopSignal,omitempty" toml:"StopSignal,omitempty"` - StopTimeout int `json:"StopTimeout,omitempty" yaml:"StopTimeout,omitempty" toml:"StopTimeout,omitempty"` Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"` Cmd []string `json:"Cmd" yaml:"Cmd" toml:"Cmd"` - Shell []string `json:"Shell,omitempty" yaml:"Shell,omitempty" toml:"Shell,omitempty"` Healthcheck *HealthConfig `json:"Healthcheck,omitempty" yaml:"Healthcheck,omitempty" toml:"Healthcheck,omitempty"` DNS []string `json:"Dns,omitempty" yaml:"Dns,omitempty" toml:"Dns,omitempty"` // For Docker API v1.9 and below only Image string `json:"Image,omitempty" yaml:"Image,omitempty" toml:"Image,omitempty"` @@ -429,9 +426,8 @@ type HealthConfig struct { Test []string `json:"Test,omitempty" yaml:"Test,omitempty" toml:"Test,omitempty"` // Zero means to inherit. Durations are expressed as integer nanoseconds. - Interval time.Duration `json:"Interval,omitempty" yaml:"Interval,omitempty" toml:"Interval,omitempty"` // Interval is the time to wait between checks. - Timeout time.Duration `json:"Timeout,omitempty" yaml:"Timeout,omitempty" toml:"Timeout,omitempty"` // Timeout is the time to wait before considering the check to have hung. - StartPeriod time.Duration `json:"StartPeriod,omitempty" yaml:"StartPeriod,omitempty" toml:"StartPeriod,omitempty"` // The start period for the container to initialize before the retries starts to count down. + Interval time.Duration `json:"Interval,omitempty" yaml:"Interval,omitempty" toml:"Interval,omitempty"` // Interval is the time to wait between checks. + Timeout time.Duration `json:"Timeout,omitempty" yaml:"Timeout,omitempty" toml:"Timeout,omitempty"` // Timeout is the time to wait before considering the check to have hung. // Retries is the number of consecutive failures needed to consider a container as unhealthy. // Zero means inherit. @@ -474,12 +470,6 @@ type Container struct { RestartCount int `json:"RestartCount,omitempty" yaml:"RestartCount,omitempty" toml:"RestartCount,omitempty"` AppArmorProfile string `json:"AppArmorProfile,omitempty" yaml:"AppArmorProfile,omitempty" toml:"AppArmorProfile,omitempty"` - - MountLabel string `json:"MountLabel,omitempty" yaml:"MountLabel,omitempty" toml:"MountLabel,omitempty"` - ProcessLabel string `json:"ProcessLabel,omitempty" yaml:"ProcessLabel,omitempty" toml:"ProcessLabel,omitempty"` - Platform string `json:"Platform,omitempty" yaml:"Platform,omitempty" toml:"Platform,omitempty"` - SizeRw int64 `json:"SizeRw,omitempty" yaml:"SizeRw,omitempty" toml:"SizeRw,omitempty"` - SizeRootFs int64 `json:"SizeRootFs,omitempty" yaml:"SizeRootFs,omitempty" toml:"SizeRootFs,omitempty"` } // UpdateContainerOptions specify parameters to the UpdateContainer function. @@ -506,7 +496,7 @@ type UpdateContainerOptions struct { // // See https://goo.gl/Y6fXUy for more details. func (c *Client) UpdateContainer(id string, opts UpdateContainerOptions) error { - resp, err := c.do(http.MethodPost, fmt.Sprintf("/containers/"+id+"/update"), doOptions{ + resp, err := c.do("POST", fmt.Sprintf("/containers/"+id+"/update"), doOptions{ data: opts, forceJSON: true, context: opts.Context, @@ -534,7 +524,7 @@ type RenameContainerOptions struct { // // See https://goo.gl/46inai for more details. func (c *Client) RenameContainer(opts RenameContainerOptions) error { - resp, err := c.do(http.MethodPost, fmt.Sprintf("/containers/"+opts.ID+"/rename?%s", queryString(opts)), doOptions{ + resp, err := c.do("POST", fmt.Sprintf("/containers/"+opts.ID+"/rename?%s", queryString(opts)), doOptions{ context: opts.Context, }) if err != nil { @@ -546,31 +536,25 @@ func (c *Client) RenameContainer(opts RenameContainerOptions) error { // InspectContainer returns information about a container by its ID. // -// Deprecated: Use InspectContainerWithOptions instead. +// See https://goo.gl/FaI5JT for more details. func (c *Client) InspectContainer(id string) (*Container, error) { - return c.InspectContainerWithOptions(InspectContainerOptions{ID: id}) + return c.inspectContainer(id, doOptions{}) } // InspectContainerWithContext returns information about a container by its ID. // The context object can be used to cancel the inspect request. // -// Deprecated: Use InspectContainerWithOptions instead. -//nolint:golint +// See https://goo.gl/FaI5JT for more details. func (c *Client) InspectContainerWithContext(id string, ctx context.Context) (*Container, error) { - return c.InspectContainerWithOptions(InspectContainerOptions{ID: id, Context: ctx}) + return c.inspectContainer(id, doOptions{context: ctx}) } -// InspectContainerWithOptions returns information about a container by its ID. -// -// See https://goo.gl/FaI5JT for more details. -func (c *Client) InspectContainerWithOptions(opts InspectContainerOptions) (*Container, error) { - path := "/containers/" + opts.ID + "/json?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{ - context: opts.Context, - }) +func (c *Client) inspectContainer(id string, opts doOptions) (*Container, error) { + path := "/containers/" + id + "/json" + resp, err := c.do("GET", path, opts) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return nil, &NoSuchContainer{ID: opts.ID} + return nil, &NoSuchContainer{ID: id} } return nil, err } @@ -582,21 +566,12 @@ func (c *Client) InspectContainerWithOptions(opts InspectContainerOptions) (*Con return &container, nil } -// InspectContainerOptions specifies parameters for InspectContainerWithOptions. -// -// See https://goo.gl/FaI5JT for more details. -type InspectContainerOptions struct { - Context context.Context - ID string `qs:"-"` - Size bool -} - // ContainerChanges returns changes in the filesystem of the given container. // // See https://goo.gl/15KKzh for more details. func (c *Client) ContainerChanges(id string) ([]Change, error) { path := "/containers/" + id + "/changes" - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchContainer{ID: id} @@ -632,7 +607,7 @@ type CreateContainerOptions struct { func (c *Client) CreateContainer(opts CreateContainerOptions) (*Container, error) { path := "/containers/create?" + queryString(opts) resp, err := c.do( - http.MethodPost, + "POST", path, doOptions{ data: struct { @@ -649,7 +624,7 @@ func (c *Client) CreateContainer(opts CreateContainerOptions) (*Container, error ) if e, ok := err.(*Error); ok { - if e.Status == http.StatusNotFound && strings.Contains(e.Message, "No such image") { + if e.Status == http.StatusNotFound { return nil, ErrNoSuchImage } if e.Status == http.StatusConflict { @@ -730,15 +705,6 @@ type Device struct { CgroupPermissions string `json:"CgroupPermissions,omitempty" yaml:"CgroupPermissions,omitempty" toml:"CgroupPermissions,omitempty"` } -// DeviceRequest represents a request for device that's sent to device drivers. -type DeviceRequest struct { - Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"` - Count int `json:"Count,omitempty" yaml:"Count,omitempty" toml:"Count,omitempty"` - DeviceIDs []string `json:"DeviceIDs,omitempty" yaml:"DeviceIDs,omitempty" toml:"DeviceIDs,omitempty"` - Capabilities [][]string `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"` - Options map[string]string `json:"Options,omitempty" yaml:"Options,omitempty" toml:"Options,omitempty"` -} - // BlockWeight represents a relative device weight for an individual device inside // of a container type BlockWeight struct { @@ -759,7 +725,6 @@ type HostConfig struct { Binds []string `json:"Binds,omitempty" yaml:"Binds,omitempty" toml:"Binds,omitempty"` CapAdd []string `json:"CapAdd,omitempty" yaml:"CapAdd,omitempty" toml:"CapAdd,omitempty"` CapDrop []string `json:"CapDrop,omitempty" yaml:"CapDrop,omitempty" toml:"CapDrop,omitempty"` - Capabilities []string `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"` // Mutually exclusive w.r.t. CapAdd and CapDrop API v1.40 GroupAdd []string `json:"GroupAdd,omitempty" yaml:"GroupAdd,omitempty" toml:"GroupAdd,omitempty"` ContainerIDFile string `json:"ContainerIDFile,omitempty" yaml:"ContainerIDFile,omitempty" toml:"ContainerIDFile,omitempty"` LxcConf []KeyValuePair `json:"LxcConf,omitempty" yaml:"LxcConf,omitempty" toml:"LxcConf,omitempty"` @@ -773,23 +738,19 @@ type HostConfig struct { UsernsMode string `json:"UsernsMode,omitempty" yaml:"UsernsMode,omitempty" toml:"UsernsMode,omitempty"` NetworkMode string `json:"NetworkMode,omitempty" yaml:"NetworkMode,omitempty" toml:"NetworkMode,omitempty"` IpcMode string `json:"IpcMode,omitempty" yaml:"IpcMode,omitempty" toml:"IpcMode,omitempty"` - Isolation string `json:"Isolation,omitempty" yaml:"Isolation,omitempty" toml:"Isolation,omitempty"` // Windows only - ConsoleSize [2]int `json:"ConsoleSize,omitempty" yaml:"ConsoleSize,omitempty" toml:"ConsoleSize,omitempty"` // Windows only height x width PidMode string `json:"PidMode,omitempty" yaml:"PidMode,omitempty" toml:"PidMode,omitempty"` UTSMode string `json:"UTSMode,omitempty" yaml:"UTSMode,omitempty" toml:"UTSMode,omitempty"` RestartPolicy RestartPolicy `json:"RestartPolicy,omitempty" yaml:"RestartPolicy,omitempty" toml:"RestartPolicy,omitempty"` Devices []Device `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"` - DeviceCgroupRules []string `json:"DeviceCgroupRules,omitempty" yaml:"DeviceCgroupRules,omitempty" toml:"DeviceCgroupRules,omitempty"` - DeviceRequests []DeviceRequest `json:"DeviceRequests,omitempty" yaml:"DeviceRequests,omitempty" toml:"DeviceRequests,omitempty"` LogConfig LogConfig `json:"LogConfig,omitempty" yaml:"LogConfig,omitempty" toml:"LogConfig,omitempty"` SecurityOpt []string `json:"SecurityOpt,omitempty" yaml:"SecurityOpt,omitempty" toml:"SecurityOpt,omitempty"` - CgroupnsMode string `json:"CgroupnsMode,omitempty" yaml:"CgroupnsMode,omitempty" toml:"CgroupnsMode,omitempty"` // v1.40+ Cgroup string `json:"Cgroup,omitempty" yaml:"Cgroup,omitempty" toml:"Cgroup,omitempty"` CgroupParent string `json:"CgroupParent,omitempty" yaml:"CgroupParent,omitempty" toml:"CgroupParent,omitempty"` Memory int64 `json:"Memory,omitempty" yaml:"Memory,omitempty" toml:"Memory,omitempty"` MemoryReservation int64 `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty" toml:"MemoryReservation,omitempty"` KernelMemory int64 `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty" toml:"KernelMemory,omitempty"` MemorySwap int64 `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty" toml:"MemorySwap,omitempty"` + MemorySwappiness int64 `json:"MemorySwappiness" yaml:"MemorySwappiness" toml:"MemorySwappiness"` CPUShares int64 `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty" toml:"CpuShares,omitempty"` CPUSet string `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty" toml:"Cpuset,omitempty"` CPUSetCPUs string `json:"CpusetCpus,omitempty" yaml:"CpusetCpus,omitempty" toml:"CpusetCpus,omitempty"` @@ -798,7 +759,6 @@ type HostConfig struct { CPUPeriod int64 `json:"CpuPeriod,omitempty" yaml:"CpuPeriod,omitempty" toml:"CpuPeriod,omitempty"` CPURealtimePeriod int64 `json:"CpuRealtimePeriod,omitempty" yaml:"CpuRealtimePeriod,omitempty" toml:"CpuRealtimePeriod,omitempty"` CPURealtimeRuntime int64 `json:"CpuRealtimeRuntime,omitempty" yaml:"CpuRealtimeRuntime,omitempty" toml:"CpuRealtimeRuntime,omitempty"` - NanoCPUs int64 `json:"NanoCpus,omitempty" yaml:"NanoCpus,omitempty" toml:"NanoCpus,omitempty"` BlkioWeight int64 `json:"BlkioWeight,omitempty" yaml:"BlkioWeight,omitempty" toml:"BlkioWeight,omitempty"` BlkioWeightDevice []BlockWeight `json:"BlkioWeightDevice,omitempty" yaml:"BlkioWeightDevice,omitempty" toml:"BlkioWeightDevice,omitempty"` BlkioDeviceReadBps []BlockLimit `json:"BlkioDeviceReadBps,omitempty" yaml:"BlkioDeviceReadBps,omitempty" toml:"BlkioDeviceReadBps,omitempty"` @@ -808,11 +768,14 @@ type HostConfig struct { Ulimits []ULimit `json:"Ulimits,omitempty" yaml:"Ulimits,omitempty" toml:"Ulimits,omitempty"` VolumeDriver string `json:"VolumeDriver,omitempty" yaml:"VolumeDriver,omitempty" toml:"VolumeDriver,omitempty"` OomScoreAdj int `json:"OomScoreAdj,omitempty" yaml:"OomScoreAdj,omitempty" toml:"OomScoreAdj,omitempty"` - MemorySwappiness *int64 `json:"MemorySwappiness,omitempty" yaml:"MemorySwappiness,omitempty" toml:"MemorySwappiness,omitempty"` - PidsLimit *int64 `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty" toml:"PidsLimit,omitempty"` - OOMKillDisable *bool `json:"OomKillDisable,omitempty" yaml:"OomKillDisable,omitempty" toml:"OomKillDisable,omitempty"` + PidsLimit int64 `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty" toml:"PidsLimit,omitempty"` ShmSize int64 `json:"ShmSize,omitempty" yaml:"ShmSize,omitempty" toml:"ShmSize,omitempty"` Tmpfs map[string]string `json:"Tmpfs,omitempty" yaml:"Tmpfs,omitempty" toml:"Tmpfs,omitempty"` + Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` + PublishAllPorts bool `json:"PublishAllPorts,omitempty" yaml:"PublishAllPorts,omitempty" toml:"PublishAllPorts,omitempty"` + ReadonlyRootfs bool `json:"ReadonlyRootfs,omitempty" yaml:"ReadonlyRootfs,omitempty" toml:"ReadonlyRootfs,omitempty"` + OOMKillDisable bool `json:"OomKillDisable,omitempty" yaml:"OomKillDisable,omitempty" toml:"OomKillDisable,omitempty"` + AutoRemove bool `json:"AutoRemove,omitempty" yaml:"AutoRemove,omitempty" toml:"AutoRemove,omitempty"` StorageOpt map[string]string `json:"StorageOpt,omitempty" yaml:"StorageOpt,omitempty" toml:"StorageOpt,omitempty"` Sysctls map[string]string `json:"Sysctls,omitempty" yaml:"Sysctls,omitempty" toml:"Sysctls,omitempty"` CPUCount int64 `json:"CpuCount,omitempty" yaml:"CpuCount,omitempty"` @@ -820,14 +783,7 @@ type HostConfig struct { IOMaximumBandwidth int64 `json:"IOMaximumBandwidth,omitempty" yaml:"IOMaximumBandwidth,omitempty"` IOMaximumIOps int64 `json:"IOMaximumIOps,omitempty" yaml:"IOMaximumIOps,omitempty"` Mounts []HostMount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"` - MaskedPaths []string `json:"MaskedPaths,omitempty" yaml:"MaskedPaths,omitempty" toml:"MaskedPaths,omitempty"` - ReadonlyPaths []string `json:"ReadonlyPaths,omitempty" yaml:"ReadonlyPaths,omitempty" toml:"ReadonlyPaths,omitempty"` - Runtime string `json:"Runtime,omitempty" yaml:"Runtime,omitempty" toml:"Runtime,omitempty"` Init bool `json:",omitempty" yaml:",omitempty"` - Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` - PublishAllPorts bool `json:"PublishAllPorts,omitempty" yaml:"PublishAllPorts,omitempty" toml:"PublishAllPorts,omitempty"` - ReadonlyRootfs bool `json:"ReadonlyRootfs,omitempty" yaml:"ReadonlyRootfs,omitempty" toml:"ReadonlyRootfs,omitempty"` - AutoRemove bool `json:"AutoRemove,omitempty" yaml:"AutoRemove,omitempty" toml:"AutoRemove,omitempty"` } // NetworkingConfig represents the container's networking configuration for each of its interfaces @@ -858,7 +814,6 @@ func (c *Client) StartContainer(id string, hostConfig *HostConfig) error { // API 1.24 or greater. // // See https://goo.gl/fbOSZy for more details. -//nolint:golint func (c *Client) StartContainerWithContext(id string, hostConfig *HostConfig, ctx context.Context) error { return c.startContainer(id, hostConfig, doOptions{context: ctx}) } @@ -872,7 +827,7 @@ func (c *Client) startContainer(id string, hostConfig *HostConfig, opts doOption opts.data = hostConfig opts.forceJSON = true } - resp, err := c.do(http.MethodPost, path, opts) + resp, err := c.do("POST", path, opts) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: id, Err: err} @@ -899,14 +854,13 @@ func (c *Client) StopContainer(id string, timeout uint) error { // container request. // // See https://goo.gl/R9dZcV for more details. -//nolint:golint func (c *Client) StopContainerWithContext(id string, timeout uint, ctx context.Context) error { return c.stopContainer(id, timeout, doOptions{context: ctx}) } func (c *Client) stopContainer(id string, timeout uint, opts doOptions) error { path := fmt.Sprintf("/containers/%s/stop?t=%d", id, timeout) - resp, err := c.do(http.MethodPost, path, opts) + resp, err := c.do("POST", path, opts) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: id} @@ -926,7 +880,7 @@ func (c *Client) stopContainer(id string, timeout uint, opts doOptions) error { // See https://goo.gl/MrAKQ5 for more details. func (c *Client) RestartContainer(id string, timeout uint) error { path := fmt.Sprintf("/containers/%s/restart?t=%d", id, timeout) - resp, err := c.do(http.MethodPost, path, doOptions{}) + resp, err := c.do("POST", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: id} @@ -942,7 +896,7 @@ func (c *Client) RestartContainer(id string, timeout uint) error { // See https://goo.gl/D1Yaii for more details. func (c *Client) PauseContainer(id string) error { path := fmt.Sprintf("/containers/%s/pause", id) - resp, err := c.do(http.MethodPost, path, doOptions{}) + resp, err := c.do("POST", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: id} @@ -958,7 +912,7 @@ func (c *Client) PauseContainer(id string) error { // See https://goo.gl/sZ2faO for more details. func (c *Client) UnpauseContainer(id string) error { path := fmt.Sprintf("/containers/%s/unpause", id) - resp, err := c.do(http.MethodPost, path, doOptions{}) + resp, err := c.do("POST", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: id} @@ -988,7 +942,7 @@ func (c *Client) TopContainer(id string, psArgs string) (TopResult, error) { args = fmt.Sprintf("?ps_args=%s", psArgs) } path := fmt.Sprintf("/containers/%s/top%s", id, args) - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return result, &NoSuchContainer{ID: id} @@ -1095,7 +1049,6 @@ type CPUStats struct { UsageInKernelmode uint64 `json:"usage_in_kernelmode,omitempty" yaml:"usage_in_kernelmode,omitempty" toml:"usage_in_kernelmode,omitempty"` } `json:"cpu_usage,omitempty" yaml:"cpu_usage,omitempty" toml:"cpu_usage,omitempty"` SystemCPUUsage uint64 `json:"system_cpu_usage,omitempty" yaml:"system_cpu_usage,omitempty" toml:"system_cpu_usage,omitempty"` - OnlineCPUs uint64 `json:"online_cpus,omitempty" yaml:"online_cpus,omitempty" toml:"online_cpus,omitempty"` ThrottlingData struct { Periods uint64 `json:"periods,omitempty"` ThrottledPeriods uint64 `json:"throttled_periods,omitempty"` @@ -1144,8 +1097,13 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { defer func() { close(opts.Stats) - if err := <-errC; err != nil && retErr == nil { - retErr = err + select { + case err := <-errC: + if err != nil && retErr == nil { + retErr = err + } + default: + // No errors } if err := readCloser.Close(); err != nil && retErr == nil { @@ -1155,8 +1113,7 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { reqSent := make(chan struct{}) go func() { - defer close(errC) - err := c.stream(http.MethodGet, fmt.Sprintf("/containers/%s/stats?stream=%v", opts.ID, opts.Stream), streamOptions{ + err := c.stream("GET", fmt.Sprintf("/containers/%s/stats?stream=%v", opts.ID, opts.Stream), streamOptions{ rawJSONStream: true, useJSONDecoder: true, stdout: writeCloser, @@ -1177,6 +1134,7 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { err = closeErr } errC <- err + close(errC) }() quit := make(chan struct{}) @@ -1224,20 +1182,12 @@ type KillContainerOptions struct { // See https://goo.gl/JnTxXZ for more details. func (c *Client) KillContainer(opts KillContainerOptions) error { path := "/containers/" + opts.ID + "/kill" + "?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) + resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { - e, ok := err.(*Error) - if !ok { - return err - } - switch e.Status { - case http.StatusNotFound: + if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: opts.ID} - case http.StatusConflict: - return &ContainerNotRunning{ID: opts.ID} - default: - return err } + return err } resp.Body.Close() return nil @@ -1265,7 +1215,7 @@ type RemoveContainerOptions struct { // See https://goo.gl/hL5IPC for more details. func (c *Client) RemoveContainer(opts RemoveContainerOptions) error { path := "/containers/" + opts.ID + "?" + queryString(opts) - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) + resp, err := c.do("DELETE", path, doOptions{context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchContainer{ID: opts.ID} @@ -1294,7 +1244,7 @@ type UploadToContainerOptions struct { func (c *Client) UploadToContainer(id string, opts UploadToContainerOptions) error { url := fmt.Sprintf("/containers/%s/archive?", id) + queryString(opts) - return c.stream(http.MethodPut, url, streamOptions{ + return c.stream("PUT", url, streamOptions{ in: opts.InputStream, context: opts.Context, }) @@ -1317,7 +1267,7 @@ type DownloadFromContainerOptions struct { func (c *Client) DownloadFromContainer(id string, opts DownloadFromContainerOptions) error { url := fmt.Sprintf("/containers/%s/archive?", id) + queryString(opts) - return c.stream(http.MethodGet, url, streamOptions{ + return c.stream("GET", url, streamOptions{ setRawTerminal: true, stdout: opts.OutputStream, inactivityTimeout: opts.InactivityTimeout, @@ -1325,10 +1275,9 @@ func (c *Client) DownloadFromContainer(id string, opts DownloadFromContainerOpti }) } -// CopyFromContainerOptions contains the set of options used for copying -// files from a container. +// CopyFromContainerOptions has been DEPRECATED, please use DownloadFromContainerOptions along with DownloadFromContainer. // -// Deprecated: Use DownloadFromContainerOptions and DownloadFromContainer instead. +// See https://goo.gl/nWk2YQ for more details. type CopyFromContainerOptions struct { OutputStream io.Writer `json:"-"` Container string `json:"-"` @@ -1336,9 +1285,9 @@ type CopyFromContainerOptions struct { Context context.Context `json:"-"` } -// CopyFromContainer copies files from a container. +// CopyFromContainer has been DEPRECATED, please use DownloadFromContainerOptions along with DownloadFromContainer. // -// Deprecated: Use DownloadFromContainer and DownloadFromContainer instead. +// See https://goo.gl/nWk2YQ for more details. func (c *Client) CopyFromContainer(opts CopyFromContainerOptions) error { if opts.Container == "" { return &NoSuchContainer{ID: opts.Container} @@ -1350,7 +1299,7 @@ func (c *Client) CopyFromContainer(opts CopyFromContainerOptions) error { return errors.New("go-dockerclient: CopyFromContainer is no longer available in Docker >= 1.12, use DownloadFromContainer instead") } url := fmt.Sprintf("/containers/%s/copy", opts.Container) - resp, err := c.do(http.MethodPost, url, doOptions{ + resp, err := c.do("POST", url, doOptions{ data: opts, context: opts.Context, }) @@ -1378,13 +1327,12 @@ func (c *Client) WaitContainer(id string) (int, error) { // inspect request. // // See https://goo.gl/4AGweZ for more details. -//nolint:golint func (c *Client) WaitContainerWithContext(id string, ctx context.Context) (int, error) { return c.waitContainer(id, doOptions{context: ctx}) } func (c *Client) waitContainer(id string, opts doOptions) (int, error) { - resp, err := c.do(http.MethodPost, "/containers/"+id+"/wait", opts) + resp, err := c.do("POST", "/containers/"+id+"/wait", opts) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return 0, &NoSuchContainer{ID: id} @@ -1418,7 +1366,7 @@ type CommitContainerOptions struct { // See https://goo.gl/CzIguf for more details. func (c *Client) CommitContainer(opts CommitContainerOptions) (*Image, error) { path := "/commit?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ data: opts.Run, context: opts.Context, }) @@ -1453,9 +1401,6 @@ type AttachToContainerOptions struct { // to unexpected behavior. Success chan struct{} - // Override the key sequence for detaching a container. - DetachKeys string - // Use raw terminal? Usually true when the container contains a TTY. RawTerminal bool `qs:"-"` @@ -1495,7 +1440,7 @@ func (c *Client) AttachToContainerNonBlocking(opts AttachToContainerOptions) (Cl return nil, &NoSuchContainer{ID: opts.Container} } path := "/containers/" + opts.Container + "/attach?" + queryString(opts) - return c.hijack(http.MethodPost, path, hijackOptions{ + return c.hijack("POST", path, hijackOptions{ success: opts.Success, setRawTerminal: opts.RawTerminal, in: opts.InputStream, @@ -1533,7 +1478,7 @@ type LogsOptions struct { // stderr to LogsOptions.ErrorStream. // // When LogsOptions.RawTerminal is true, callers will get the raw stream on -// LogsOptions.OutputStream. The caller can use libraries such as dlog +// LogOptions.OutputStream. The caller can use libraries such as dlog // (github.com/ahmetalpbalkan/dlog). // // See https://goo.gl/krK0ZH for more details. @@ -1545,7 +1490,7 @@ func (c *Client) Logs(opts LogsOptions) error { opts.Tail = "all" } path := "/containers/" + opts.Container + "/logs?" + queryString(opts) - return c.stream(http.MethodGet, path, streamOptions{ + return c.stream("GET", path, streamOptions{ setRawTerminal: opts.RawTerminal, stdout: opts.OutputStream, stderr: opts.ErrorStream, @@ -1561,7 +1506,7 @@ func (c *Client) ResizeContainerTTY(id string, height, width int) error { params := make(url.Values) params.Set("h", strconv.Itoa(height)) params.Set("w", strconv.Itoa(width)) - resp, err := c.do(http.MethodPost, "/containers/"+id+"/resize?"+params.Encode(), doOptions{}) + resp, err := c.do("POST", "/containers/"+id+"/resize?"+params.Encode(), doOptions{}) if err != nil { return err } @@ -1589,7 +1534,7 @@ func (c *Client) ExportContainer(opts ExportContainerOptions) error { return &NoSuchContainer{ID: opts.ID} } url := fmt.Sprintf("/containers/%s/export", opts.ID) - return c.stream(http.MethodGet, url, streamOptions{ + return c.stream("GET", url, streamOptions{ setRawTerminal: true, stdout: opts.OutputStream, inactivityTimeout: opts.InactivityTimeout, @@ -1618,7 +1563,7 @@ type PruneContainersResults struct { // See https://goo.gl/wnkgDT for more details. func (c *Client) PruneContainers(opts PruneContainersOptions) (*PruneContainersResults, error) { path := "/containers/prune?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) + resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/container_test.go b/vendor/github.com/fsouza/go-dockerclient/container_test.go index 2e3c46cffcb3..a1b324767e55 100644 --- a/vendor/github.com/fsouza/go-dockerclient/container_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/container_test.go @@ -5,54 +5,53 @@ package docker import ( + "bufio" "bytes" - "context" "encoding/json" "errors" "fmt" "io/ioutil" + "net" "net/http" "net/http/httptest" "net/url" + "os" "reflect" "strconv" "strings" "testing" "time" + + "golang.org/x/net/context" ) func TestStateString(t *testing.T) { t.Parallel() started := time.Now().Add(-3 * time.Hour) - tests := []struct { - name string + var tests = []struct { input State expected string }{ - {"paused", State{Running: true, Paused: true, StartedAt: started}, "Up 3 hours (Paused)"}, - {"restarting", State{Running: true, Restarting: true, ExitCode: 7, FinishedAt: started}, "Restarting (7) 3 hours ago"}, - {"up", State{Running: true, StartedAt: started}, "Up 3 hours"}, - {"being removed", State{RemovalInProgress: true}, "Removal In Progress"}, - {"dead", State{Dead: true}, "Dead"}, - {"created", State{}, "Created"}, - {"no creation info", State{StartedAt: started}, ""}, - {"erro code", State{ExitCode: 7, StartedAt: started, FinishedAt: started}, "Exited (7) 3 hours ago"}, + {State{Running: true, Paused: true, StartedAt: started}, "Up 3 hours (Paused)"}, + {State{Running: true, Restarting: true, ExitCode: 7, FinishedAt: started}, "Restarting (7) 3 hours ago"}, + {State{Running: true, StartedAt: started}, "Up 3 hours"}, + {State{RemovalInProgress: true}, "Removal In Progress"}, + {State{Dead: true}, "Dead"}, + {State{}, "Created"}, + {State{StartedAt: started}, ""}, + {State{ExitCode: 7, StartedAt: started, FinishedAt: started}, "Exited (7) 3 hours ago"}, } for _, tt := range tests { - test := tt - t.Run(test.name, func(t *testing.T) { - t.Parallel() - if got := test.input.String(); got != test.expected { - t.Errorf("State.String(): wrong result. Want %q. Got %q.", test.expected, got) - } - }) + if got := tt.input.String(); got != tt.expected { + t.Errorf("State.String(): wrong result. Want %q. Got %q.", tt.expected, got) + } } } func TestStateStateString(t *testing.T) { t.Parallel() started := time.Now().Add(-3 * time.Hour) - tests := []struct { + var tests = []struct { input State expected string }{ @@ -64,13 +63,9 @@ func TestStateStateString(t *testing.T) { {State{StartedAt: started}, "exited"}, } for _, tt := range tests { - test := tt - t.Run(test.expected, func(t *testing.T) { - t.Parallel() - if got := test.input.StateString(); got != test.expected { - t.Errorf("State.String(): wrong result. Want %q. Got %q.", test.expected, got) - } - }) + if got := tt.input.StateString(); got != tt.expected { + t.Errorf("State.String(): wrong result. Want %q. Got %q.", tt.expected, got) + } } } @@ -127,7 +122,7 @@ func TestListContainers(t *testing.T) { func TestListContainersParams(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input ListContainersOptions params map[string][]string }{ @@ -147,33 +142,30 @@ func TestListContainersParams(t *testing.T) { map[string][]string{"all": {"1"}, "filters": {"{\"exited\":[\"0\"],\"status\":[\"exited\"]}"}}, }, } - const expectedPath = "/containers/json" + fakeRT := &FakeRoundTripper{message: "[]", status: http.StatusOK} + client := newTestClient(fakeRT) + u, _ := url.Parse(client.getURL("/containers/json")) for _, tt := range tests { - test := tt - t.Run("", func(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "[]", status: http.StatusOK} - client := newTestClient(fakeRT) - if _, err := client.ListContainers(test.input); err != nil { - t.Error(err) - } - got := map[string][]string(fakeRT.requests[0].URL.Query()) - if !reflect.DeepEqual(got, test.params) { - t.Errorf("Expected %#v, got %#v.", test.params, got) - } - if path := fakeRT.requests[0].URL.Path; path != expectedPath { - t.Errorf("Wrong path on request. Want %q. Got %q.", expectedPath, path) - } - if meth := fakeRT.requests[0].Method; meth != http.MethodGet { - t.Errorf("Wrong HTTP method. Want GET. Got %s.", meth) - } - }) + if _, err := client.ListContainers(tt.input); err != nil { + t.Error(err) + } + got := map[string][]string(fakeRT.requests[0].URL.Query()) + if !reflect.DeepEqual(got, tt.params) { + t.Errorf("Expected %#v, got %#v.", tt.params, got) + } + if path := fakeRT.requests[0].URL.Path; path != u.Path { + t.Errorf("Wrong path on request. Want %q. Got %q.", u.Path, path) + } + if meth := fakeRT.requests[0].Method; meth != "GET" { + t.Errorf("Wrong HTTP method. Want GET. Got %s.", meth) + } + fakeRT.Reset() } } func TestListContainersFailure(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { status int message string }{ @@ -181,19 +173,15 @@ func TestListContainersFailure(t *testing.T) { {500, "internal server error"}, } for _, tt := range tests { - test := tt - t.Run(strconv.Itoa(test.status), func(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: test.message, status: test.status}) - expected := Error{Status: test.status, Message: test.message} - containers, err := client.ListContainers(ListContainersOptions{}) - if !reflect.DeepEqual(expected, *err.(*Error)) { - t.Errorf("Wrong error in ListContainers. Want %#v. Got %#v.", expected, err) - } - if len(containers) > 0 { - t.Errorf("ListContainers failure. Expected empty list. Got %#v.", containers) - } - }) + client := newTestClient(&FakeRoundTripper{message: tt.message, status: tt.status}) + expected := Error{Status: tt.status, Message: tt.message} + containers, err := client.ListContainers(ListContainersOptions{}) + if !reflect.DeepEqual(expected, *err.(*Error)) { + t.Errorf("Wrong error in ListContainers. Want %#v. Got %#v.", expected, err) + } + if len(containers) > 0 { + t.Errorf("ListContainers failure. Expected empty list. Got %#v.", containers) + } } } @@ -229,10 +217,7 @@ func TestInspectContainer(t *testing.T) { ], "Ulimits": [ { "Name": "nofile", "Soft": 1024, "Hard": 2048 } - ], - "Shell": [ - "/bin/sh", "-c" - ] + ] }, "State": { "Running": false, @@ -456,124 +441,6 @@ func TestInspectContainerWithContext(t *testing.T) { } } -func TestInspectContainerWithOptions(t *testing.T) { - t.Parallel() - jsonContainer := `{ - "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", - "AppArmorProfile": "Profile", - "Created": "2013-05-07T14:51:42.087658+02:00", - "Path": "date", - "Args": [], - "Config": { - "Hostname": "4fa6e0f0c678", - "User": "", - "Memory": 17179869184, - "MemorySwap": 34359738368, - "AttachStdin": false, - "AttachStdout": true, - "AttachStderr": true, - "PortSpecs": null, - "Tty": false, - "OpenStdin": false, - "StdinOnce": false, - "Env": null, - "Cmd": [ - "date" - ], - "Image": "base", - "Volumes": {}, - "VolumesFrom": "", - "SecurityOpt": [ - "label:user:USER" - ], - "Ulimits": [ - { "Name": "nofile", "Soft": 1024, "Hard": 2048 } - ], - "Shell": [ - "/bin/sh", "-c" - ] - }, - "State": { - "Running": false, - "Pid": 0, - "ExitCode": 0, - "StartedAt": "2013-05-07T14:51:42.087658+02:00", - "Ghost": false - }, - "Node": { - "ID": "4I4E:QR4I:Z733:QEZK:5X44:Q4T7:W2DD:JRDY:KB2O:PODO:Z5SR:XRB6", - "IP": "192.168.99.105", - "Addra": "192.168.99.105:2376", - "Name": "node-01", - "Cpus": 4, - "Memory": 1048436736, - "Labels": { - "executiondriver": "native-0.2", - "kernelversion": "3.18.5-tinycore64", - "operatingsystem": "Boot2Docker 1.5.0 (TCL 5.4); master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015", - "provider": "virtualbox", - "storagedriver": "aufs" - } - }, - "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - "NetworkSettings": { - "IpAddress": "", - "IpPrefixLen": 0, - "Gateway": "", - "Bridge": "", - "PortMapping": null - }, - "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", - "ResolvConfPath": "/etc/resolv.conf", - "Volumes": {}, - "HostConfig": { - "Binds": null, - "ContainerIDFile": "", - "LxcConf": [], - "Privileged": false, - "PortBindings": { - "80/tcp": [ - { - "HostIp": "0.0.0.0", - "HostPort": "49153" - } - ] - }, - "Links": null, - "PublishAllPorts": false, - "CgroupParent": "/mesos", - "Memory": 17179869184, - "MemorySwap": 34359738368, - "GroupAdd": ["fake", "12345"], - "OomScoreAdj": 642, - "SizeRw": 3, - "SizeRootFs": 5552693 - } -}` - var expected Container - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - const id = "4fa6e0f0c678" - container, err := client.InspectContainerWithOptions(InspectContainerOptions{ - ID: id, - Size: true, - }) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*container, expected) { - t.Errorf("InspectContainer(%q): Expected %#v. Got %#v.", id, expected, container) - } - expectedURL, _ := url.Parse(client.getURL("/containers/4fa6e0f0c678/json?size=true")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("InspectContainer(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - func TestInspectContainerNetwork(t *testing.T) { t.Parallel() jsonContainer := `{ @@ -815,6 +682,7 @@ func TestInspectContainerNetwork(t *testing.T) { } else { t.Errorf("InspectContainerNetworks(%q): No method Networks for NetworkSettings", id) } + } func TestInspectContainerNegativeSwap(t *testing.T) { @@ -915,13 +783,15 @@ func TestInspectContainerFailure(t *testing.T) { func TestInspectContainerNotFound(t *testing.T) { t.Parallel() - const containerID = "abe033" client := newTestClient(&FakeRoundTripper{message: "no such container", status: 404}) - container, err := client.InspectContainer(containerID) + container, err := client.InspectContainer("abe033") if container != nil { t.Errorf("InspectContainer: Expected container, got %#v", container) } - expectNoSuchContainer(t, containerID, err) + expected := &NoSuchContainer{ID: "abe033"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("InspectContainer: Wrong error information. Want %#v. Got %#v.", expected, err) + } } func TestContainerChanges(t *testing.T) { @@ -976,13 +846,15 @@ func TestContainerChangesFailure(t *testing.T) { func TestContainerChangesNotFound(t *testing.T) { t.Parallel() - const containerID = "abe033" client := newTestClient(&FakeRoundTripper{message: "no such container", status: 404}) - changes, err := client.ContainerChanges(containerID) + changes, err := client.ContainerChanges("abe033") if changes != nil { t.Errorf("ContainerChanges: Expected changes, got %#v", changes) } - expectNoSuchContainer(t, containerID, err) + expected := &NoSuchContainer{ID: "abe033"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("ContainerChanges: Wrong error information. Want %#v. Got %#v.", expected, err) + } } func TestCreateContainer(t *testing.T) { @@ -1009,8 +881,8 @@ func TestCreateContainer(t *testing.T) { t.Errorf("CreateContainer: wrong ID. Want %q. Got %q.", id, container.ID) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("CreateContainer: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("CreateContainer: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/create")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1025,13 +897,13 @@ func TestCreateContainer(t *testing.T) { func TestCreateContainerImageNotFound(t *testing.T) { t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "No such image: whatever", status: http.StatusNotFound}) + client := newTestClient(&FakeRoundTripper{message: "No such image", status: http.StatusNotFound}) config := Config{AttachStdout: true, AttachStdin: true} container, err := client.CreateContainer(CreateContainerOptions{Config: &config}) if container != nil { t.Errorf("CreateContainer: expected container, got %#v.", container) } - if !errors.Is(err, ErrNoSuchImage) { + if !reflect.DeepEqual(err, ErrNoSuchImage) { t.Errorf("CreateContainer: Wrong error type. Want %#v. Got %#v.", ErrNoSuchImage, err) } } @@ -1097,8 +969,8 @@ func TestUpdateContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateContainer: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("UpdateContainer: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/update")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1127,8 +999,8 @@ func TestStartContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1151,8 +1023,8 @@ func TestStartContainerHostConfigAPI124(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1178,8 +1050,8 @@ func TestStartContainerNilHostConfig(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1215,8 +1087,8 @@ func TestStartContainerWithContext(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StartContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/start")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1236,7 +1108,10 @@ func TestStartContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.StartContainer("a2344", &HostConfig{}) - expectNoSuchContainer(t, "a2344", err) + expected := &NoSuchContainer{ID: "a2344", Err: err.(*NoSuchContainer).Err} + if !reflect.DeepEqual(err, expected) { + t.Errorf("StartContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestStartContainerAlreadyRunning(t *testing.T) { @@ -1259,8 +1134,8 @@ func TestStopContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StopContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StopContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/stop")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1287,8 +1162,8 @@ func TestStopContainerWithContext(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("StopContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("StopContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/stop")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1304,7 +1179,10 @@ func TestStopContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.StopContainer("a2334", 10) - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("StopContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestStopContainerNotRunning(t *testing.T) { @@ -1327,8 +1205,8 @@ func TestRestartContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("RestartContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("RestartContainer(%q, 10): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/restart")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1340,7 +1218,10 @@ func TestRestartContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.RestartContainer("a2334", 10) - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("RestartContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestPauseContainer(t *testing.T) { @@ -1353,8 +1234,8 @@ func TestPauseContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/pause")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1366,7 +1247,10 @@ func TestPauseContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.PauseContainer("a2334") - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("PauseContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestUnpauseContainer(t *testing.T) { @@ -1379,8 +1263,8 @@ func TestUnpauseContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("PauseContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/unpause")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1392,7 +1276,10 @@ func TestUnpauseContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.UnpauseContainer("a2334") - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("PauseContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestKillContainer(t *testing.T) { @@ -1405,8 +1292,8 @@ func TestKillContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/kill")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1424,8 +1311,8 @@ func TestKillContainerSignal(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("KillContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } if signal := req.URL.Query().Get("signal"); signal != "15" { t.Errorf("KillContainer(%q): Wrong query string in request. Want %q. Got %q.", id, "15", signal) @@ -1436,16 +1323,7 @@ func TestKillContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.KillContainer(KillContainerOptions{ID: "a2334"}) - expectNoSuchContainer(t, "a2334", err) -} - -func TestKillContainerNotRunning(t *testing.T) { - t.Parallel() - id := "abcd1234567890" - msg := fmt.Sprintf("Cannot kill container: %[1]s: Container %[1]s is not running", id) - client := newTestClient(&FakeRoundTripper{message: msg, status: http.StatusConflict}) - err := client.KillContainer(KillContainerOptions{ID: id}) - expected := &ContainerNotRunning{ID: id} + expected := &NoSuchContainer{ID: "a2334"} if !reflect.DeepEqual(err, expected) { t.Errorf("KillContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) } @@ -1462,8 +1340,8 @@ func TestRemoveContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodDelete { - t.Errorf("RemoveContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodDelete, req.Method) + if req.Method != "DELETE" { + t.Errorf("RemoveContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "DELETE", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id)) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1493,7 +1371,10 @@ func TestRemoveContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) err := client.RemoveContainer(RemoveContainerOptions{ID: "a2334"}) - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("RemoveContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestResizeContainerTTY(t *testing.T) { @@ -1506,8 +1387,8 @@ func TestResizeContainerTTY(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("ResizeContainerTTY(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("ResizeContainerTTY(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/resize")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1536,8 +1417,8 @@ func TestWaitContainer(t *testing.T) { t.Errorf("WaitContainer(%q): wrong return. Want 56. Got %d.", id, status) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("WaitContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("WaitContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/wait")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1570,8 +1451,8 @@ func TestWaitContainerWithContext(t *testing.T) { t.Errorf("WaitContainer(%q): wrong return. Want 56. Got %d.", id, status) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("WaitContainer(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("WaitContainer(%q): wrong HTTP method. Want %q. Got %q.", id, "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/" + id + "/wait")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -1587,7 +1468,10 @@ func TestWaitContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) _, err := client.WaitContainer("a2334") - expectNoSuchContainer(t, "a2334", err) + expected := &NoSuchContainer{ID: "a2334"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("WaitContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestCommitContainer(t *testing.T) { @@ -1608,7 +1492,7 @@ func TestCommitContainerParams(t *testing.T) { t.Parallel() cfg := Config{Memory: 67108864} json, _ := json.Marshal(&cfg) - tests := []struct { + var tests = []struct { input CommitContainerOptions params map[string][]string body []byte @@ -1626,36 +1510,33 @@ func TestCommitContainerParams(t *testing.T) { json, }, } - const expectedPath = "/commit" + fakeRT := &FakeRoundTripper{message: "{}", status: http.StatusOK} + client := newTestClient(fakeRT) + u, _ := url.Parse(client.getURL("/commit")) for _, tt := range tests { - test := tt - t.Run("", func(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "{}", status: http.StatusOK} - client := newTestClient(fakeRT) - if _, err := client.CommitContainer(test.input); err != nil { - t.Error(err) - } - got := map[string][]string(fakeRT.requests[0].URL.Query()) - if !reflect.DeepEqual(got, test.params) { - t.Errorf("Expected %#v, got %#v.", test.params, got) - } - if path := fakeRT.requests[0].URL.Path; path != expectedPath { - t.Errorf("Wrong path on request. Want %q. Got %q.", expectedPath, path) - } - if meth := fakeRT.requests[0].Method; meth != http.MethodPost { - t.Errorf("Wrong HTTP method. Want POST. Got %s.", meth) - } - if test.body != nil { - if requestBody, err := ioutil.ReadAll(fakeRT.requests[0].Body); err == nil { - if !bytes.Equal(requestBody, test.body) { - t.Errorf("Expected body %#v, got %#v", test.body, requestBody) - } - } else { - t.Errorf("Error reading request body: %#v", err) + if _, err := client.CommitContainer(tt.input); err != nil { + t.Error(err) + } + got := map[string][]string(fakeRT.requests[0].URL.Query()) + if !reflect.DeepEqual(got, tt.params) { + t.Errorf("Expected %#v, got %#v.", tt.params, got) + } + if path := fakeRT.requests[0].URL.Path; path != u.Path { + t.Errorf("Wrong path on request. Want %q. Got %q.", u.Path, path) + } + if meth := fakeRT.requests[0].Method; meth != "POST" { + t.Errorf("Wrong HTTP method. Want POST. Got %s.", meth) + } + if tt.body != nil { + if requestBody, err := ioutil.ReadAll(fakeRT.requests[0].Body); err == nil { + if !bytes.Equal(requestBody, tt.body) { + t.Errorf("Expected body %#v, got %#v", tt.body, requestBody) } + } else { + t.Errorf("Error reading request body: %#v", err) } - }) + } + fakeRT.Reset() } } @@ -1672,7 +1553,10 @@ func TestCommitContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) _, err := client.CommitContainer(CommitContainerOptions{}) - expectNoSuchContainer(t, "", err) + expected := &NoSuchContainer{ID: ""} + if !reflect.DeepEqual(err, expected) { + t.Errorf("CommitContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestAttachToContainerLogs(t *testing.T) { @@ -1702,7 +1586,7 @@ func TestAttachToContainerLogs(t *testing.T) { if buf.String() != expected { t.Errorf("AttachToContainer for logs: wrong output. Want %q. Got %q.", expected, buf.String()) } - if req.Method != http.MethodPost { + if req.Method != "POST" { t.Errorf("AttachToContainer: wrong HTTP method. Want POST. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/containers/a123456/attach")) @@ -1722,7 +1606,7 @@ func TestAttachToContainerLogs(t *testing.T) { func TestAttachToContainer(t *testing.T) { t.Parallel() - reader := strings.NewReader("send value") + var reader = strings.NewReader("send value") var req http.Request server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) @@ -1762,8 +1646,8 @@ func TestAttachToContainer(t *testing.T) { func TestAttachToContainerSentinel(t *testing.T) { t.Parallel() - reader := strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + var reader = strings.NewReader("send value") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) w.Write([]byte("hello")) })) @@ -1796,8 +1680,8 @@ func TestAttachToContainerSentinel(t *testing.T) { func TestAttachToContainerNilStdout(t *testing.T) { t.Parallel() - reader := strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + var reader = strings.NewReader("send value") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) w.Write([]byte("hello")) })) @@ -1824,8 +1708,8 @@ func TestAttachToContainerNilStdout(t *testing.T) { func TestAttachToContainerNilStderr(t *testing.T) { t.Parallel() - reader := strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + var reader = strings.NewReader("send value") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) w.Write([]byte("hello")) })) @@ -1851,10 +1735,10 @@ func TestAttachToContainerNilStderr(t *testing.T) { func TestAttachToContainerStdinOnly(t *testing.T) { t.Parallel() - reader := strings.NewReader("send value") + var reader = strings.NewReader("send value") serverFinished := make(chan struct{}) clientFinished := make(chan struct{}) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) hj, ok := w.(http.Hijacker) if !ok { @@ -1956,7 +1840,10 @@ func TestAttachToContainerWithoutContainer(t *testing.T) { t.Parallel() var client Client err := client.AttachToContainer(AttachToContainerOptions{}) - expectNoSuchContainer(t, "", err) + expected := &NoSuchContainer{ID: ""} + if !reflect.DeepEqual(err, expected) { + t.Errorf("AttachToContainer: wrong error. Want %#v. Got %#v.", expected, err) + } } func TestLogs(t *testing.T) { @@ -1988,7 +1875,7 @@ func TestLogs(t *testing.T) { if buf.String() != expected { t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) } - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/containers/a123456/logs")) @@ -2010,7 +1897,7 @@ func TestLogs(t *testing.T) { func TestLogsNilStdoutDoesntFail(t *testing.T) { t.Parallel() - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { prefix := []byte{1, 0, 0, 0, 0, 0, 0, 19} w.Write(prefix) w.Write([]byte("something happened!")) @@ -2033,7 +1920,7 @@ func TestLogsNilStdoutDoesntFail(t *testing.T) { func TestLogsNilStderrDoesntFail(t *testing.T) { t.Parallel() - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { prefix := []byte{2, 0, 0, 0, 0, 0, 0, 19} w.Write(prefix) w.Write([]byte("something happened!")) @@ -2084,7 +1971,7 @@ func TestLogsSpecifyingTail(t *testing.T) { if buf.String() != expected { t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) } - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/containers/a123456/logs")) @@ -2106,7 +1993,7 @@ func TestLogsSpecifyingTail(t *testing.T) { func TestLogsRawTerminal(t *testing.T) { t.Parallel() - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("something happened!")) })) defer server.Close() @@ -2137,12 +2024,15 @@ func TestLogsNoContainer(t *testing.T) { t.Parallel() var client Client err := client.Logs(LogsOptions{}) - expectNoSuchContainer(t, "", err) + expected := &NoSuchContainer{ID: ""} + if !reflect.DeepEqual(err, expected) { + t.Errorf("AttachToContainer: wrong error. Want %#v. Got %#v.", expected, err) + } } func TestNoSuchContainerError(t *testing.T) { t.Parallel() - err := &NoSuchContainer{ID: "i345"} + var err = &NoSuchContainer{ID: "i345"} expected := "No such container: i345" if got := err.Error(); got != expected { t.Errorf("NoSuchContainer: wrong message. Want %q. Got %q.", expected, got) @@ -2151,7 +2041,7 @@ func TestNoSuchContainerError(t *testing.T) { func TestNoSuchContainerErrorMessage(t *testing.T) { t.Parallel() - err := &NoSuchContainer{ID: "i345", Err: errors.New("some advanced error info")} + var err = &NoSuchContainer{ID: "i345", Err: errors.New("some advanced error info")} expected := "some advanced error info" if got := err.Error(); got != expected { t.Errorf("NoSuchContainer: wrong message. Want %q. Got %q.", expected, got) @@ -2173,6 +2063,38 @@ func TestExportContainer(t *testing.T) { } } +func runStreamConnServer(t *testing.T, network, laddr string, listening chan<- string, done chan<- int, containerID string) { + defer close(done) + l, err := net.Listen(network, laddr) + if err != nil { + t.Errorf("Listen(%q, %q) failed: %v", network, laddr, err) + listening <- "" + return + } + defer l.Close() + listening <- l.Addr().String() + c, err := l.Accept() + if err != nil { + t.Logf("Accept failed: %v", err) + return + } + defer c.Close() + breader := bufio.NewReader(c) + req, err := http.ReadRequest(breader) + if err != nil { + t.Fatal(err) + } + if path := "/containers/" + containerID + "/export"; req.URL.Path != path { + t.Errorf("wrong path. Want %q. Got %q", path, req.URL.Path) + return + } + c.Write([]byte("HTTP/1.1 200 OK\n\nexported container tar content")) +} + +func tempfile(filename string) string { + return os.TempDir() + "/" + filename + "." + strconv.Itoa(os.Getpid()) +} + func TestExportContainerNoId(t *testing.T) { t.Parallel() client := Client{} @@ -2204,13 +2126,14 @@ func TestUploadToContainer(t *testing.T) { req := fakeRT.requests[0] - if req.Method != http.MethodPut { + if req.Method != "PUT" { t.Errorf("UploadToContainer{Path:abc}: Wrong HTTP method. Want PUT. Got %s", req.Method) } if pathParam := req.URL.Query().Get("path"); pathParam != "abc" { t.Errorf("ListImages({Path:abc}): Wrong parameter. Want path=abc. Got path=%s", pathParam) } + } func TestDownloadFromContainer(t *testing.T) { @@ -2405,16 +2328,20 @@ func TestTopContainerNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such container", status: http.StatusNotFound}) _, err := client.TopContainer("abef348", "") - expectNoSuchContainer(t, "abef348", err) + expected := &NoSuchContainer{ID: "abef348"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("StopContainer: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestTopContainerWithPsArgs(t *testing.T) { t.Parallel() fakeRT := &FakeRoundTripper{message: "no such container", status: http.StatusNotFound} client := newTestClient(fakeRT) - _, err := client.TopContainer("abef348", "aux") - expectNoSuchContainer(t, "abef348", err) - + expectedErr := &NoSuchContainer{ID: "abef348"} + if _, err := client.TopContainer("abef348", "aux"); !reflect.DeepEqual(expectedErr, err) { + t.Errorf("TopContainer: Expected %v. Got %v.", expectedErr, err) + } expectedURI := "/containers/abef348/top?ps_args=aux" if !strings.HasSuffix(fakeRT.requests[0].URL.String(), expectedURI) { t.Errorf("TopContainer: Expected URI to have %q. Got %q.", expectedURI, fakeRT.requests[0].URL.String()) @@ -2534,8 +2461,7 @@ func TestStats(t *testing.T) { "total_usage" : 36488948, "usage_in_kernelmode" : 20000000 }, - "system_cpu_usage" : 20091722000000000, - "online_cpus": 4 + "system_cpu_usage" : 20091722000000000 }, "precpu_stats" : { "cpu_usage" : { @@ -2549,8 +2475,7 @@ func TestStats(t *testing.T) { "total_usage" : 36488948, "usage_in_kernelmode" : 20000000 }, - "system_cpu_usage" : 20091722000000000, - "online_cpus": 4 + "system_cpu_usage" : 20091722000000000 } }` // 1 second later, cache is 100 @@ -2654,8 +2579,7 @@ func TestStats(t *testing.T) { "total_usage" : 36488948, "usage_in_kernelmode" : 20000000 }, - "system_cpu_usage" : 20091722000000000, - "online_cpus": 4 + "system_cpu_usage" : 20091722000000000 }, "precpu_stats" : { "cpu_usage" : { @@ -2669,8 +2593,7 @@ func TestStats(t *testing.T) { "total_usage" : 36488948, "usage_in_kernelmode" : 20000000 }, - "system_cpu_usage" : 20091722000000000, - "online_cpus": 4 + "system_cpu_usage" : 20091722000000000 } }` var expected1 Stats @@ -2724,7 +2647,7 @@ func TestStats(t *testing.T) { if !reflect.DeepEqual(resultStats[1], &expected2) { t.Errorf("Stats: Expected:\n%+v\nGot:\n%+v", expected2, resultStats[1]) } - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Stats: wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/containers/" + id + "/stats")) @@ -2740,7 +2663,10 @@ func TestStatsContainerNotFound(t *testing.T) { done := make(chan bool) defer close(done) err := client.Stats(StatsOptions{ID: "abef348", Stats: statsC, Stream: true, Done: done}) - expectNoSuchContainer(t, "abef348", err) + expected := &NoSuchContainer{ID: "abef348"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("Stats: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestRenameContainer(t *testing.T) { @@ -2753,8 +2679,8 @@ func TestRenameContainer(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("RenameContainer: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("RenameContainer: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/something_old/rename?name=something_new")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -2775,7 +2701,7 @@ type sleepyRoudTripper struct { func (rt *sleepyRoudTripper) RoundTrip(r *http.Request) (*http.Response, error) { time.Sleep(rt.sleepDuration) - return nil, errors.New("Can't complete round trip") + return nil, fmt.Errorf("Can't complete round trip") } func TestInspectContainerWhenContextTimesOut(t *testing.T) { @@ -2810,11 +2736,11 @@ func TestStartContainerWhenContextTimesOut(t *testing.T) { func TestStopContainerWhenContextTimesOut(t *testing.T) { t.Parallel() - rt := sleepyRoudTripper{sleepDuration: 300 * time.Millisecond} + rt := sleepyRoudTripper{sleepDuration: 200 * time.Millisecond} client := newTestClient(&rt) - ctx, cancel := context.WithTimeout(context.TODO(), 50*time.Millisecond) + ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond) defer cancel() err := client.StopContainerWithContext("id", 10, ctx) diff --git a/vendor/github.com/fsouza/go-dockerclient/container_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/container_unix_test.go index ae960c1b92a5..5dab6025ce98 100644 --- a/vendor/github.com/fsouza/go-dockerclient/container_unix_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/container_unix_test.go @@ -13,7 +13,6 @@ import ( "net/http" "os" "path/filepath" - "strconv" "testing" "time" ) @@ -107,36 +106,3 @@ func TestStatsTimeoutUnixSocket(t *testing.T) { t.Fatalf("Timeout waiting to receive message after %v", recvTimeout) } } - -func runStreamConnServer(t *testing.T, network, laddr string, listening chan<- string, done chan<- int, containerID string) { - defer close(done) - l, err := net.Listen(network, laddr) - if err != nil { - t.Errorf("Listen(%q, %q) failed: %v", network, laddr, err) - listening <- "" - return - } - defer l.Close() - listening <- l.Addr().String() - c, err := l.Accept() - if err != nil { - t.Logf("Accept failed: %v", err) - return - } - defer c.Close() - breader := bufio.NewReader(c) - req, err := http.ReadRequest(breader) - if err != nil { - t.Error(err) - return - } - if path := "/containers/" + containerID + "/export"; req.URL.Path != path { - t.Errorf("wrong path. Want %q. Got %q", path, req.URL.Path) - return - } - c.Write([]byte("HTTP/1.1 200 OK\n\nexported container tar content")) -} - -func tempfile(filename string) string { - return os.TempDir() + "/" + filename + "." + strconv.Itoa(os.Getpid()) -} diff --git a/vendor/github.com/fsouza/go-dockerclient/distribution.go b/vendor/github.com/fsouza/go-dockerclient/distribution.go index 6e5e12f7dd3f..d0f8ce74cc78 100644 --- a/vendor/github.com/fsouza/go-dockerclient/distribution.go +++ b/vendor/github.com/fsouza/go-dockerclient/distribution.go @@ -6,7 +6,6 @@ package docker import ( "encoding/json" - "net/http" "github.com/docker/docker/api/types/registry" ) @@ -14,7 +13,7 @@ import ( // InspectDistribution returns image digest and platform information by contacting the registry func (c *Client) InspectDistribution(name string) (*registry.DistributionInspect, error) { path := "/distribution/" + name + "/json" - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/distribution_test.go b/vendor/github.com/fsouza/go-dockerclient/distribution_test.go index ccd1e3b1ed7e..bb9a9ca0bb87 100644 --- a/vendor/github.com/fsouza/go-dockerclient/distribution_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/distribution_test.go @@ -1,7 +1,3 @@ -// Copyright 2017 go-dockerclient 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 docker import ( diff --git a/vendor/github.com/fsouza/go-dockerclient/env.go b/vendor/github.com/fsouza/go-dockerclient/env.go index 0f2e72f11825..13fedfb17e9d 100644 --- a/vendor/github.com/fsouza/go-dockerclient/env.go +++ b/vendor/github.com/fsouza/go-dockerclient/env.go @@ -156,7 +156,7 @@ func (env *Env) SetAuto(key string, value interface{}) { // Map returns the map representation of the env. func (env *Env) Map() map[string]string { - if env == nil || len(*env) == 0 { + if len(*env) == 0 { return nil } m := make(map[string]string) diff --git a/vendor/github.com/fsouza/go-dockerclient/env_test.go b/vendor/github.com/fsouza/go-dockerclient/env_test.go index 1570b7b05911..5f844d0fb869 100644 --- a/vendor/github.com/fsouza/go-dockerclient/env_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/env_test.go @@ -14,7 +14,7 @@ import ( func TestGet(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input []string query string expected string @@ -25,21 +25,17 @@ func TestGet(t *testing.T) { {[]string{"WAT="}, "WAT", ""}, } for _, tt := range tests { - test := tt - t.Run("", func(t *testing.T) { - t.Parallel() - env := Env(test.input) - got := env.Get(test.query) - if got != test.expected { - t.Errorf("Env.Get(%q): wrong result. Want %q. Got %q", test.query, test.expected, got) - } - }) + env := Env(tt.input) + got := env.Get(tt.query) + if got != tt.expected { + t.Errorf("Env.Get(%q): wrong result. Want %q. Got %q", tt.query, tt.expected, got) + } } } func TestExists(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input []string query string expected bool @@ -49,34 +45,23 @@ func TestExists(t *testing.T) { {[]string{"PATH=/usr/bin:/bin", "PYTHONPATH=/usr/local"}, "PYTHONPATHI", false}, } for _, tt := range tests { - test := tt - t.Run("", func(t *testing.T) { - t.Parallel() - env := Env(test.input) - got := env.Exists(test.query) - if got != test.expected { - t.Errorf("Env.Exists(%q): wrong result. Want %v. Got %v", test.query, test.expected, got) - } - }) + env := Env(tt.input) + got := env.Exists(tt.query) + if got != tt.expected { + t.Errorf("Env.Exists(%q): wrong result. Want %v. Got %v", tt.query, tt.expected, got) + } } } func TestGetBool(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expected bool }{ - {"EMPTY_VAR", false}, - {"ZERO_VAR", false}, - {"NO_VAR", false}, - {"FALSE_VAR", false}, - {"NONE_VAR", false}, - {"TRUE_VAR", true}, - {"WAT", true}, - {"PATH", true}, - {"ONE_VAR", true}, - {"NO_VAR_TAB", false}, + {"EMTPY_VAR", false}, {"ZERO_VAR", false}, {"NO_VAR", false}, + {"FALSE_VAR", false}, {"NONE_VAR", false}, {"TRUE_VAR", true}, + {"WAT", true}, {"PATH", true}, {"ONE_VAR", true}, {"NO_VAR_TAB", false}, } env := Env([]string{ "EMPTY_VAR=", "ZERO_VAR=0", "NO_VAR=no", "FALSE_VAR=false", @@ -84,24 +69,20 @@ func TestGetBool(t *testing.T) { "ONE_VAR=1", "NO_VAR_TAB=0 \t\t\t", }) for _, tt := range tests { - test := tt - t.Run(test.input, func(t *testing.T) { - got := env.GetBool(test.input) - if got != test.expected { - t.Errorf("Env.GetBool(%q): wrong result. Want %v. Got %v.", test.input, test.expected, got) - } - }) + got := env.GetBool(tt.input) + if got != tt.expected { + t.Errorf("Env.GetBool(%q): wrong result. Want %v. Got %v.", tt.input, tt.expected, got) + } } } func TestSetBool(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input bool expected string }{ - {true, "1"}, - {false, "0"}, + {true, "1"}, {false, "0"}, } for _, tt := range tests { var env Env @@ -114,101 +95,71 @@ func TestSetBool(t *testing.T) { func TestGetInt(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expected int }{ - {"NEGATIVE_INTEGER", -10}, - {"NON_INTEGER", -1}, - {"ONE", 1}, - {"TWO", 2}, + {"NEGATIVE_INTEGER", -10}, {"NON_INTEGER", -1}, {"ONE", 1}, {"TWO", 2}, } env := Env([]string{"NEGATIVE_INTEGER=-10", "NON_INTEGER=wat", "ONE=1", "TWO=2"}) for _, tt := range tests { - test := tt - t.Run(test.input, func(t *testing.T) { - t.Parallel() - got := env.GetInt(test.input) - if got != test.expected { - t.Errorf("Env.GetInt(%q): wrong result. Want %d. Got %d", test.input, test.expected, got) - } - }) + got := env.GetInt(tt.input) + if got != tt.expected { + t.Errorf("Env.GetInt(%q): wrong result. Want %d. Got %d", tt.input, tt.expected, got) + } } } func TestSetInt(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input int expected string }{ - {10, "10"}, - {13, "13"}, - {7, "7"}, - {33, "33"}, - {0, "0"}, - {-34, "-34"}, + {10, "10"}, {13, "13"}, {7, "7"}, {33, "33"}, + {0, "0"}, {-34, "-34"}, } for _, tt := range tests { - test := tt - t.Run(test.expected, func(t *testing.T) { - t.Parallel() - var env Env - env.SetInt("SOME", test.input) - if got := env.Get("SOME"); got != test.expected { - t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", test.input, test.expected, got) - } - }) + var env Env + env.SetInt("SOME", tt.input) + if got := env.Get("SOME"); got != tt.expected { + t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", tt.input, tt.expected, got) + } } } func TestGetInt64(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expected int64 }{ - {"NEGATIVE_INTEGER", -10}, - {"NON_INTEGER", -1}, - {"ONE", 1}, - {"TWO", 2}, + {"NEGATIVE_INTEGER", -10}, {"NON_INTEGER", -1}, {"ONE", 1}, {"TWO", 2}, } env := Env([]string{"NEGATIVE_INTEGER=-10", "NON_INTEGER=wat", "ONE=1", "TWO=2"}) for _, tt := range tests { - test := tt - t.Run(test.input, func(t *testing.T) { - t.Parallel() - got := env.GetInt64(test.input) - if got != test.expected { - t.Errorf("Env.GetInt64(%q): wrong result. Want %d. Got %d", test.input, test.expected, got) - } - }) + got := env.GetInt64(tt.input) + if got != tt.expected { + t.Errorf("Env.GetInt64(%q): wrong result. Want %d. Got %d", tt.input, tt.expected, got) + } } } func TestSetInt64(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input int64 expected string }{ - {10, "10"}, - {13, "13"}, - {7, "7"}, - {33, "33"}, - {0, "0"}, - {-34, "-34"}, + {10, "10"}, {13, "13"}, {7, "7"}, {33, "33"}, + {0, "0"}, {-34, "-34"}, } for _, tt := range tests { - test := tt - t.Run(test.expected, func(t *testing.T) { - t.Parallel() - var env Env - env.SetInt64("SOME", test.input) - if got := env.Get("SOME"); got != test.expected { - t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", test.input, test.expected, got) - } - }) + var env Env + env.SetInt64("SOME", tt.input) + if got := env.Get("SOME"); got != tt.expected { + t.Errorf("Env.SetBool(%d): wrong result. Want %q. Got %q", tt.input, tt.expected, got) + } } } @@ -258,7 +209,7 @@ func TestGetJSONFailure(t *testing.T) { func TestSetJSON(t *testing.T) { t.Parallel() - p1 := struct { + var p1 = struct { Name string `json:"name"` Age int `json:"age"` }{Name: "Gopher", Age: 5} @@ -294,7 +245,7 @@ func TestSetJSONFailure(t *testing.T) { func TestGetList(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expected []string }{ @@ -339,7 +290,7 @@ func TestSet(t *testing.T) { func TestDecode(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expectedOut []string expectedErr string @@ -353,32 +304,28 @@ func TestDecode(t *testing.T) { {`{}`, nil, ""}, } for _, tt := range tests { - test := tt - t.Run(test.input, func(t *testing.T) { - t.Parallel() - var env Env - err := env.Decode(bytes.NewBufferString(test.input)) - if test.expectedErr == "" { - if err != nil { - t.Error(err) - } - } else if test.expectedErr != err.Error() { - t.Errorf("Env.Decode(): invalid error. Want %q. Got %q.", test.expectedErr, err) - } - got := []string(env) - sort.Strings(got) - sort.Strings(test.expectedOut) - if !reflect.DeepEqual(got, test.expectedOut) { - t.Errorf("Env.Decode(): wrong result. Want %v. Got %v.", test.expectedOut, got) + var env Env + err := env.Decode(bytes.NewBufferString(tt.input)) + if tt.expectedErr == "" { + if err != nil { + t.Error(err) } - }) + } else if tt.expectedErr != err.Error() { + t.Errorf("Env.Decode(): invalid error. Want %q. Got %q.", tt.expectedErr, err) + } + got := []string(env) + sort.Strings(got) + sort.Strings(tt.expectedOut) + if !reflect.DeepEqual(got, tt.expectedOut) { + t.Errorf("Env.Decode(): wrong result. Want %v. Got %v.", tt.expectedOut, got) + } } } func TestSetAuto(t *testing.T) { t.Parallel() buf := bytes.NewBufferString("oi") - tests := []struct { + var tests = []struct { input interface{} expected string }{ @@ -389,21 +336,17 @@ func TestSetAuto(t *testing.T) { {unmarshable{}, "{}"}, } for _, tt := range tests { - test := tt - t.Run(test.expected, func(t *testing.T) { - t.Parallel() - var env Env - env.SetAuto("SOME", test.input) - if got := env.Get("SOME"); got != test.expected { - t.Errorf("Env.SetAuto(%v): wrong result. Want %q. Got %q", test.input, test.expected, got) - } - }) + var env Env + env.SetAuto("SOME", tt.input) + if got := env.Get("SOME"); got != tt.expected { + t.Errorf("Env.SetAuto(%v): wrong result. Want %q. Got %q", tt.input, tt.expected, got) + } } } func TestMap(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input []string expected map[string]string }{ diff --git a/vendor/github.com/fsouza/go-dockerclient/event.go b/vendor/github.com/fsouza/go-dockerclient/event.go index 6de7c55357de..21c0584f05bd 100644 --- a/vendor/github.com/fsouza/go-dockerclient/event.go +++ b/vendor/github.com/fsouza/go-dockerclient/event.go @@ -178,7 +178,7 @@ func (eventState *eventMonitoringState) enableEventMonitoring(c *Client) error { return nil } -func (eventState *eventMonitoringState) disableEventMonitoring() { +func (eventState *eventMonitoringState) disableEventMonitoring() error { eventState.Lock() defer eventState.Unlock() @@ -191,28 +191,14 @@ func (eventState *eventMonitoringState) disableEventMonitoring() { close(eventState.C) close(eventState.errC) } + return nil } func (eventState *eventMonitoringState) monitorEvents(c *Client) { - const ( - noListenersTimeout = 5 * time.Second - noListenersInterval = 10 * time.Millisecond - noListenersMaxTries = noListenersTimeout / noListenersInterval - ) - var err error - for i := time.Duration(0); i < noListenersMaxTries && eventState.noListeners(); i++ { + for eventState.noListeners() { time.Sleep(10 * time.Millisecond) } - - if eventState.noListeners() { - // terminate if no listener is available after 5 seconds. - // Prevents goroutine leak when RemoveEventListener is called - // right after AddEventListener. - eventState.disableEventMonitoring() - return - } - if err = eventState.connectWithRetry(c); err != nil { // terminate if connect failed eventState.disableEventMonitoring() @@ -329,18 +315,15 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan if err != nil { return err } - //nolint:staticcheck conn := httputil.NewClientConn(dial, nil) - req, err := http.NewRequest(http.MethodGet, uri, nil) + req, err := http.NewRequest("GET", uri, nil) if err != nil { return err } - //nolint:bodyclose res, err := conn.Do(req) if err != nil { return err } - //nolint:staticcheck go func(res *http.Response, conn *httputil.ClientConn) { defer conn.Close() defer res.Body.Close() diff --git a/vendor/github.com/fsouza/go-dockerclient/event_test.go b/vendor/github.com/fsouza/go-dockerclient/event_test.go index 569e0eb47a7b..ffe05ee77032 100644 --- a/vendor/github.com/fsouza/go-dockerclient/event_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/event_test.go @@ -64,7 +64,7 @@ func testEventListeners(testName string, t *testing.T, buildServer func(http.Han {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970} {"Action":"create","Actor":{"Attributes":{"HAProxyMode":"http","HealthCheck":"HttpGet","HealthCheckArgs":"http://127.0.0.1:39051/status/check","ServicePort_8080":"17801","image":"datanerd.us/siteeng/sample-app-go:latest","name":"sample-app-client-go-69818c1223ddb5"},"ID":"a925eaf4084d5c3bcf337b2abb05f566ebb94276dff34f6effb00d8ecd380e16"},"Type":"container","from":"datanerd.us/siteeng/sample-app-go:latest","id":"a925eaf4084d5c3bcf337b2abb05f566ebb94276dff34f6effb00d8ecd380e16","status":"create","time":1459133932,"timeNano":1459133932961735842}` - server := buildServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := buildServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { rsc := bufio.NewScanner(strings.NewReader(response)) for rsc.Scan() { w.Write(rsc.Bytes()) @@ -271,7 +271,7 @@ loop: func TestEventListenerReAdding(t *testing.T) { t.Parallel() endChan := make(chan bool) - server := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { <-endChan })) diff --git a/vendor/github.com/fsouza/go-dockerclient/example_test.go b/vendor/github.com/fsouza/go-dockerclient/example_test.go index 59b35a969fed..0d2a78916fd1 100644 --- a/vendor/github.com/fsouza/go-dockerclient/example_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/example_test.go @@ -11,7 +11,7 @@ import ( "log" "time" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func ExampleClient_AttachToContainer() { @@ -81,10 +81,12 @@ func ExampleClient_AddEventListener() { } defer func() { + err = client.RemoveEventListener(listener) if err != nil { log.Fatal(err) } + }() timeout := time.After(1 * time.Second) @@ -97,6 +99,7 @@ func ExampleClient_AddEventListener() { return } } + } func ExampleEnv_Map() { diff --git a/vendor/github.com/fsouza/go-dockerclient/exec.go b/vendor/github.com/fsouza/go-dockerclient/exec.go index 48d1ad349fcd..0048153096bd 100644 --- a/vendor/github.com/fsouza/go-dockerclient/exec.go +++ b/vendor/github.com/fsouza/go-dockerclient/exec.go @@ -5,7 +5,6 @@ package docker import ( - "context" "encoding/json" "errors" "fmt" @@ -13,6 +12,8 @@ import ( "net/http" "net/url" "strconv" + + "golang.org/x/net/context" ) // Exec is the type representing a `docker exec` instance and containing the @@ -25,17 +26,15 @@ type Exec struct { // // See https://goo.gl/60TeBP for more details type CreateExecOptions struct { + AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"` + AttachStdout bool `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"` + AttachStderr bool `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"` + Tty bool `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"` Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"` Cmd []string `json:"Cmd,omitempty" yaml:"Cmd,omitempty" toml:"Cmd,omitempty"` Container string `json:"Container,omitempty" yaml:"Container,omitempty" toml:"Container,omitempty"` User string `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"` - WorkingDir string `json:"WorkingDir,omitempty" yaml:"WorkingDir,omitempty" toml:"WorkingDir,omitempty"` - DetachKeys string `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"` Context context.Context `json:"-"` - AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"` - AttachStdout bool `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"` - AttachStderr bool `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"` - Tty bool `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"` Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` } @@ -47,11 +46,8 @@ func (c *Client) CreateExec(opts CreateExecOptions) (*Exec, error) { if len(opts.Env) > 0 && c.serverAPIVersion.LessThan(apiVersion125) { return nil, errors.New("exec configuration Env is only supported in API#1.25 and above") } - if len(opts.WorkingDir) > 0 && c.serverAPIVersion.LessThan(apiVersion135) { - return nil, errors.New("exec configuration WorkingDir is only supported in API#1.35 and above") - } path := fmt.Sprintf("/containers/%s/exec", opts.Container) - resp, err := c.do(http.MethodPost, path, doOptions{data: opts, context: opts.Context}) + resp, err := c.do("POST", path, doOptions{data: opts, context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchContainer{ID: opts.Container} @@ -120,7 +116,7 @@ func (c *Client) StartExecNonBlocking(id string, opts StartExecOptions) (CloseWa path := fmt.Sprintf("/exec/%s/start", id) if opts.Detach { - resp, err := c.do(http.MethodPost, path, doOptions{data: opts, context: opts.Context}) + resp, err := c.do("POST", path, doOptions{data: opts, context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchExec{ID: id} @@ -131,7 +127,7 @@ func (c *Client) StartExecNonBlocking(id string, opts StartExecOptions) (CloseWa return nil, nil } - return c.hijack(http.MethodPost, path, hijackOptions{ + return c.hijack("POST", path, hijackOptions{ success: opts.Success, setRawTerminal: opts.RawTerminal, in: opts.InputStream, @@ -152,7 +148,7 @@ func (c *Client) ResizeExecTTY(id string, height, width int) error { params.Set("w", strconv.Itoa(width)) path := fmt.Sprintf("/exec/%s/resize?%s", id, params.Encode()) - resp, err := c.do(http.MethodPost, path, doOptions{}) + resp, err := c.do("POST", path, doOptions{}) if err != nil { return err } @@ -178,13 +174,13 @@ type ExecProcessConfig struct { type ExecInspect struct { ID string `json:"ID,omitempty" yaml:"ID,omitempty" toml:"ID,omitempty"` ExitCode int `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty" toml:"ExitCode,omitempty"` - ProcessConfig ExecProcessConfig `json:"ProcessConfig,omitempty" yaml:"ProcessConfig,omitempty" toml:"ProcessConfig,omitempty"` - ContainerID string `json:"ContainerID,omitempty" yaml:"ContainerID,omitempty" toml:"ContainerID,omitempty"` - DetachKeys string `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"` Running bool `json:"Running,omitempty" yaml:"Running,omitempty" toml:"Running,omitempty"` OpenStdin bool `json:"OpenStdin,omitempty" yaml:"OpenStdin,omitempty" toml:"OpenStdin,omitempty"` OpenStderr bool `json:"OpenStderr,omitempty" yaml:"OpenStderr,omitempty" toml:"OpenStderr,omitempty"` OpenStdout bool `json:"OpenStdout,omitempty" yaml:"OpenStdout,omitempty" toml:"OpenStdout,omitempty"` + ProcessConfig ExecProcessConfig `json:"ProcessConfig,omitempty" yaml:"ProcessConfig,omitempty" toml:"ProcessConfig,omitempty"` + ContainerID string `json:"ContainerID,omitempty" yaml:"ContainerID,omitempty" toml:"ContainerID,omitempty"` + DetachKeys string `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"` CanRemove bool `json:"CanRemove,omitempty" yaml:"CanRemove,omitempty" toml:"CanRemove,omitempty"` } @@ -193,7 +189,7 @@ type ExecInspect struct { // See https://goo.gl/ctMUiW for more details func (c *Client) InspectExec(id string) (*ExecInspect, error) { path := fmt.Sprintf("/exec/%s/json", id) - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchExec{ID: id} diff --git a/vendor/github.com/fsouza/go-dockerclient/exec_test.go b/vendor/github.com/fsouza/go-dockerclient/exec_test.go index 822968e5d648..8480536e0d6c 100644 --- a/vendor/github.com/fsouza/go-dockerclient/exec_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/exec_test.go @@ -44,8 +44,8 @@ func TestExecCreate(t *testing.T) { t.Errorf("ExecCreate: wrong ID. Want %q. Got %q.", expectedID, execObj.ID) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("ExecCreate: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("ExecCreate: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/containers/test/exec")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -120,68 +120,6 @@ func TestExecCreateWithEnv(t *testing.T) { } } -func TestExecCreateWithWorkingDirErr(t *testing.T) { - t.Parallel() - jsonContainer := `{"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2"}` - var expected struct{ ID string } - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - client := newTestClient(fakeRT) - config := CreateExecOptions{ - Container: "test", - AttachStdin: true, - AttachStdout: true, - AttachStderr: false, - Tty: false, - WorkingDir: "/tmp", - Cmd: []string{"touch", "file"}, - User: "a-user", - } - _, err = client.CreateExec(config) - if err == nil || err.Error() != "exec configuration WorkingDir is only supported in API#1.35 and above" { - t.Error("CreateExec: options contain WorkingDir for unsupported api version") - } -} - -func TestExecCreateWithWorkingDir(t *testing.T) { - t.Parallel() - jsonContainer := `{"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2"}` - var expected struct{ ID string } - err := json.Unmarshal([]byte(jsonContainer), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonContainer, status: http.StatusOK} - endpoint := "http://localhost:4243" - u, _ := parseEndpoint("http://localhost:4243", false) - testAPIVersion, _ := NewAPIVersion("1.35") - client := Client{ - HTTPClient: &http.Client{Transport: fakeRT}, - Dialer: &net.Dialer{}, - endpoint: endpoint, - endpointURL: u, - SkipServerVersionCheck: true, - serverAPIVersion: testAPIVersion, - } - config := CreateExecOptions{ - Container: "test", - AttachStdin: true, - AttachStdout: true, - AttachStderr: false, - Tty: false, - WorkingDir: "/tmp", - Cmd: []string{"touch", "file"}, - User: "a-user", - } - _, err = client.CreateExec(config) - if err != nil { - t.Error(err) - } -} - func TestExecStartDetached(t *testing.T) { t.Parallel() execID := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" @@ -195,8 +133,8 @@ func TestExecStartDetached(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/exec/" + execID + "/start")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -214,8 +152,8 @@ func TestExecStartDetached(t *testing.T) { } func TestExecStartAndAttach(t *testing.T) { - reader := strings.NewReader("send value") - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + var reader = strings.NewReader("send value") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte{1, 0, 0, 0, 0, 0, 0, 5}) w.Write([]byte("hello")) })) @@ -250,8 +188,8 @@ func TestExecResize(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("ExecStart: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/exec/" + execID + "/resize?h=10&w=20")) if gotPath := req.URL.RequestURI(); gotPath != expectedURL.RequestURI() { @@ -298,8 +236,8 @@ func TestExecInspect(t *testing.T) { t.Errorf("ExecInspect: Expected %#v. Got %#v.", expected, *execObj) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { - t.Errorf("ExecInspect: wrong HTTP method. Want %q. Got %q.", http.MethodGet, req.Method) + if req.Method != "GET" { + t.Errorf("ExecInspect: wrong HTTP method. Want %q. Got %q.", "GET", req.Method) } expectedURL, _ := url.Parse(client.getURL("/exec/" + expectedID + "/json")) if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { diff --git a/vendor/github.com/fsouza/go-dockerclient/go.mod b/vendor/github.com/fsouza/go-dockerclient/go.mod deleted file mode 100644 index cf98b1b6275a..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/go.mod +++ /dev/null @@ -1,23 +0,0 @@ -module github.com/fsouza/go-dockerclient - -go 1.12 - -require ( - github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect - github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 - github.com/Microsoft/hcsshim v0.8.7 // indirect - github.com/containerd/containerd v1.3.0 // indirect - github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect - github.com/docker/distribution v2.7.1+incompatible // indirect - github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23 - github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.4.0 - github.com/gogo/protobuf v1.3.1 // indirect - github.com/google/go-cmp v0.4.0 - github.com/gorilla/mux v1.7.4 - github.com/morikuni/aec v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.1 // indirect - github.com/opencontainers/runc v0.1.1 // indirect - golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 - google.golang.org/grpc v1.27.1 // indirect -) diff --git a/vendor/github.com/fsouza/go-dockerclient/go.sum b/vendor/github.com/fsouza/go-dockerclient/go.sum deleted file mode 100644 index 5c7d610dd363..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/go.sum +++ /dev/null @@ -1,185 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 h1:93nQ7k53GjoMQ07HVP8g6Zj1fQZDDj7Xy2VkNNtvX8o= -github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg= -github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f h1:tSNMc+rJDfmYntojat8lljbt1mgKNpTxUZJsSzJ9Y1s= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0 h1:xjvXQWABwS2uiv3TWgQt5Uth60Gu86LTGZXMJkjc7rY= -github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c h1:8ahmSVELW1wghbjerVAyuEYD5+Dio66RYvSS0iGfL1M= -github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= -github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -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/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= -github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23 h1:oqgGT9O61YAYvI41EBsLePOr+LE6roB0xY4gpkZuFSE= -github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -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/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -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= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -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/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb h1:i1Ppqkc3WQXikh8bXiwHqAN5Rv3/qDCcRk0/Otx73BY= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= diff --git a/vendor/github.com/fsouza/go-dockerclient/helpers_test.go b/vendor/github.com/fsouza/go-dockerclient/helpers_test.go deleted file mode 100644 index 5465ad7bcbe6..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/helpers_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2020 go-dockerclient 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 docker - -import ( - "errors" - "testing" -) - -func expectNoSuchContainer(t *testing.T, id string, err error) { - t.Helper() - var containerErr *NoSuchContainer - if !errors.As(err, &containerErr) { - t.Fatalf("Container: Wrong error information. Want %#v. Got %#v.", containerErr, err) - } - if containerErr.ID != id { - t.Errorf("Container: wrong container in error\nWant %q\ngot %q", id, containerErr.ID) - } -} - -func expectNoSuchNode(t *testing.T, nodeID string, err error) { - t.Helper() - var nodeErr *NoSuchNode - if !errors.As(err, &nodeErr) { - t.Fatalf("Node: Wrong error information. Want %#v. Got %#v.", nodeErr, err) - } - if nodeErr.ID != nodeID { - t.Errorf("Node: wrong node in error\nWant %q\ngot %q", nodeID, nodeErr.ID) - } -} - -func expectNoSuchSecret(t *testing.T, secretID string, err error) { - t.Helper() - var nodeErr *NoSuchSecret - if !errors.As(err, &nodeErr) { - t.Fatalf("Secret: Wrong error information. Want %#v. Got %#v.", nodeErr, err) - } - if nodeErr.ID != secretID { - t.Errorf("Secret: wrong secret in error\nWant %q\ngot %q", secretID, nodeErr.ID) - } -} - -func expectNoSuchConfig(t *testing.T, secretID string, err error) { - t.Helper() - var nodeErr *NoSuchConfig - if !errors.As(err, &nodeErr) { - t.Fatalf("Config: Wrong error information. Want %#v. Got %#v.", nodeErr, err) - } - if nodeErr.ID != secretID { - t.Errorf("Config: wrong secret in error\nWant %q\ngot %q", secretID, nodeErr.ID) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/image.go b/vendor/github.com/fsouza/go-dockerclient/image.go index 5f72d6645765..c386ad5daeac 100644 --- a/vendor/github.com/fsouza/go-dockerclient/image.go +++ b/vendor/github.com/fsouza/go-dockerclient/image.go @@ -5,7 +5,7 @@ package docker import ( - "context" + "bytes" "encoding/base64" "encoding/json" "errors" @@ -16,6 +16,8 @@ import ( "os" "strings" "time" + + "golang.org/x/net/context" ) // APIImages represent an image returned in the ListImages call. @@ -88,7 +90,7 @@ var ( // InputStream are provided in BuildImageOptions ErrMultipleContexts = errors.New("image build may not be provided BOTH context dir and input stream") - // ErrMustSpecifyNames is the error returned when the Names field on + // ErrMustSpecifyNames is the error rreturned when the Names field on // ExportImagesOptions is nil or empty ErrMustSpecifyNames = errors.New("must specify at least one name to export") ) @@ -109,7 +111,7 @@ type ListImagesOptions struct { // See https://goo.gl/BVzauZ for more details. func (c *Client) ListImages(opts ListImagesOptions) ([]APIImages, error) { path := "/images/json?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) + resp, err := c.do("GET", path, doOptions{context: opts.Context}) if err != nil { return nil, err } @@ -129,14 +131,13 @@ type ImageHistory struct { Created int64 `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Tags,omitempty"` CreatedBy string `json:"CreatedBy,omitempty" yaml:"CreatedBy,omitempty" toml:"CreatedBy,omitempty"` Size int64 `json:"Size,omitempty" yaml:"Size,omitempty" toml:"Size,omitempty"` - Comment string `json:"Comment,omitempty" yaml:"Comment,omitempty" toml:"Comment,omitempty"` } // ImageHistory returns the history of the image by its name or ID. // // See https://goo.gl/fYtxQa for more details. func (c *Client) ImageHistory(name string) ([]ImageHistory, error) { - resp, err := c.do(http.MethodGet, "/images/"+name+"/history", doOptions{}) + resp, err := c.do("GET", "/images/"+name+"/history", doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, ErrNoSuchImage @@ -155,7 +156,7 @@ func (c *Client) ImageHistory(name string) ([]ImageHistory, error) { // // See https://goo.gl/Vd2Pck for more details. func (c *Client) RemoveImage(name string) error { - resp, err := c.do(http.MethodDelete, "/images/"+name, doOptions{}) + resp, err := c.do("DELETE", "/images/"+name, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return ErrNoSuchImage @@ -182,7 +183,7 @@ type RemoveImageOptions struct { // See https://goo.gl/Vd2Pck for more details. func (c *Client) RemoveImageExtended(name string, opts RemoveImageOptions) error { uri := fmt.Sprintf("/images/%s?%s", name, queryString(&opts)) - resp, err := c.do(http.MethodDelete, uri, doOptions{context: opts.Context}) + resp, err := c.do("DELETE", uri, doOptions{context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return ErrNoSuchImage @@ -197,7 +198,7 @@ func (c *Client) RemoveImageExtended(name string, opts RemoveImageOptions) error // // See https://goo.gl/ncLTG8 for more details. func (c *Client) InspectImage(name string) (*Image, error) { - resp, err := c.do(http.MethodGet, "/images/"+name+"/json", doOptions{}) + resp, err := c.do("GET", "/images/"+name+"/json", doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, ErrNoSuchImage @@ -272,7 +273,7 @@ func (c *Client) PushImage(opts PushImageOptions, auth AuthConfiguration) error name := opts.Name opts.Name = "" path := "/images/" + name + "/push?" + queryString(&opts) - return c.stream(http.MethodPost, path, streamOptions{ + return c.stream("POST", path, streamOptions{ setRawTerminal: true, rawJSONStream: opts.RawJSONStream, headers: headers, @@ -289,7 +290,6 @@ func (c *Client) PushImage(opts PushImageOptions, auth AuthConfiguration) error type PullImageOptions struct { Repository string `qs:"fromImage"` Tag string - Platform string `ver:"1.32"` // Only required for Docker Engine 1.9 or 1.10 w/ Remote API < 1.21 // and Docker Engine < 1.9 @@ -320,16 +320,12 @@ func (c *Client) PullImage(opts PullImageOptions, auth AuthConfiguration) error opts.Repository = parts[0] opts.Tag = parts[1] } - return c.createImage(&opts, headers, nil, opts.OutputStream, opts.RawJSONStream, opts.InactivityTimeout, opts.Context) + return c.createImage(queryString(&opts), headers, nil, opts.OutputStream, opts.RawJSONStream, opts.InactivityTimeout, opts.Context) } -//nolint:golint -func (c *Client) createImage(opts interface{}, headers map[string]string, in io.Reader, w io.Writer, rawJSONStream bool, timeout time.Duration, context context.Context) error { - url, err := c.getPath("/images/create", opts) - if err != nil { - return err - } - return c.streamURL(http.MethodPost, url, streamOptions{ +func (c *Client) createImage(qs string, headers map[string]string, in io.Reader, w io.Writer, rawJSONStream bool, timeout time.Duration, context context.Context) error { + path := "/images/create?" + qs + return c.stream("POST", path, streamOptions{ setRawTerminal: true, headers: headers, in: in, @@ -353,7 +349,7 @@ type LoadImageOptions struct { // // See https://goo.gl/rEsBV3 for more details. func (c *Client) LoadImage(opts LoadImageOptions) error { - return c.stream(http.MethodPost, "/images/load", streamOptions{ + return c.stream("POST", "/images/load", streamOptions{ setRawTerminal: true, in: opts.InputStream, stdout: opts.OutputStream, @@ -375,7 +371,7 @@ type ExportImageOptions struct { // // See https://goo.gl/AuySaA for more details. func (c *Client) ExportImage(opts ExportImageOptions) error { - return c.stream(http.MethodGet, fmt.Sprintf("/images/%s/get", opts.Name), streamOptions{ + return c.stream("GET", fmt.Sprintf("/images/%s/get", opts.Name), streamOptions{ setRawTerminal: true, stdout: opts.OutputStream, inactivityTimeout: opts.InactivityTimeout, @@ -400,28 +396,7 @@ func (c *Client) ExportImages(opts ExportImagesOptions) error { if opts.Names == nil || len(opts.Names) == 0 { return ErrMustSpecifyNames } - // API < 1.25 allows multiple name values - // 1.25 says name must be a comma separated list - var err error - var exporturl string - if c.requestedAPIVersion.GreaterThanOrEqualTo(apiVersion125) { - str := opts.Names[0] - for _, val := range opts.Names[1:] { - str += "," + val - } - exporturl, err = c.getPath("/images/get", ExportImagesOptions{ - Names: []string{str}, - OutputStream: opts.OutputStream, - InactivityTimeout: opts.InactivityTimeout, - Context: opts.Context, - }) - } else { - exporturl, err = c.getPath("/images/get", &opts) - } - if err != nil { - return err - } - return c.streamURL(http.MethodGet, exporturl, streamOptions{ + return c.stream("GET", "/images/get?"+queryString(&opts), streamOptions{ setRawTerminal: true, stdout: opts.OutputStream, inactivityTimeout: opts.InactivityTimeout, @@ -462,7 +437,7 @@ func (c *Client) ImportImage(opts ImportImageOptions) error { opts.InputStream = f opts.Source = "-" } - return c.createImage(&opts, nil, opts.InputStream, opts.OutputStream, opts.RawJSONStream, opts.InactivityTimeout, opts.Context) + return c.createImage(queryString(&opts), nil, opts.InputStream, opts.OutputStream, opts.RawJSONStream, opts.InactivityTimeout, opts.Context) } // BuildImageOptions present the set of informations available for building an @@ -471,40 +446,34 @@ func (c *Client) ImportImage(opts ImportImageOptions) error { // For more details about the Docker building process, see // https://goo.gl/4nYHwV. type BuildImageOptions struct { - Context context.Context - Name string `qs:"t"` - Dockerfile string `ver:"1.25"` - ExtraHosts string `ver:"1.28"` - CacheFrom []string `qs:"-" ver:"1.25"` - Memory int64 - Memswap int64 - ShmSize int64 - CPUShares int64 - CPUQuota int64 `ver:"1.21"` - CPUPeriod int64 `ver:"1.21"` - CPUSetCPUs string - Labels map[string]string - InputStream io.Reader `qs:"-"` - OutputStream io.Writer `qs:"-"` - Remote string + Name string `qs:"t"` + Dockerfile string `qs:"dockerfile"` + NoCache bool `qs:"nocache"` + CacheFrom []string `qs:"-"` + SuppressOutput bool `qs:"q"` + Pull bool `qs:"pull"` + RmTmpContainer bool `qs:"rm"` + ForceRmTmpContainer bool `qs:"forcerm"` + RawJSONStream bool `qs:"-"` + Memory int64 `qs:"memory"` + Memswap int64 `qs:"memswap"` + CPUShares int64 `qs:"cpushares"` + CPUQuota int64 `qs:"cpuquota"` + CPUPeriod int64 `qs:"cpuperiod"` + CPUSetCPUs string `qs:"cpusetcpus"` + Labels map[string]string `qs:"labels"` + InputStream io.Reader `qs:"-"` + OutputStream io.Writer `qs:"-"` + Remote string `qs:"remote"` Auth AuthConfiguration `qs:"-"` // for older docker X-Registry-Auth header AuthConfigs AuthConfigurations `qs:"-"` // for newer docker X-Registry-Config header ContextDir string `qs:"-"` - Ulimits []ULimit `qs:"-" ver:"1.18"` - BuildArgs []BuildArg `qs:"-" ver:"1.21"` - NetworkMode string `ver:"1.25"` - Platform string `ver:"1.32"` + Ulimits []ULimit `qs:"-"` + BuildArgs []BuildArg `qs:"-"` + NetworkMode string `qs:"networkmode"` InactivityTimeout time.Duration `qs:"-"` - CgroupParent string - SecurityOpt []string - Target string - Outputs string `ver:"1.40"` - NoCache bool - SuppressOutput bool `qs:"q"` - Pull bool `ver:"1.16"` - RmTmpContainer bool `qs:"rm"` - ForceRmTmpContainer bool `qs:"forcerm" ver:"1.12"` - RawJSONStream bool `qs:"-"` + CgroupParent string `qs:"cgroupparent"` + Context context.Context } // BuildArg represents arguments that can be passed to the image when building @@ -547,16 +516,13 @@ func (c *Client) BuildImage(opts BuildImageOptions) error { return err } } - qs, ver := queryStringVersion(&opts) + qs := queryString(&opts) - if len(opts.CacheFrom) > 0 { + if c.serverAPIVersion.GreaterThanOrEqualTo(apiVersion125) && len(opts.CacheFrom) > 0 { if b, err := json.Marshal(opts.CacheFrom); err == nil { item := url.Values(map[string][]string{}) item.Add("cachefrom", string(b)) qs = fmt.Sprintf("%s&%s", qs, item.Encode()) - if ver == nil || apiVersion125.GreaterThan(ver) { - ver = apiVersion125 - } } } @@ -565,9 +531,6 @@ func (c *Client) BuildImage(opts BuildImageOptions) error { item := url.Values(map[string][]string{}) item.Add("ulimits", string(b)) qs = fmt.Sprintf("%s&%s", qs, item.Encode()) - if ver == nil || apiVersion118.GreaterThan(ver) { - ver = apiVersion118 - } } } @@ -580,18 +543,10 @@ func (c *Client) BuildImage(opts BuildImageOptions) error { item := url.Values(map[string][]string{}) item.Add("buildargs", string(b)) qs = fmt.Sprintf("%s&%s", qs, item.Encode()) - if ver == nil || apiVersion121.GreaterThan(ver) { - ver = apiVersion121 - } } } - buildURL, err := c.pathVersionCheck("/build", qs, ver) - if err != nil { - return err - } - - return c.streamURL(http.MethodPost, buildURL, streamOptions{ + return c.stream("POST", fmt.Sprintf("/build?%s", qs), streamOptions{ setRawTerminal: true, rawJSONStream: opts.RawJSONStream, headers: headers, @@ -602,7 +557,7 @@ func (c *Client) BuildImage(opts BuildImageOptions) error { }) } -func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) registryAuth { +func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) interface{} { if c.serverAPIVersion == nil { c.checkAPIVersion() } @@ -629,9 +584,10 @@ func (c *Client) TagImage(name string, opts TagImageOptions) error { if name == "" { return ErrNoSuchImage } - resp, err := c.do(http.MethodPost, "/images/"+name+"/tag?"+queryString(&opts), doOptions{ + resp, err := c.do("POST", "/images/"+name+"/tag?"+queryString(&opts), doOptions{ context: opts.Context, }) + if err != nil { return err } @@ -653,18 +609,24 @@ func isURL(u string) bool { return p.Scheme == "http" || p.Scheme == "https" } -func headersWithAuth(auths ...registryAuth) (map[string]string, error) { - headers := make(map[string]string) +func headersWithAuth(auths ...interface{}) (map[string]string, error) { + var headers = make(map[string]string) for _, auth := range auths { - if auth.isEmpty() { - continue - } - data, err := json.Marshal(auth) - if err != nil { - return nil, err + switch auth.(type) { + case AuthConfiguration: + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(auth); err != nil { + return nil, err + } + headers["X-Registry-Auth"] = base64.URLEncoding.EncodeToString(buf.Bytes()) + case AuthConfigurations, AuthConfigurations119: + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(auth); err != nil { + return nil, err + } + headers["X-Registry-Config"] = base64.URLEncoding.EncodeToString(buf.Bytes()) } - headers[auth.headerKey()] = base64.URLEncoding.EncodeToString(data) } return headers, nil @@ -685,7 +647,7 @@ type APIImageSearch struct { // // See https://goo.gl/KLO9IZ for more details. func (c *Client) SearchImages(term string) ([]APIImageSearch, error) { - resp, err := c.do(http.MethodGet, "/images/search?term="+term, doOptions{}) + resp, err := c.do("GET", "/images/search?term="+term, doOptions{}) if err != nil { return nil, err } @@ -706,7 +668,7 @@ func (c *Client) SearchImagesEx(term string, auth AuthConfiguration) ([]APIImage return nil, err } - resp, err := c.do(http.MethodGet, "/images/search?term="+term, doOptions{ + resp, err := c.do("GET", "/images/search?term="+term, doOptions{ headers: headers, }) if err != nil { @@ -744,7 +706,7 @@ type PruneImagesResults struct { // See https://goo.gl/qfZlbZ for more details. func (c *Client) PruneImages(opts PruneImagesOptions) (*PruneImagesResults, error) { path := "/images/prune?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) + resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/image_test.go b/vendor/github.com/fsouza/go-dockerclient/image_test.go index 7716415755a5..27220b6e2f3b 100644 --- a/vendor/github.com/fsouza/go-dockerclient/image_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/image_test.go @@ -112,7 +112,7 @@ func TestListImagesParameters(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("ListImages({All: false}: Wrong HTTP method. Want GET. Got %s.", req.Method) } if all := req.URL.Query().Get("all"); all != "0" && all != "" { @@ -199,7 +199,7 @@ func TestRemoveImage(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodDelete + expectedMethod := "DELETE" if req.Method != expectedMethod { t.Errorf("RemoveImage(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) } @@ -228,7 +228,7 @@ func TestRemoveImageExtended(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodDelete + expectedMethod := "DELETE" if req.Method != expectedMethod { t.Errorf("RemoveImage(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) } @@ -292,7 +292,7 @@ func TestInspectImage(t *testing.T) { t.Errorf("InspectImage(%q): Wrong image returned. Want %#v. Got %#v.", expected.ID, expected, *image) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("InspectImage(%q): Wrong HTTP method. Want GET. Got %s.", expected.ID, req.Method) } u, _ := url.Parse(client.getURL("/images/" + expected.ID + "/json")) @@ -328,7 +328,7 @@ func TestPushImage(t *testing.T) { t.Errorf("PushImage: Wrong output. Want %q. Got %q.", expected, buf.String()) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { + if req.Method != "POST" { t.Errorf("PushImage: Wrong HTTP method. Want POST. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/images/test/push")) @@ -339,9 +339,13 @@ func TestPushImage(t *testing.T) { t.Errorf("PushImage: Wrong query string. Want no parameters, got %q.", query) } - authHeader, ok := req.Header["X-Registry-Auth"] - if ok { - t.Errorf("PushImage: unexpected non-empty X-Registry-Auth header: %v", authHeader) + auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) + if err != nil { + t.Errorf("PushImage: caught error decoding auth. %#v", err.Error()) + } + if strings.TrimSpace(string(auth)) != "{}" { + t.Errorf("PushImage: wrong body. Want %q. Got %q.", + base64.URLEncoding.EncodeToString([]byte("{}")), req.Header.Get("X-Registry-Auth")) } } @@ -451,7 +455,7 @@ func TestPullImage(t *testing.T) { t.Errorf("PullImage: Wrong output. Want %q. Got %q.", expected, buf.String()) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { + if req.Method != "POST" { t.Errorf("PullImage: Wrong HTTP method. Want POST. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/images/create")) @@ -481,7 +485,7 @@ func TestPullImageWithDigest(t *testing.T) { t.Errorf("PullImage: Wrong output. Want %q. Got %q.", expected, buf.String()) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { + if req.Method != "POST" { t.Errorf("PullImage: Wrong HTTP method. Want POST. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/images/create")) @@ -518,7 +522,7 @@ func TestPullImageWithDigestAndTag(t *testing.T) { t.Errorf("PullImage: Wrong output. Want %q. Got %q.", expected, buf.String()) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { + if req.Method != "POST" { t.Errorf("PullImage: Wrong HTTP method. Want POST. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/images/create")) @@ -740,9 +744,6 @@ func TestImportImageShouldPassTarContentToBodyWhenSourceIsFilePath(t *testing.T) } req := fakeRT.requests[0] tarContent, err := ioutil.ReadAll(tar) - if err != nil { - t.Fatal(err) - } body, err := ioutil.ReadAll(req.Body) if err != nil { t.Fatal(err) @@ -800,7 +801,6 @@ func TestBuildImageParameters(t *testing.T) { Labels: map[string]string{"k": "v"}, NetworkMode: "host", CgroupParent: "cgparent", - SecurityOpt: []string{"securityoptions"}, } err := client.BuildImage(opts) if err != nil && !strings.Contains(err.Error(), "build image fail") { @@ -810,7 +810,6 @@ func TestBuildImageParameters(t *testing.T) { expected := map[string][]string{ "t": {opts.Name}, "nocache": {"1"}, - "cachefrom": {`["test1","test2"]`}, "q": {"1"}, "pull": {"1"}, "rm": {"1"}, @@ -826,15 +825,10 @@ func TestBuildImageParameters(t *testing.T) { "buildargs": {`{"SOME_VAR":"some_value"}`}, "networkmode": {"host"}, "cgroupparent": {"cgparent"}, - "securityopt": {"securityoptions"}, } got := map[string][]string(req.URL.Query()) if !reflect.DeepEqual(got, expected) { - t.Errorf("BuildImage: wrong query string. Want %#v.\n Got %#v.", expected, got) - } - expectedPrefix := "http://localhost:4243/v1.25/" - if !strings.HasPrefix(req.URL.String(), expectedPrefix) { - t.Errorf("BuildImage: wrong URL version Want Prefix %s.\n Got URL: %s", expectedPrefix, req.URL.String()) + t.Errorf("BuildImage: wrong query string. Want %#v. Got %#v.", expected, got) } } @@ -1008,8 +1002,8 @@ func TestLoadImage(t *testing.T) { t.Error(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("LoadImage: wrong method. Expected %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("LoadImage: wrong method. Expected %q. Got %q.", "POST", req.Method) } if req.URL.Path != "/images/load" { t.Errorf("LoadImage: wrong URL. Expected %q. Got %q.", "/images/load", req.URL.Path) @@ -1027,8 +1021,8 @@ func TestExportImage(t *testing.T) { t.Error(err) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { - t.Errorf("ExportImage: wrong method. Expected %q. Got %q.", http.MethodGet, req.Method) + if req.Method != "GET" { + t.Errorf("ExportImage: wrong method. Expected %q. Got %q.", "GET", req.Method) } expectedPath := "/images/testimage/get" if req.URL.Path != expectedPath { @@ -1041,32 +1035,19 @@ func TestExportImages(t *testing.T) { var buf bytes.Buffer fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} client := newTestClient(fakeRT) - client.requestedAPIVersion = apiVersion125 opts := ExportImagesOptions{Names: []string{"testimage1", "testimage2:latest"}, OutputStream: &buf} err := client.ExportImages(opts) if nil != err { t.Error(err) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { - t.Errorf("ExportImages: wrong method. Expected %q. Got %q.", http.MethodGet, req.Method) + if req.Method != "GET" { + t.Errorf("ExportImage: wrong method. Expected %q. Got %q.", "GET", req.Method) } - expected := "http://localhost:4243/v1.25/images/get?names=testimage1%2Ctestimage2%3Alatest" + expected := "http://localhost:4243/images/get?names=testimage1&names=testimage2%3Alatest" got := req.URL.String() if !reflect.DeepEqual(got, expected) { - t.Errorf("ExportImages: wrong path. Expected %q. Got %q.", expected, got) - } - - client.requestedAPIVersion = apiVersion124 - err = client.ExportImages(opts) - if nil != err { - t.Error(err) - } - req = fakeRT.requests[1] - expected = "http://localhost:4243/v1.24/images/get?names=testimage1&names=testimage2%3Alatest" - got = req.URL.String() - if !reflect.DeepEqual(got, expected) { - t.Errorf("ExportImages: wrong path. Expected %q. Got %q.", expected, got) + t.Errorf("ExportIMage: wrong path. Expected %q. Got %q.", expected, got) } } diff --git a/vendor/github.com/fsouza/go-dockerclient/integration_test.go b/vendor/github.com/fsouza/go-dockerclient/integration_test.go index 4cc40a481abd..eda7d527ec2d 100644 --- a/vendor/github.com/fsouza/go-dockerclient/integration_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/integration_test.go @@ -8,20 +8,31 @@ package docker import ( "bytes" - "reflect" - "runtime" - "strings" + "os" "testing" ) +var dockerEndpoint string + +func init() { + dockerEndpoint = os.Getenv("DOCKER_HOST") + if dockerEndpoint == "" { + dockerEndpoint = "unix:///var/run/docker.sock" + } +} + func TestIntegrationPullCreateStartLogs(t *testing.T) { imageName := pullImage(t) - client, err := NewClientFromEnv() - if err != nil { - t.Fatal(err) - } + client := getClient() hostConfig := HostConfig{PublishAllPorts: true} - createOpts := integrationCreateContainerOpts(imageName, &hostConfig) + createOpts := CreateContainerOptions{ + Config: &Config{ + Image: imageName, + Cmd: []string{"cat", "/home/gopher/file.txt"}, + User: "gopher", + }, + HostConfig: &hostConfig, + } container, err := client.CreateContainer(createOpts) if err != nil { t.Fatal(err) @@ -52,52 +63,32 @@ func TestIntegrationPullCreateStartLogs(t *testing.T) { if stderr.String() != "" { t.Errorf("Got unexpected stderr from logs: %q", stderr.String()) } - // split stdout by lines to make sure the test is the same on Windows - // and Linux. Life is hard. - expected := []string{ - "Welcome to reality, wake up and rejoice", - "Welcome to reality, you've made the right choice", - "Welcome to reality, and let them hear your voice, shout it out!", - } - if stdoutLines := getLines(&stdout); !reflect.DeepEqual(stdoutLines, expected) { - t.Errorf("Got wrong stdout from logs.\nWant:\n%#v.\n\nGot:\n%#v.", expected, stdoutLines) + expected := `Welcome to reality, wake up and rejoice +Welcome to reality, you've made the right choice +Welcome to reality, and let them hear your voice, shout it out! +` + if stdout.String() != expected { + t.Errorf("Got wrong stdout from logs.\nWant:\n%#v.\n\nGot:\n%#v.", expected, stdout.String()) } } -func getLines(buf *bytes.Buffer) []string { - var lines []string - for _, line := range strings.Split(buf.String(), "\n") { - line = strings.TrimSpace(line) - if line != "" { - lines = append(lines, line) - } - } - return lines -} - func pullImage(t *testing.T) string { - os := runtime.GOOS - platform := runtime.GOOS + "/" + runtime.GOARCH - if os != "windows" { - os = "linux" - } else { - platform = runtime.GOOS - } - imageName := "fsouza/go-dockerclient-integration:" + os + imageName := "fsouza/go-dockerclient-integration:latest" var buf bytes.Buffer pullOpts := PullImageOptions{ Repository: imageName, OutputStream: &buf, - Platform: platform, } - client, err := NewClientFromEnv() - if err != nil { - t.Fatal(err) - } - err = client.PullImage(pullOpts, AuthConfiguration{}) + client := getClient() + err := client.PullImage(pullOpts, AuthConfiguration{}) if err != nil { t.Logf("Pull output: %s", buf.String()) t.Fatal(err) } return imageName } + +func getClient() *Client { + client, _ := NewClient(dockerEndpoint) + return client +} diff --git a/vendor/github.com/fsouza/go-dockerclient/integration_unix_test.go b/vendor/github.com/fsouza/go-dockerclient/integration_unix_test.go deleted file mode 100644 index a08edecb0b17..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/integration_unix_test.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2019 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build docker_integration,!windows - -package docker - -func integrationCreateContainerOpts(imageName string, hostConfig *HostConfig) CreateContainerOptions { - return CreateContainerOptions{ - Config: &Config{ - Image: imageName, - Cmd: []string{"cat", "/home/gopher/file.txt"}, - User: "gopher", - }, - HostConfig: hostConfig, - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/integration_windows_test.go b/vendor/github.com/fsouza/go-dockerclient/integration_windows_test.go deleted file mode 100644 index b88a4ee3435c..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/integration_windows_test.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build docker_integration - -package docker - -func integrationCreateContainerOpts(imageName string, hostConfig *HostConfig) CreateContainerOptions { - return CreateContainerOptions{ - Config: &Config{ - Image: imageName, - Cmd: []string{"powershell", "-Command", `cat C:\file.txt`}, - }, - HostConfig: hostConfig, - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/misc.go b/vendor/github.com/fsouza/go-dockerclient/misc.go index d42a66df6700..0482838abee0 100644 --- a/vendor/github.com/fsouza/go-dockerclient/misc.go +++ b/vendor/github.com/fsouza/go-dockerclient/misc.go @@ -5,10 +5,8 @@ package docker import ( - "context" "encoding/json" "net" - "net/http" "strings" "github.com/docker/docker/api/types/swarm" @@ -18,12 +16,7 @@ import ( // // See https://goo.gl/mU7yje for more details. func (c *Client) Version() (*Env, error) { - return c.VersionWithContext(context.TODO()) -} - -// VersionWithContext returns version information about the docker server. -func (c *Client) VersionWithContext(ctx context.Context) (*Env, error) { - resp, err := c.do(http.MethodGet, "/version", doOptions{context: ctx}) + resp, err := c.do("GET", "/version", doOptions{}) if err != nil { return nil, err } @@ -38,7 +31,6 @@ func (c *Client) VersionWithContext(ctx context.Context) (*Env, error) { // DockerInfo contains information about the Docker server // // See https://goo.gl/bHUoz9 for more details. -//nolint:golint type DockerInfo struct { ID string Containers int @@ -50,6 +42,19 @@ type DockerInfo struct { DriverStatus [][2]string SystemStatus [][2]string Plugins PluginsInfo + MemoryLimit bool + SwapLimit bool + KernelMemory bool + CPUCfsPeriod bool `json:"CpuCfsPeriod"` + CPUCfsQuota bool `json:"CpuCfsQuota"` + CPUShares bool + CPUSet bool + IPv4Forwarding bool + BridgeNfIptables bool + BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` + Debug bool + OomKillDisable bool + ExperimentalBuild bool NFd int NGoroutines int SystemTime string @@ -63,7 +68,6 @@ type DockerInfo struct { Architecture string IndexServerAddress string RegistryConfig *ServiceConfig - SecurityOptions []string NCPU int MemTotal int64 DockerRootDir string @@ -74,34 +78,12 @@ type DockerInfo struct { Labels []string ServerVersion string ClusterStore string - Runtimes map[string]Runtime ClusterAdvertise string Isolation string InitBinary string DefaultRuntime string - Swarm swarm.Info LiveRestoreEnabled bool - MemoryLimit bool - SwapLimit bool - KernelMemory bool - CPUCfsPeriod bool `json:"CpuCfsPeriod"` - CPUCfsQuota bool `json:"CpuCfsQuota"` - CPUShares bool - CPUSet bool - IPv4Forwarding bool - BridgeNfIptables bool - BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` - Debug bool - OomKillDisable bool - ExperimentalBuild bool -} - -// Runtime describes an OCI runtime -// -// for more information, see: https://dockr.ly/2NKM8qq -type Runtime struct { - Path string - Args []string `json:"runtimeArgs"` + Swarm swarm.Info } // PluginsInfo is a struct with the plugins registered with the docker daemon @@ -164,7 +146,7 @@ type IndexInfo struct { // // See https://goo.gl/ElTHi2 for more details. func (c *Client) Info() (*DockerInfo, error) { - resp, err := c.do(http.MethodGet, "/info", doOptions{}) + resp, err := c.do("GET", "/info", doOptions{}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/misc_test.go b/vendor/github.com/fsouza/go-dockerclient/misc_test.go index 7273212f3067..d30391df557d 100644 --- a/vendor/github.com/fsouza/go-dockerclient/misc_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/misc_test.go @@ -47,7 +47,7 @@ func TestVersion(t *testing.T) { t.Errorf("GoVersion(): Wrong result. Want %#v. Got %#v.", expected.GoVersion, version.Get("GoVersion")) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Version(): wrong request method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/version")) @@ -90,24 +90,7 @@ func TestInfo(t *testing.T) { } }, "Mirrors":null - }, - "SecurityOptions": [ - "name=apparmor", - "name=seccomp", - "profile=default" - ], - "Runtimes": { - "runc": { - "path": "docker-runc" - }, - "custom": { - "path": "/usr/local/bin/my-oci-runtime", - "runtimeArgs": [ - "--debug", - "--systemd-cgroup=false" - ] - } - } + } }` fakeRT := FakeRoundTripper{message: body, status: http.StatusOK} client := newTestClient(&fakeRT) @@ -134,23 +117,6 @@ func TestInfo(t *testing.T) { }, }, }, - SecurityOptions: []string{ - "name=apparmor", - "name=seccomp", - "profile=default", - }, - Runtimes: map[string]Runtime{ - "runc": { - Path: "docker-runc", - }, - "custom": { - Path: "/usr/local/bin/my-oci-runtime", - Args: []string{ - "--debug", - "--systemd-cgroup=false", - }, - }, - }, } info, err := client.Info() if err != nil { @@ -160,7 +126,7 @@ func TestInfo(t *testing.T) { t.Errorf("Info(): Wrong result.\nWant %#v.\nGot %#v.", expected, info) } req := fakeRT.requests[0] - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Info(): Wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/info")) @@ -184,7 +150,7 @@ func TestInfoError(t *testing.T) { func TestParseRepositoryTag(t *testing.T) { t.Parallel() - tests := []struct { + var tests = []struct { input string expectedRepo string expectedTag string @@ -221,16 +187,12 @@ func TestParseRepositoryTag(t *testing.T) { }, } for _, tt := range tests { - test := tt - t.Run(test.input, func(t *testing.T) { - t.Parallel() - repo, tag := ParseRepositoryTag(test.input) - if repo != test.expectedRepo { - t.Errorf("ParseRepositoryTag(%q): wrong repository. Want %q. Got %q", test.input, test.expectedRepo, repo) - } - if tag != test.expectedTag { - t.Errorf("ParseRepositoryTag(%q): wrong tag. Want %q. Got %q", test.input, test.expectedTag, tag) - } - }) + repo, tag := ParseRepositoryTag(tt.input) + if repo != tt.expectedRepo { + t.Errorf("ParseRepositoryTag(%q): wrong repository. Want %q. Got %q", tt.input, tt.expectedRepo, repo) + } + if tag != tt.expectedTag { + t.Errorf("ParseRepositoryTag(%q): wrong tag. Want %q. Got %q", tt.input, tt.expectedTag, tag) + } } } diff --git a/vendor/github.com/fsouza/go-dockerclient/network.go b/vendor/github.com/fsouza/go-dockerclient/network.go index 3a06a52d52fd..b79b67cd58ff 100644 --- a/vendor/github.com/fsouza/go-dockerclient/network.go +++ b/vendor/github.com/fsouza/go-dockerclient/network.go @@ -5,12 +5,12 @@ package docker import ( - "context" "encoding/json" "errors" "fmt" "net/http" - "net/url" + + "golang.org/x/net/context" ) // ErrNetworkAlreadyExists is the error returned by CreateNetwork when the @@ -48,7 +48,7 @@ type Endpoint struct { // // See https://goo.gl/6GugX3 for more details. func (c *Client) ListNetworks() ([]Network, error) { - resp, err := c.do(http.MethodGet, "/networks", doOptions{}) + resp, err := c.do("GET", "/networks", doOptions{}) if err != nil { return nil, err } @@ -72,10 +72,8 @@ func (c *Client) FilteredListNetworks(opts NetworkFilterOpts) ([]Network, error) if err != nil { return nil, err } - qs := make(url.Values) - qs.Add("filters", string(params)) - path := "/networks?" + qs.Encode() - resp, err := c.do(http.MethodGet, path, doOptions{}) + path := "/networks?filters=" + string(params) + resp, err := c.do("GET", path, doOptions{}) if err != nil { return nil, err } @@ -92,7 +90,7 @@ func (c *Client) FilteredListNetworks(opts NetworkFilterOpts) ([]Network, error) // See https://goo.gl/6GugX3 for more details. func (c *Client) NetworkInfo(id string) (*Network, error) { path := "/networks/" + id - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchNetwork{ID: id} @@ -114,26 +112,15 @@ func (c *Client) NetworkInfo(id string) (*Network, error) { type CreateNetworkOptions struct { Name string `json:"Name" yaml:"Name" toml:"Name"` Driver string `json:"Driver" yaml:"Driver" toml:"Driver"` - Scope string `json:"Scope" yaml:"Scope" toml:"Scope"` - IPAM *IPAMOptions `json:"IPAM,omitempty" yaml:"IPAM" toml:"IPAM"` - ConfigFrom *NetworkConfigFrom `json:"ConfigFrom,omitempty" yaml:"ConfigFrom" toml:"ConfigFrom"` + IPAM IPAMOptions `json:"IPAM" yaml:"IPAM" toml:"IPAM"` Options map[string]interface{} `json:"Options" yaml:"Options" toml:"Options"` Labels map[string]string `json:"Labels" yaml:"Labels" toml:"Labels"` CheckDuplicate bool `json:"CheckDuplicate" yaml:"CheckDuplicate" toml:"CheckDuplicate"` Internal bool `json:"Internal" yaml:"Internal" toml:"Internal"` EnableIPv6 bool `json:"EnableIPv6" yaml:"EnableIPv6" toml:"EnableIPv6"` - Attachable bool `json:"Attachable" yaml:"Attachable" toml:"Attachable"` - ConfigOnly bool `json:"ConfigOnly" yaml:"ConfigOnly" toml:"ConfigOnly"` - Ingress bool `json:"Ingress" yaml:"Ingress" toml:"Ingress"` Context context.Context `json:"-"` } -// NetworkConfigFrom is used in network creation for specifying the source of a -// network configuration. -type NetworkConfigFrom struct { - Network string `json:"Network" yaml:"Network" toml:"Network"` -} - // IPAMOptions controls IP Address Management when creating a network // // See https://goo.gl/T8kRVH for more details. @@ -159,7 +146,7 @@ type IPAMConfig struct { // See https://goo.gl/6GugX3 for more details. func (c *Client) CreateNetwork(opts CreateNetworkOptions) (*Network, error) { resp, err := c.do( - http.MethodPost, + "POST", "/networks/create", doOptions{ data: opts, @@ -193,7 +180,7 @@ func (c *Client) CreateNetwork(opts CreateNetworkOptions) (*Network, error) { // // See https://goo.gl/6GugX3 for more details. func (c *Client) RemoveNetwork(id string) error { - resp, err := c.do(http.MethodDelete, "/networks/"+id, doOptions{}) + resp, err := c.do("DELETE", "/networks/"+id, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchNetwork{ID: id} @@ -236,7 +223,6 @@ type EndpointConfig struct { GlobalIPv6Address string `json:"GlobalIPv6Address,omitempty" yaml:"GlobalIPv6Address,omitempty" toml:"GlobalIPv6Address,omitempty"` GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen,omitempty" yaml:"GlobalIPv6PrefixLen,omitempty" toml:"GlobalIPv6PrefixLen,omitempty"` MacAddress string `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty" toml:"MacAddress,omitempty"` - DriverOpts map[string]string `json:"DriverOpts,omitempty" yaml:"DriverOpts,omitempty" toml:"DriverOpts,omitempty"` } // EndpointIPAMConfig represents IPAM configurations for an @@ -253,7 +239,7 @@ type EndpointIPAMConfig struct { // // See https://goo.gl/6GugX3 for more details. func (c *Client) ConnectNetwork(id string, opts NetworkConnectionOptions) error { - resp, err := c.do(http.MethodPost, "/networks/"+id+"/connect", doOptions{ + resp, err := c.do("POST", "/networks/"+id+"/connect", doOptions{ data: opts, context: opts.Context, }) @@ -272,7 +258,7 @@ func (c *Client) ConnectNetwork(id string, opts NetworkConnectionOptions) error // // See https://goo.gl/6GugX3 for more details. func (c *Client) DisconnectNetwork(id string, opts NetworkConnectionOptions) error { - resp, err := c.do(http.MethodPost, "/networks/"+id+"/disconnect", doOptions{data: opts}) + resp, err := c.do("POST", "/networks/"+id+"/disconnect", doOptions{data: opts}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchNetworkOrContainer{NetworkID: id, ContainerID: opts.Container} @@ -303,7 +289,7 @@ type PruneNetworksResults struct { // See https://goo.gl/kX0S9h for more details. func (c *Client) PruneNetworks(opts PruneNetworksOptions) (*PruneNetworksResults, error) { path := "/networks/prune?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) + resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/network_test.go b/vendor/github.com/fsouza/go-dockerclient/network_test.go index c5f2a62d5722..dadc3170ad5f 100644 --- a/vendor/github.com/fsouza/go-dockerclient/network_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/network_test.go @@ -59,9 +59,7 @@ func TestFilteredListNetworks(t *testing.T) { if err != nil { t.Fatal(err) } - wantQuery := url.Values{ - "filters": []string{`{"name":{"blah":true}}`}, - } + wantQuery := "filters={\"name\":{\"blah\":true}}" fakeRT := &FakeRoundTripper{message: jsonNetworks, status: http.StatusOK} client := newTestClient(fakeRT) opts := NetworkFilterOpts{ @@ -74,9 +72,9 @@ func TestFilteredListNetworks(t *testing.T) { if !reflect.DeepEqual(containers, expected) { t.Errorf("ListNetworks: Expected %#v. Got %#v.", expected, containers) } - query := fakeRT.requests[0].URL.Query() - if !reflect.DeepEqual(query, wantQuery) { - t.Errorf("FilteredListNetworks: wrong query\nWant %#v\nGot %#v", wantQuery, query) + query := fakeRT.requests[0].URL.RawQuery + if query != wantQuery { + t.Errorf("FilteredListNetworks: wrong query\nWant %q\nGot %q", wantQuery, query) } } @@ -144,7 +142,7 @@ func TestNetworkRemove(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodDelete + expectedMethod := "DELETE" if req.Method != expectedMethod { t.Errorf("RemoveNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) } @@ -165,7 +163,7 @@ func TestNetworkConnect(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("ConnectNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) } @@ -196,7 +194,7 @@ func TestNetworkConnectWithEndpoint(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("ConnectNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) } @@ -234,7 +232,7 @@ func TestNetworkDisconnect(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("DisconnectNetwork(%q): Wrong HTTP method. Want %s. Got %s.", id, expectedMethod, req.Method) } diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_node.go b/vendor/github.com/fsouza/go-dockerclient/node.go similarity index 91% rename from vendor/github.com/fsouza/go-dockerclient/swarm_node.go rename to vendor/github.com/fsouza/go-dockerclient/node.go index c149db287b60..843402541330 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_node.go +++ b/vendor/github.com/fsouza/go-dockerclient/node.go @@ -5,13 +5,13 @@ package docker import ( - "context" "encoding/json" "net/http" "net/url" "strconv" "github.com/docker/docker/api/types/swarm" + "golang.org/x/net/context" ) // NoSuchNode is the error returned when a given node does not exist. @@ -40,7 +40,7 @@ type ListNodesOptions struct { // See http://goo.gl/3K4GwU for more details. func (c *Client) ListNodes(opts ListNodesOptions) ([]swarm.Node, error) { path := "/nodes?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) + resp, err := c.do("GET", path, doOptions{context: opts.Context}) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func (c *Client) ListNodes(opts ListNodesOptions) ([]swarm.Node, error) { // // See http://goo.gl/WjkTOk for more details. func (c *Client) InspectNode(id string) (*swarm.Node, error) { - resp, err := c.do(http.MethodGet, "/nodes/"+id, doOptions{}) + resp, err := c.do("GET", "/nodes/"+id, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchNode{ID: id} @@ -87,7 +87,7 @@ func (c *Client) UpdateNode(id string, opts UpdateNodeOptions) error { params := make(url.Values) params.Set("version", strconv.FormatUint(opts.Version, 10)) path := "/nodes/" + id + "/update?" + params.Encode() - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ context: opts.Context, forceJSON: true, data: opts.NodeSpec, @@ -118,7 +118,7 @@ func (c *Client) RemoveNode(opts RemoveNodeOptions) error { params := make(url.Values) params.Set("force", strconv.FormatBool(opts.Force)) path := "/nodes/" + opts.ID + "?" + params.Encode() - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) + resp, err := c.do("DELETE", path, doOptions{context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchNode{ID: opts.ID} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_node_test.go b/vendor/github.com/fsouza/go-dockerclient/node_test.go similarity index 90% rename from vendor/github.com/fsouza/go-dockerclient/swarm_node_test.go rename to vendor/github.com/fsouza/go-dockerclient/node_test.go index fa3994ac61b4..9236a36c388e 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_node_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/node_test.go @@ -90,6 +90,7 @@ func TestListNodes(t *testing.T) { if !reflect.DeepEqual(nodes, expected) { t.Errorf("ListNodes: Expected %#v. Got %#v.", expected, nodes) } + } func TestInspectNode(t *testing.T) { @@ -173,6 +174,7 @@ func TestInspectNode(t *testing.T) { if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { t.Errorf("InspectNode(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) } + } func TestInspectNodeNotFound(t *testing.T) { @@ -182,7 +184,10 @@ func TestInspectNodeNotFound(t *testing.T) { if node != nil { t.Errorf("InspectNode: Expected task, got %#v", node) } - expectNoSuchNode(t, "notfound", err) + expected := &NoSuchNode{ID: "notfound"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("InspectNode: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestUpdateNode(t *testing.T) { @@ -196,8 +201,8 @@ func TestUpdateNode(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateNode: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("UpdateNode: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/nodes/" + id + "/update")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -220,7 +225,10 @@ func TestUpdateNodeNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such node", status: http.StatusNotFound}) err := client.UpdateNode("notfound", UpdateNodeOptions{}) - expectNoSuchNode(t, "notfound", err) + expected := &NoSuchNode{ID: "notfound"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("UpdateNode: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } func TestRemoveNode(t *testing.T) { @@ -233,8 +241,8 @@ func TestRemoveNode(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodDelete { - t.Errorf("RemoveNode(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodDelete, req.Method) + if req.Method != "DELETE" { + t.Errorf("RemoveNode(%q): wrong HTTP method. Want %q. Got %q.", id, "DELETE", req.Method) } expectedURL, _ := url.Parse(client.getURL("/nodes/" + id)) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -246,5 +254,8 @@ func TestRemoveNodeNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such node", status: http.StatusNotFound}) err := client.RemoveNode(RemoveNodeOptions{ID: "notfound"}) - expectNoSuchNode(t, "notfound", err) + expected := &NoSuchNode{ID: "notfound"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("RemoveNode: Wrong error returned. Want %#v. Got %#v.", expected, err) + } } diff --git a/vendor/github.com/fsouza/go-dockerclient/plugin.go b/vendor/github.com/fsouza/go-dockerclient/plugin.go deleted file mode 100644 index 9cec41512375..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/plugin.go +++ /dev/null @@ -1,460 +0,0 @@ -// Copyright 2018 go-dockerclient 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 docker - -import ( - "context" - "encoding/json" - "io/ioutil" - "net/http" -) - -// PluginPrivilege represents a privilege for a plugin. -type PluginPrivilege struct { - Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"` - Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"` - Value []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"` -} - -// InstallPluginOptions specify parameters to the InstallPlugins function. -// -// See https://goo.gl/C4t7Tz for more details. -type InstallPluginOptions struct { - Remote string - Name string - Plugins []PluginPrivilege `qs:"-"` - - Auth AuthConfiguration - - Context context.Context -} - -// InstallPlugins installs a plugin or returns an error in case of failure. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) InstallPlugins(opts InstallPluginOptions) error { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return err - } - - path := "/plugins/pull?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ - data: opts.Plugins, - context: opts.Context, - headers: headers, - }) - if err != nil { - return err - } - defer resp.Body.Close() - // PullPlugin streams back the progress of the pull, we must consume the whole body - // otherwise the pull will be canceled on the engine. - if _, err := ioutil.ReadAll(resp.Body); err != nil { - return err - } - return nil -} - -// PluginSettings stores plugin settings. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginSettings struct { - Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"` - Args []string `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"` - Devices []string `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"` -} - -// PluginInterface stores plugin interface. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginInterface struct { - Types []string `json:"Types,omitempty" yaml:"Types,omitempty" toml:"Types,omitempty"` - Socket string `json:"Socket,omitempty" yaml:"Socket,omitempty" toml:"Socket,omitempty"` -} - -// PluginNetwork stores plugin network type. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginNetwork struct { - Type string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"` -} - -// PluginLinux stores plugin linux setting. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginLinux struct { - Capabilities []string `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"` - AllowAllDevices bool `json:"AllowAllDevices,omitempty" yaml:"AllowAllDevices,omitempty" toml:"AllowAllDevices,omitempty"` - Devices []PluginLinuxDevices `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"` -} - -// PluginLinuxDevices stores plugin linux device setting. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginLinuxDevices struct { - Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"` - Description string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"` - Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"` - Path string `json:"Path,omitempty" yaml:"Path,omitempty" toml:"Path,omitempty"` -} - -// PluginEnv stores plugin environment. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginEnv struct { - Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"` - Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"` - Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"` - Value string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"` -} - -// PluginArgs stores plugin arguments. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginArgs struct { - Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"` - Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"` - Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"` - Value []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"` -} - -// PluginUser stores plugin user. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginUser struct { - UID int32 `json:"UID,omitempty" yaml:"UID,omitempty" toml:"UID,omitempty"` - GID int32 `json:"GID,omitempty" yaml:"GID,omitempty" toml:"GID,omitempty"` -} - -// PluginConfig stores plugin config. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginConfig struct { - Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"` - Documentation string - Interface PluginInterface `json:"Interface,omitempty" yaml:"Interface,omitempty" toml:"Interface,omitempty"` - Entrypoint []string `json:"Entrypoint,omitempty" yaml:"Entrypoint,omitempty" toml:"Entrypoint,omitempty"` - WorkDir string `json:"WorkDir,omitempty" yaml:"WorkDir,omitempty" toml:"WorkDir,omitempty"` - User PluginUser `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"` - Network PluginNetwork `json:"Network,omitempty" yaml:"Network,omitempty" toml:"Network,omitempty"` - Linux PluginLinux `json:"Linux,omitempty" yaml:"Linux,omitempty" toml:"Linux,omitempty"` - PropagatedMount string `json:"PropagatedMount,omitempty" yaml:"PropagatedMount,omitempty" toml:"PropagatedMount,omitempty"` - Mounts []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"` - Env []PluginEnv `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"` - Args PluginArgs `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"` -} - -// PluginDetail specify results from the ListPlugins function. -// -// See https://goo.gl/C4t7Tz for more details. -type PluginDetail struct { - ID string `json:"Id,omitempty" yaml:"Id,omitempty" toml:"Id,omitempty"` - Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"` - Tag string `json:"Tag,omitempty" yaml:"Tag,omitempty" toml:"Tag,omitempty"` - Active bool `json:"Enabled,omitempty" yaml:"Active,omitempty" toml:"Active,omitempty"` - Settings PluginSettings `json:"Settings,omitempty" yaml:"Settings,omitempty" toml:"Settings,omitempty"` - Config PluginConfig `json:"Config,omitempty" yaml:"Config,omitempty" toml:"Config,omitempty"` -} - -// ListPlugins returns pluginDetails or an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) ListPlugins(ctx context.Context) ([]PluginDetail, error) { - resp, err := c.do(http.MethodGet, "/plugins", doOptions{ - context: ctx, - }) - if err != nil { - return nil, err - } - defer resp.Body.Close() - pluginDetails := make([]PluginDetail, 0) - if err := json.NewDecoder(resp.Body).Decode(&pluginDetails); err != nil { - return nil, err - } - return pluginDetails, nil -} - -// ListFilteredPluginsOptions specify parameters to the ListFilteredPlugins function. -// -// See https://goo.gl/C4t7Tz for more details. -type ListFilteredPluginsOptions struct { - Filters map[string][]string - Context context.Context -} - -// ListFilteredPlugins returns pluginDetails or an error. -// -// See https://goo.gl/rmdmWg for more details. -func (c *Client) ListFilteredPlugins(opts ListFilteredPluginsOptions) ([]PluginDetail, error) { - path := "/plugins/json?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{ - context: opts.Context, - }) - if err != nil { - return nil, err - } - defer resp.Body.Close() - pluginDetails := make([]PluginDetail, 0) - if err := json.NewDecoder(resp.Body).Decode(&pluginDetails); err != nil { - return nil, err - } - return pluginDetails, nil -} - -// GetPluginPrivileges returns pluginPrivileges or an error. -// -// See https://goo.gl/C4t7Tz for more details. -//nolint:golint -func (c *Client) GetPluginPrivileges(remote string, ctx context.Context) ([]PluginPrivilege, error) { - return c.GetPluginPrivilegesWithOptions( - GetPluginPrivilegesOptions{ - Remote: remote, - Context: ctx, - }) -} - -// GetPluginPrivilegesOptions specify parameters to the GetPluginPrivilegesWithOptions function. -// -// See https://goo.gl/C4t7Tz for more details. -type GetPluginPrivilegesOptions struct { - Remote string - Auth AuthConfiguration - Context context.Context -} - -// GetPluginPrivilegesWithOptions returns pluginPrivileges or an error. -// -// See https://goo.gl/C4t7Tz for more details. -//nolint:golint -func (c *Client) GetPluginPrivilegesWithOptions(opts GetPluginPrivilegesOptions) ([]PluginPrivilege, error) { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return nil, err - } - - path := "/plugins/privileges?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{ - context: opts.Context, - headers: headers, - }) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var pluginPrivileges []PluginPrivilege - if err := json.NewDecoder(resp.Body).Decode(&pluginPrivileges); err != nil { - return nil, err - } - return pluginPrivileges, nil -} - -// InspectPlugins returns a pluginDetail or an error. -// -// See https://goo.gl/C4t7Tz for more details. -//nolint:golint -func (c *Client) InspectPlugins(name string, ctx context.Context) (*PluginDetail, error) { - resp, err := c.do(http.MethodGet, "/plugins/"+name+"/json", doOptions{ - context: ctx, - }) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return nil, &NoSuchPlugin{ID: name} - } - return nil, err - } - defer resp.Body.Close() - var pluginDetail PluginDetail - if err := json.NewDecoder(resp.Body).Decode(&pluginDetail); err != nil { - return nil, err - } - return &pluginDetail, nil -} - -// RemovePluginOptions specify parameters to the RemovePlugin function. -// -// See https://goo.gl/C4t7Tz for more details. -type RemovePluginOptions struct { - // The Name of the plugin. - Name string `qs:"-"` - - Force bool `qs:"force"` - Context context.Context -} - -// RemovePlugin returns a PluginDetail or an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) RemovePlugin(opts RemovePluginOptions) (*PluginDetail, error) { - path := "/plugins/" + opts.Name + "?" + queryString(opts) - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return nil, &NoSuchPlugin{ID: opts.Name} - } - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if len(body) == 0 { - // Seems like newer docker versions won't return the plugindetail after removal - return nil, nil - } - - var pluginDetail PluginDetail - if err := json.Unmarshal(body, &pluginDetail); err != nil { - return nil, err - } - return &pluginDetail, nil -} - -// EnablePluginOptions specify parameters to the EnablePlugin function. -// -// See https://goo.gl/C4t7Tz for more details. -type EnablePluginOptions struct { - // The Name of the plugin. - Name string `qs:"-"` - Timeout int64 `qs:"timeout"` - - Context context.Context -} - -// EnablePlugin enables plugin that opts point or returns an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) EnablePlugin(opts EnablePluginOptions) error { - path := "/plugins/" + opts.Name + "/enable?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) - if err != nil { - return err - } - resp.Body.Close() - return nil -} - -// DisablePluginOptions specify parameters to the DisablePlugin function. -// -// See https://goo.gl/C4t7Tz for more details. -type DisablePluginOptions struct { - // The Name of the plugin. - Name string `qs:"-"` - - Context context.Context -} - -// DisablePlugin disables plugin that opts point or returns an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) DisablePlugin(opts DisablePluginOptions) error { - path := "/plugins/" + opts.Name + "/disable" - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) - if err != nil { - return err - } - resp.Body.Close() - return nil -} - -// CreatePluginOptions specify parameters to the CreatePlugin function. -// -// See https://goo.gl/C4t7Tz for more details. -type CreatePluginOptions struct { - // The Name of the plugin. - Name string `qs:"name"` - // Path to tar containing plugin - Path string `qs:"-"` - - Context context.Context -} - -// CreatePlugin creates plugin that opts point or returns an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error) { - path := "/plugins/create?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ - data: opts.Path, - context: opts.Context, - }) - if err != nil { - return "", err - } - defer resp.Body.Close() - containerNameBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - return "", err - } - return string(containerNameBytes), nil -} - -// PushPluginOptions specify parameters to PushPlugin function. -// -// See https://goo.gl/C4t7Tz for more details. -type PushPluginOptions struct { - // The Name of the plugin. - Name string - - Context context.Context -} - -// PushPlugin pushes plugin that opts point or returns an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) PushPlugin(opts PushPluginOptions) error { - path := "/plugins/" + opts.Name + "/push" - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) - if err != nil { - return err - } - resp.Body.Close() - return nil -} - -// ConfigurePluginOptions specify parameters to the ConfigurePlugin -// -// See https://goo.gl/C4t7Tz for more details. -type ConfigurePluginOptions struct { - // The Name of the plugin. - Name string `qs:"name"` - Envs []string - - Context context.Context -} - -// ConfigurePlugin configures plugin that opts point or returns an error. -// -// See https://goo.gl/C4t7Tz for more details. -func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error { - path := "/plugins/" + opts.Name + "/set" - resp, err := c.do(http.MethodPost, path, doOptions{ - data: opts.Envs, - context: opts.Context, - }) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return &NoSuchPlugin{ID: opts.Name} - } - return err - } - resp.Body.Close() - return nil -} - -// NoSuchPlugin is the error returned when a given plugin does not exist. -type NoSuchPlugin struct { - ID string - Err error -} - -func (err *NoSuchPlugin) Error() string { - if err.Err != nil { - return err.Err.Error() - } - return "No such plugin: " + err.ID -} diff --git a/vendor/github.com/fsouza/go-dockerclient/plugin_test.go b/vendor/github.com/fsouza/go-dockerclient/plugin_test.go deleted file mode 100644 index 234edf27ee02..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/plugin_test.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2018 go-dockerclient 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 docker - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "reflect" - "testing" -) - -var expectPluginDetail = PluginDetail{ - ID: "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078", - Name: "tiborvass/sample-volume-plugin", - Tag: "latest", - Active: true, - Settings: PluginSettings{ - Env: []string{"DEBUG=0"}, - Args: nil, - Devices: nil, - }, - Config: PluginConfig{ - Description: "A sample volume plugin for Docker", - Documentation: "https://docs.docker.com/engine/extend/plugins/", - Interface: PluginInterface{ - Types: []string{"docker.volumedriver/1.0"}, - Socket: "plugins.sock", - }, - Entrypoint: []string{ - "/usr/bin/sample-volume-plugin", - "/data", - }, - WorkDir: "", - User: PluginUser{}, - Network: PluginNetwork{Type: ""}, - Linux: PluginLinux{Capabilities: nil, AllowAllDevices: false, Devices: nil}, - Mounts: nil, - PropagatedMount: "/data", - Env: []PluginEnv{ - { - Name: "DEBUG", - Description: "If set, prints debug messages", - Settable: nil, - Value: "0", - }, - }, - Args: PluginArgs{ - Name: "args", - Description: "command line arguments", - Settable: nil, - Value: []string{}, - }, - }, -} - -const jsonPluginDetail = `{ - "Id": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078", - "Name": "tiborvass/sample-volume-plugin", - "Tag": "latest", - "Enabled": true, - "Settings": { - "Env": [ - "DEBUG=0" - ], - "Args": null, - "Devices": null - }, - "Config": { - "Description": "A sample volume plugin for Docker", - "Documentation": "https://docs.docker.com/engine/extend/plugins/", - "Interface": { - "Types": [ - "docker.volumedriver/1.0" - ], - "Socket": "plugins.sock" - }, - "Entrypoint": [ - "/usr/bin/sample-volume-plugin", - "/data" - ], - "WorkDir": "", - "User": {}, - "Network": { - "Type": "" - }, - "Linux": { - "Capabilities": null, - "AllowAllDevices": false, - "Devices": null - }, - "Mounts": null, - "PropagatedMount": "/data", - "Env": [ - { - "Name": "DEBUG", - "Description": "If set, prints debug messages", - "Settable": null, - "Value": "0" - } - ], - "Args": { - "Name": "args", - "Description": "command line arguments", - "Settable": null, - "Value": [] - } - } - }` - -func TestListPlugins(t *testing.T) { - t.Parallel() - jsonPlugins := fmt.Sprintf("[%s]", jsonPluginDetail) - var expected []PluginDetail - err := json.Unmarshal([]byte(jsonPlugins), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonPlugins, status: http.StatusOK}) - pluginDetails, err := client.ListPlugins(context.Background()) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginDetails, expected) { - t.Errorf("ListPlugins: Expected %#v. Got %#v.", expected, pluginDetails) - } -} - -func TestListFilteredPlugins(t *testing.T) { - t.Parallel() - jsonPlugins := fmt.Sprintf("[%s]", jsonPluginDetail) - var expected []PluginDetail - err := json.Unmarshal([]byte(jsonPlugins), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonPlugins, status: http.StatusOK}) - - pluginDetails, err := client.ListFilteredPlugins( - ListFilteredPluginsOptions{ - Filters: map[string][]string{ - "capability": {"volumedriver"}, - "enabled": {"true"}, - }, - Context: context.Background(), - }) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginDetails, expected) { - t.Errorf("ListPlugins: Expected %#v. Got %#v.", expected, pluginDetails) - } -} - -func TestListFilteredPluginsFailure(t *testing.T) { - t.Parallel() - tests := []struct { - status int - message string - }{ - {400, "bad parameter"}, - {500, "internal server error"}, - } - for _, tt := range tests { - client := newTestClient(&FakeRoundTripper{message: tt.message, status: tt.status}) - expected := Error{Status: tt.status, Message: tt.message} - pluginDetails, err := client.ListFilteredPlugins(ListFilteredPluginsOptions{}) - if !reflect.DeepEqual(expected, *err.(*Error)) { - t.Errorf("Wrong error in ListFilteredPlugins. Want %#v. Got %#v.", expected, err) - } - if len(pluginDetails) > 0 { - t.Errorf("ListFilteredPlugins failure. Expected empty list. Got %#v.", pluginDetails) - } - } -} - -func TestGetPluginPrivileges(t *testing.T) { - t.Parallel() - name := "test_plugin" - jsonPluginPrivileges := `[ { "Name": "network", "Description": "", "Value": [ "host" ] }]` - fakeRT := &FakeRoundTripper{message: jsonPluginPrivileges, status: http.StatusNoContent} - client := newTestClient(fakeRT) - expected := []PluginPrivilege{ - { - Name: "network", - Description: "", - Value: []string{"host"}, - }, - } - pluginPrivileges, err := client.GetPluginPrivileges(name, context.Background()) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginPrivileges, expected) { - t.Errorf("PluginPrivileges: Expected %#v. Got %#v.", expected, pluginPrivileges) - } -} - -func TestGetPluginPrivilegesWithOptions(t *testing.T) { - t.Parallel() - remote := "test_plugin" - jsonPluginPrivileges := `[ { "Name": "network", "Description": "", "Value": [ "host" ] }]` - fakeRT := &FakeRoundTripper{message: jsonPluginPrivileges, status: http.StatusNoContent} - client := newTestClient(fakeRT) - expected := []PluginPrivilege{ - { - Name: "network", - Description: "", - Value: []string{"host"}, - }, - } - pluginPrivileges, err := client.GetPluginPrivilegesWithOptions(GetPluginPrivilegesOptions{ - Remote: remote, - Context: context.Background(), - Auth: AuthConfiguration{Username: "XY"}, - }) - - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginPrivileges, expected) { - t.Errorf("PluginPrivileges: Expected %#v. Got %#v.", expected, pluginPrivileges) - } - req := fakeRT.requests[0] - authHeader := req.Header.Get("X-Registry-Auth") - if authHeader == "" { - t.Errorf("InstallImage: unexpected empty X-Registry-Auth header: %v", authHeader) - } -} - -func TestInstallPlugins(t *testing.T) { - opts := InstallPluginOptions{ - Remote: "", Name: "test", - Plugins: []PluginPrivilege{ - { - Name: "network", - Description: "", - Value: []string{"host"}, - }, - }, - Context: context.Background(), - Auth: AuthConfiguration{Username: "XY"}, - } - - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - err := client.InstallPlugins(opts) - if err != nil { - t.Fatal(err) - } - - req := fakeRT.requests[0] - authHeader := req.Header.Get("X-Registry-Auth") - if authHeader == "" { - t.Errorf("InstallImage: unexpected empty X-Registry-Auth header: %v", authHeader) - } -} - -func TestInspectPlugin(t *testing.T) { - name := "test_plugin" - fakeRT := &FakeRoundTripper{message: jsonPluginDetail, status: http.StatusNoContent} - client := newTestClient(fakeRT) - pluginPrivileges, err := client.InspectPlugins(name, context.Background()) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginPrivileges, &expectPluginDetail) { - t.Errorf("InspectPlugins: Expected %#v. Got %#v.", &expectPluginDetail, pluginPrivileges) - } -} - -func TestRemovePlugin(t *testing.T) { - opts := RemovePluginOptions{ - Name: "test_plugin", - Force: false, - Context: context.Background(), - } - fakeRT := &FakeRoundTripper{message: jsonPluginDetail, status: http.StatusNoContent} - client := newTestClient(fakeRT) - pluginPrivileges, err := client.RemovePlugin(opts) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(pluginPrivileges, &expectPluginDetail) { - t.Errorf("RemovePlugin: Expected %#v. Got %#v.", &expectPluginDetail, pluginPrivileges) - } -} - -func TestRemovePluginNoResponse(t *testing.T) { - opts := RemovePluginOptions{ - Name: "test_plugin", - Force: false, - Context: context.Background(), - } - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - plugindetails, err := client.RemovePlugin(opts) - if err != nil { - t.Fatal(err) - } - - if plugindetails != nil { - t.Errorf("RemovePlugin: Expected %#v. Got %#v.", nil, plugindetails) - } -} - -func TestEnablePlugin(t *testing.T) { - opts := EnablePluginOptions{ - Name: "test", - Timeout: 5, - Context: context.Background(), - } - client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusOK}) - err := client.EnablePlugin(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestDisablePlugin(t *testing.T) { - opts := DisablePluginOptions{ - Name: "test", - Context: context.Background(), - } - client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusOK}) - err := client.DisablePlugin(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestCreatePlugin(t *testing.T) { - opts := CreatePluginOptions{ - Name: "test", - Path: "", - Context: context.Background(), - } - client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusOK}) - _, err := client.CreatePlugin(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestPushPlugin(t *testing.T) { - opts := PushPluginOptions{ - Name: "test", - Context: context.Background(), - } - client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusOK}) - err := client.PushPlugin(opts) - if err != nil { - t.Fatal(err) - } -} - -func TestConfigurePlugin(t *testing.T) { - opts := ConfigurePluginOptions{ - Name: "test", - Envs: []string{}, - Context: context.Background(), - } - client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusOK}) - err := client.ConfigurePlugin(opts) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/registry_auth.go b/vendor/github.com/fsouza/go-dockerclient/registry_auth.go deleted file mode 100644 index 1f60d1e8f3b3..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/registry_auth.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2013 go-dockerclient 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 docker - -type registryAuth interface { - isEmpty() bool - headerKey() string -} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_service.go b/vendor/github.com/fsouza/go-dockerclient/service.go similarity index 89% rename from vendor/github.com/fsouza/go-dockerclient/swarm_service.go rename to vendor/github.com/fsouza/go-dockerclient/service.go index 4accb2cb8c6b..33af547c6e5f 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_service.go +++ b/vendor/github.com/fsouza/go-dockerclient/service.go @@ -5,13 +5,15 @@ package docker import ( - "context" "encoding/json" "io" "net/http" + "net/url" + "strconv" "time" "github.com/docker/docker/api/types/swarm" + "golang.org/x/net/context" ) // NoSuchService is the error returned when a given service does not exist. @@ -46,7 +48,7 @@ func (c *Client) CreateService(opts CreateServiceOptions) (*swarm.Service, error return nil, err } path := "/services/create?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ headers: headers, data: opts.ServiceSpec, forceJSON: true, @@ -76,7 +78,7 @@ type RemoveServiceOptions struct { // See https://goo.gl/Tqrtya for more details. func (c *Client) RemoveService(opts RemoveServiceOptions) error { path := "/services/" + opts.ID - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) + resp, err := c.do("DELETE", path, doOptions{context: opts.Context}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchService{ID: opts.ID} @@ -91,11 +93,10 @@ func (c *Client) RemoveService(opts RemoveServiceOptions) error { // // See https://goo.gl/wu3MmS for more details. type UpdateServiceOptions struct { - Auth AuthConfiguration `qs:"-"` - swarm.ServiceSpec `qs:"-"` - Context context.Context - Version uint64 - Rollback string + Auth AuthConfiguration `qs:"-"` + swarm.ServiceSpec + Context context.Context + Version uint64 } // UpdateService updates the service at ID with the options @@ -106,7 +107,9 @@ func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error { if err != nil { return err } - resp, err := c.do(http.MethodPost, "/services/"+id+"/update?"+queryString(opts), doOptions{ + params := make(url.Values) + params.Set("version", strconv.FormatUint(opts.Version, 10)) + resp, err := c.do("POST", "/services/"+id+"/update?"+params.Encode(), doOptions{ headers: headers, data: opts.ServiceSpec, forceJSON: true, @@ -127,7 +130,7 @@ func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error { // See https://goo.gl/dHmr75 for more details. func (c *Client) InspectService(id string) (*swarm.Service, error) { path := "/services/" + id - resp, err := c.do(http.MethodGet, path, doOptions{}) + resp, err := c.do("GET", path, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchService{ID: id} @@ -147,7 +150,6 @@ func (c *Client) InspectService(id string) (*swarm.Service, error) { // See https://goo.gl/DwvNMd for more details. type ListServicesOptions struct { Filters map[string][]string - Status bool Context context.Context } @@ -156,7 +158,7 @@ type ListServicesOptions struct { // See https://goo.gl/DwvNMd for more details. func (c *Client) ListServices(opts ListServicesOptions) ([]swarm.Service, error) { path := "/services?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) + resp, err := c.do("GET", path, doOptions{context: opts.Context}) if err != nil { return nil, err } @@ -177,10 +179,10 @@ type LogsServiceOptions struct { ErrorStream io.Writer `qs:"-"` InactivityTimeout time.Duration `qs:"-"` Tail string - Since int64 // Use raw terminal? Usually true when the container contains a TTY. RawTerminal bool `qs:"-"` + Since int64 Follow bool Stdout bool Stderr bool @@ -204,7 +206,7 @@ func (c *Client) GetServiceLogs(opts LogsServiceOptions) error { opts.Tail = "all" } path := "/services/" + opts.Service + "/logs?" + queryString(opts) - return c.stream(http.MethodGet, path, streamOptions{ + return c.stream("GET", path, streamOptions{ setRawTerminal: opts.RawTerminal, stdout: opts.OutputStream, stderr: opts.ErrorStream, diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_service_test.go b/vendor/github.com/fsouza/go-dockerclient/service_test.go similarity index 89% rename from vendor/github.com/fsouza/go-dockerclient/swarm_service_test.go rename to vendor/github.com/fsouza/go-dockerclient/service_test.go index a5281fbde93b..6abb28df53e0 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_service_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/service_test.go @@ -6,7 +6,6 @@ package docker import ( "bytes" - "encoding/base64" "encoding/json" "net/http" "net/http/httptest" @@ -14,6 +13,9 @@ import ( "reflect" "testing" + "encoding/base64" + "strings" + "github.com/docker/docker/api/types/swarm" ) @@ -39,8 +41,8 @@ func TestCreateService(t *testing.T) { t.Errorf("CreateServce: wrong ID. Want %q. Got %q.", id, service.ID) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("CreateService: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("CreateService: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/services/create")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -52,9 +54,13 @@ func TestCreateService(t *testing.T) { t.Fatal(err) } - authHeader, ok := req.Header["X-Registry-Auth"] - if ok { - t.Errorf("CreateService: unexpected non-empty X-Registry-Auth header: %v", authHeader) + auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) + if err != nil { + t.Errorf("CreateService: caught error decoding auth. %#v", err.Error()) + } + if strings.TrimSpace(string(auth)) != "{}" { + t.Errorf("CreateService: wrong body. Want %q. Got %q.", + base64.URLEncoding.EncodeToString([]byte("{}")), req.Header.Get("X-Registry-Auth")) } } @@ -85,8 +91,8 @@ func TestCreateServiceWithAuthentication(t *testing.T) { t.Errorf("CreateServce: wrong ID. Want %q. Got %q.", id, service.ID) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("CreateService: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("CreateService: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/services/create")) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -124,8 +130,8 @@ func TestRemoveService(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodDelete { - t.Errorf("RemoveService(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodDelete, req.Method) + if req.Method != "DELETE" { + t.Errorf("RemoveService(%q): wrong HTTP method. Want %q. Got %q.", id, "DELETE", req.Method) } expectedURL, _ := url.Parse(client.getURL("/services/" + id)) if gotPath := req.URL.Path; gotPath != expectedURL.Path { @@ -138,7 +144,7 @@ func TestRemoveServiceNotFound(t *testing.T) { client := newTestClient(&FakeRoundTripper{message: "no such service", status: http.StatusNotFound}) err := client.RemoveService(RemoveServiceOptions{ID: "a2334"}) expected := &NoSuchService{ID: "a2334"} - if e := err.(*NoSuchService); e.ID != expected.ID { + if !reflect.DeepEqual(err, expected) { t.Errorf("RemoveService: Wrong error returned. Want %#v. Got %#v.", expected, err) } } @@ -154,8 +160,8 @@ func TestUpdateService(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateService: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("UpdateService: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/services/" + id + "/update?version=23")) if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { @@ -175,29 +181,6 @@ func TestUpdateService(t *testing.T) { } } -func TestUpdateServiceRollback(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2" - update := UpdateServiceOptions{Version: 23, Rollback: "previous"} - err := client.UpdateService(id, update) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateService: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/services/" + id + "/update?version=23&rollback=previous")) - if req.URL.Path != expectedURL.Path { - t.Errorf("UpdateService: Wrong path in request. Want %q. Got %q.", expectedURL.Path, req.URL.Path) - } - if !reflect.DeepEqual(req.URL.Query(), expectedURL.Query()) { - t.Errorf("UpdateService: Wrong querystring in request. Want %v. Got %v.", expectedURL.Query(), req.URL.Query()) - } -} - func TestUpdateServiceWithAuthentication(t *testing.T) { t.Parallel() fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} @@ -215,8 +198,8 @@ func TestUpdateServiceWithAuthentication(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateService: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) + if req.Method != "POST" { + t.Errorf("UpdateService: wrong HTTP method. Want %q. Got %q.", "POST", req.Method) } expectedURL, _ := url.Parse(client.getURL("/services/" + id + "/update?version=23")) if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { @@ -253,7 +236,7 @@ func TestUpdateServiceNotFound(t *testing.T) { update := UpdateServiceOptions{} err := client.UpdateService("notfound", update) expected := &NoSuchService{ID: "notfound"} - if e := err.(*NoSuchService); e.ID != expected.ID { + if !reflect.DeepEqual(err, expected) { t.Errorf("UpdateService: Wrong error returned. Want %#v. Got %#v.", expected, err) } } @@ -266,7 +249,7 @@ func TestInspectServiceNotFound(t *testing.T) { t.Errorf("InspectService: Expected service, got %#v", service) } expected := &NoSuchService{ID: "notfound"} - if e := err.(*NoSuchService); e.ID != expected.ID { + if !reflect.DeepEqual(err, expected) { t.Errorf("InspectService: Wrong error returned. Want %#v. Got %#v.", expected, err) } } @@ -463,7 +446,7 @@ func TestGetServiceLogs(t *testing.T) { if buf.String() != expected { t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) } - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/services/a123456/logs")) @@ -483,8 +466,8 @@ func TestGetServiceLogs(t *testing.T) { } } -func TestGetServicetLogsNilStdoutDoesntFail(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { +func TesGetServicetLogsNilStdoutDoesntFail(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { prefix := []byte{1, 0, 0, 0, 0, 0, 0, 19} w.Write(prefix) w.Write([]byte("something happened!")) @@ -506,7 +489,7 @@ func TestGetServicetLogsNilStdoutDoesntFail(t *testing.T) { } func TestGetServiceLogsNilStderrDoesntFail(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { prefix := []byte{2, 0, 0, 0, 0, 0, 0, 19} w.Write(prefix) w.Write([]byte("something happened!")) @@ -556,7 +539,7 @@ func TestGetServiceLogsSpecifyingTail(t *testing.T) { if buf.String() != expected { t.Errorf("Logs: wrong output. Want %q. Got %q.", expected, buf.String()) } - if req.Method != http.MethodGet { + if req.Method != "GET" { t.Errorf("Logs: wrong HTTP method. Want GET. Got %s.", req.Method) } u, _ := url.Parse(client.getURL("/services/a123456/logs")) @@ -577,7 +560,7 @@ func TestGetServiceLogsSpecifyingTail(t *testing.T) { } func TestGetServiceLogsRawTerminal(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("something happened!")) })) defer server.Close() @@ -608,7 +591,7 @@ func TestGetServiceLogsNoContainer(t *testing.T) { var client Client err := client.GetServiceLogs(LogsServiceOptions{}) expected := &NoSuchService{ID: ""} - if e := err.(*NoSuchService); e.ID != expected.ID { + if !reflect.DeepEqual(err, expected) { t.Errorf("AttachToContainer: wrong error. Want %#v. Got %#v.", expected, err) } } diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm.go b/vendor/github.com/fsouza/go-dockerclient/swarm.go index c1bbce76329f..6d9086a5522d 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm.go +++ b/vendor/github.com/fsouza/go-dockerclient/swarm.go @@ -5,7 +5,6 @@ package docker import ( - "context" "encoding/json" "errors" "net/http" @@ -13,6 +12,7 @@ import ( "strconv" "github.com/docker/docker/api/types/swarm" + "golang.org/x/net/context" ) var ( @@ -36,7 +36,7 @@ type InitSwarmOptions struct { // See https://goo.gl/ZWyG1M for more details. func (c *Client) InitSwarm(opts InitSwarmOptions) (string, error) { path := "/swarm/init" - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ data: opts.InitRequest, forceJSON: true, context: opts.Context, @@ -66,7 +66,7 @@ type JoinSwarmOptions struct { // See https://goo.gl/N59IP1 for more details. func (c *Client) JoinSwarm(opts JoinSwarmOptions) error { path := "/swarm/join" - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ data: opts.JoinRequest, forceJSON: true, context: opts.Context, @@ -93,7 +93,7 @@ func (c *Client) LeaveSwarm(opts LeaveSwarmOptions) error { params := make(url.Values) params.Set("force", strconv.FormatBool(opts.Force)) path := "/swarm/leave?" + params.Encode() - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ context: opts.Context, }) if err != nil { @@ -123,7 +123,7 @@ func (c *Client) UpdateSwarm(opts UpdateSwarmOptions) error { params.Set("rotateWorkerToken", strconv.FormatBool(opts.RotateWorkerToken)) params.Set("rotateManagerToken", strconv.FormatBool(opts.RotateManagerToken)) path := "/swarm/update?" + params.Encode() - resp, err := c.do(http.MethodPost, path, doOptions{ + resp, err := c.do("POST", path, doOptions{ data: opts.Swarm, forceJSON: true, context: opts.Context, @@ -141,7 +141,7 @@ func (c *Client) UpdateSwarm(opts UpdateSwarmOptions) error { // See https://goo.gl/MFwgX9 for more details. func (c *Client) InspectSwarm(ctx context.Context) (swarm.Swarm, error) { response := swarm.Swarm{} - resp, err := c.do(http.MethodGet, "/swarm", doOptions{ + resp, err := c.do("GET", "/swarm", doOptions{ context: ctx, }) if err != nil { diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_configs.go b/vendor/github.com/fsouza/go-dockerclient/swarm_configs.go deleted file mode 100644 index 399aa1dceafb..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_configs.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2017 go-dockerclient 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 docker - -import ( - "context" - "encoding/json" - "net/http" - "net/url" - "strconv" - - "github.com/docker/docker/api/types/swarm" -) - -// NoSuchConfig is the error returned when a given config does not exist. -type NoSuchConfig struct { - ID string - Err error -} - -func (err *NoSuchConfig) Error() string { - if err.Err != nil { - return err.Err.Error() - } - return "No such config: " + err.ID -} - -// CreateConfigOptions specify parameters to the CreateConfig function. -// -// See https://goo.gl/KrVjHz for more details. -type CreateConfigOptions struct { - Auth AuthConfiguration `qs:"-"` - swarm.ConfigSpec - Context context.Context -} - -// CreateConfig creates a new config, returning the config instance -// or an error in case of failure. -// -// See https://goo.gl/KrVjHz for more details. -func (c *Client) CreateConfig(opts CreateConfigOptions) (*swarm.Config, error) { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return nil, err - } - path := "/configs/create?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ - headers: headers, - data: opts.ConfigSpec, - forceJSON: true, - context: opts.Context, - }) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var config swarm.Config - if err := json.NewDecoder(resp.Body).Decode(&config); err != nil { - return nil, err - } - return &config, nil -} - -// RemoveConfigOptions encapsulates options to remove a config. -// -// See https://goo.gl/Tqrtya for more details. -type RemoveConfigOptions struct { - ID string `qs:"-"` - Context context.Context -} - -// RemoveConfig removes a config, returning an error in case of failure. -// -// See https://goo.gl/Tqrtya for more details. -func (c *Client) RemoveConfig(opts RemoveConfigOptions) error { - path := "/configs/" + opts.ID - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return &NoSuchConfig{ID: opts.ID} - } - return err - } - resp.Body.Close() - return nil -} - -// UpdateConfigOptions specify parameters to the UpdateConfig function. -// -// See https://goo.gl/wu3MmS for more details. -type UpdateConfigOptions struct { - Auth AuthConfiguration `qs:"-"` - swarm.ConfigSpec - Context context.Context - Version uint64 -} - -// UpdateConfig updates the config at ID with the options -// -// Only label can be updated -// https://docs.docker.com/engine/api/v1.33/#operation/ConfigUpdate -// See https://goo.gl/wu3MmS for more details. -func (c *Client) UpdateConfig(id string, opts UpdateConfigOptions) error { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return err - } - params := make(url.Values) - params.Set("version", strconv.FormatUint(opts.Version, 10)) - resp, err := c.do(http.MethodPost, "/configs/"+id+"/update?"+params.Encode(), doOptions{ - headers: headers, - data: opts.ConfigSpec, - forceJSON: true, - context: opts.Context, - }) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return &NoSuchConfig{ID: id} - } - return err - } - defer resp.Body.Close() - return nil -} - -// InspectConfig returns information about a config by its ID. -// -// See https://goo.gl/dHmr75 for more details. -func (c *Client) InspectConfig(id string) (*swarm.Config, error) { - path := "/configs/" + id - resp, err := c.do(http.MethodGet, path, doOptions{}) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return nil, &NoSuchConfig{ID: id} - } - return nil, err - } - defer resp.Body.Close() - var config swarm.Config - if err := json.NewDecoder(resp.Body).Decode(&config); err != nil { - return nil, err - } - return &config, nil -} - -// ListConfigsOptions specify parameters to the ListConfigs function. -// -// See https://goo.gl/DwvNMd for more details. -type ListConfigsOptions struct { - Filters map[string][]string - Context context.Context -} - -// ListConfigs returns a slice of configs matching the given criteria. -// -// See https://goo.gl/DwvNMd for more details. -func (c *Client) ListConfigs(opts ListConfigsOptions) ([]swarm.Config, error) { - path := "/configs?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var configs []swarm.Config - if err := json.NewDecoder(resp.Body).Decode(&configs); err != nil { - return nil, err - } - return configs, nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_configs_test.go b/vendor/github.com/fsouza/go-dockerclient/swarm_configs_test.go deleted file mode 100644 index 2583ca527b65..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_configs_test.go +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright 2017 go-dockerclient 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 docker - -import ( - "encoding/base64" - "encoding/json" - "net/http" - "net/url" - "reflect" - "testing" - - "github.com/docker/docker/api/types/swarm" -) - -func TestCreateConfig(t *testing.T) { - t.Parallel() - result := `{ - "Id": "d1c00f91353ab0fe368363fab76d124cc764f2db8e11832f89f5ce21c2ece675" -}` - var expected swarm.Config - err := json.Unmarshal([]byte(result), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: result, status: http.StatusOK} - client := newTestClient(fakeRT) - opts := CreateConfigOptions{} - config, err := client.CreateConfig(opts) - if err != nil { - t.Fatal(err) - } - id := "d1c00f91353ab0fe368363fab76d124cc764f2db8e11832f89f5ce21c2ece675" - if config.ID != id { - t.Errorf("CreateConfig: wrong ID. Want %q. Got %q.", id, config.ID) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("CreateConfig: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/configs/create")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("CreateConfig: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - var gotBody Config - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } -} - -func TestRemoveConfig(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "d1c00f91353ab0fe368363fab76d124cc764f2db8e11832f89f5ce21c2ece675" - opts := RemoveConfigOptions{ID: id} - err := client.RemoveConfig(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodDelete { - t.Errorf("RemoveConfig(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodDelete, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/configs/" + id)) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("RemoveConfig(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestRemoveConfigNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such config", status: http.StatusNotFound}) - err := client.RemoveConfig(RemoveConfigOptions{ID: "a2334"}) - expectNoSuchConfig(t, "a2334", err) -} - -func TestUpdateConfig(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "d1c00f91353ab0fe368363fab76d124cc764f2db8e11832f89f5ce21c2ece675" - update := UpdateConfigOptions{Version: 23} - err := client.UpdateConfig(id, update) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateConfig: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/configs/" + id + "/update?version=23")) - if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { - t.Errorf("UpdateConfig: Wrong path in request. Want %q. Got %q.", expectedURL.RequestURI(), gotURI) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("UpdateConfig: Wrong content-type in request. Want %q. Got %q.", expectedContentType, contentType) - } - var out UpdateConfigOptions - if err := json.NewDecoder(req.Body).Decode(&out); err != nil { - t.Fatal(err) - } - update.Version = 0 - if !reflect.DeepEqual(out, update) { - t.Errorf("UpdateConfig: wrong body\ngot %#v\nwant %#v", out, update) - } -} - -func TestUpdateConfigWithAuthentication(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "d1c00f91353ab0fe368363fab76d124cc764f2db8e11832f89f5ce21c2ece675" - update := UpdateConfigOptions{Version: 23} - update.Auth = AuthConfiguration{ - Username: "gopher", - Password: "gopher123", - Email: "gopher@tsuru.io", - } - - err := client.UpdateConfig(id, update) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateConfig: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/configs/" + id + "/update?version=23")) - if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { - t.Errorf("UpdateConfig: Wrong path in request. Want %q. Got %q.", expectedURL.RequestURI(), gotURI) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("UpdateConfig: Wrong content-type in request. Want %q. Got %q.", expectedContentType, contentType) - } - var out UpdateConfigOptions - if err := json.NewDecoder(req.Body).Decode(&out); err != nil { - t.Fatal(err) - } - var updateAuth AuthConfiguration - - auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) - if err != nil { - t.Errorf("UpdateConfig: caught error decoding auth. %#v", err.Error()) - } - - err = json.Unmarshal(auth, &updateAuth) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(updateAuth, update.Auth) { - t.Errorf("UpdateConfig: wrong auth configuration. Want %#v. Got %#v", update.Auth, updateAuth) - } -} - -func TestUpdateConfigNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such Config", status: http.StatusNotFound}) - update := UpdateConfigOptions{} - err := client.UpdateConfig("notfound", update) - expectNoSuchConfig(t, "notfound", err) -} - -func TestInspectConfigNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such config", status: http.StatusNotFound}) - config, err := client.InspectConfig("notfound") - if config != nil { - t.Errorf("InspectConfig: Expected Config, got %#v", config) - } - expectNoSuchConfig(t, "notfound", err) -} - -func TestInspectConfig(t *testing.T) { - t.Parallel() - jsonConfig := `{ - "ID": "ktnbjxoalbkvbvedmg1urrz8h", - "Version": { - "Index": 11 - }, - "CreatedAt": "2016-11-05T01:20:17.327670065Z", - "UpdatedAt": "2016-11-05T01:20:17.327670065Z", - "Spec": { - "Name": "app-dev.crt" - } -}` - var expected swarm.Config - err := json.Unmarshal([]byte(jsonConfig), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonConfig, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "ktnbjxoalbkvbvedmg1urrz8h" - config, err := client.InspectConfig(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*config, expected) { - t.Errorf("InspectConfig(%q): Expected %#v. Got %#v.", id, expected, config) - } - expectedURL, _ := url.Parse(client.getURL("/configs/ktnbjxoalbkvbvedmg1urrz8h")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("InspectConfig(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestListConfigs(t *testing.T) { - t.Parallel() - jsonConfigs := `[ - { - "ID": "ktnbjxoalbkvbvedmg1urrz8h", - "Version": { - "Index": 11 - }, - "CreatedAt": "2016-11-05T01:20:17.327670065Z", - "UpdatedAt": "2016-11-05T01:20:17.327670065Z", - "Spec": { - "Name": "server.conf" - } - } -]` - var expected []swarm.Config - err := json.Unmarshal([]byte(jsonConfigs), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonConfigs, status: http.StatusOK}) - configs, err := client.ListConfigs(ListConfigsOptions{}) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(configs, expected) { - t.Errorf("ListConfigs: Expected %#v. Got %#v.", expected, configs) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go b/vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go deleted file mode 100644 index 058c4a4af42a..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2016 go-dockerclient 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 docker - -import ( - "context" - "encoding/json" - "net/http" - "net/url" - "strconv" - - "github.com/docker/docker/api/types/swarm" -) - -// NoSuchSecret is the error returned when a given secret does not exist. -type NoSuchSecret struct { - ID string - Err error -} - -func (err *NoSuchSecret) Error() string { - if err.Err != nil { - return err.Err.Error() - } - return "No such secret: " + err.ID -} - -// CreateSecretOptions specify parameters to the CreateSecret function. -// -// See https://goo.gl/KrVjHz for more details. -type CreateSecretOptions struct { - Auth AuthConfiguration `qs:"-"` - swarm.SecretSpec - Context context.Context -} - -// CreateSecret creates a new secret, returning the secret instance -// or an error in case of failure. -// -// See https://goo.gl/KrVjHz for more details. -func (c *Client) CreateSecret(opts CreateSecretOptions) (*swarm.Secret, error) { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return nil, err - } - path := "/secrets/create?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{ - headers: headers, - data: opts.SecretSpec, - forceJSON: true, - context: opts.Context, - }) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var secret swarm.Secret - if err := json.NewDecoder(resp.Body).Decode(&secret); err != nil { - return nil, err - } - return &secret, nil -} - -// RemoveSecretOptions encapsulates options to remove a secret. -// -// See https://goo.gl/Tqrtya for more details. -type RemoveSecretOptions struct { - ID string `qs:"-"` - Context context.Context -} - -// RemoveSecret removes a secret, returning an error in case of failure. -// -// See https://goo.gl/Tqrtya for more details. -func (c *Client) RemoveSecret(opts RemoveSecretOptions) error { - path := "/secrets/" + opts.ID - resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context}) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return &NoSuchSecret{ID: opts.ID} - } - return err - } - resp.Body.Close() - return nil -} - -// UpdateSecretOptions specify parameters to the UpdateSecret function. -// -// Only label can be updated -// See https://docs.docker.com/engine/api/v1.33/#operation/SecretUpdate -// See https://goo.gl/wu3MmS for more details. -type UpdateSecretOptions struct { - Auth AuthConfiguration `qs:"-"` - swarm.SecretSpec - Context context.Context - Version uint64 -} - -// UpdateSecret updates the secret at ID with the options -// -// See https://goo.gl/wu3MmS for more details. -func (c *Client) UpdateSecret(id string, opts UpdateSecretOptions) error { - headers, err := headersWithAuth(opts.Auth) - if err != nil { - return err - } - params := make(url.Values) - params.Set("version", strconv.FormatUint(opts.Version, 10)) - resp, err := c.do(http.MethodPost, "/secrets/"+id+"/update?"+params.Encode(), doOptions{ - headers: headers, - data: opts.SecretSpec, - forceJSON: true, - context: opts.Context, - }) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return &NoSuchSecret{ID: id} - } - return err - } - defer resp.Body.Close() - return nil -} - -// InspectSecret returns information about a secret by its ID. -// -// See https://goo.gl/dHmr75 for more details. -func (c *Client) InspectSecret(id string) (*swarm.Secret, error) { - path := "/secrets/" + id - resp, err := c.do(http.MethodGet, path, doOptions{}) - if err != nil { - if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { - return nil, &NoSuchSecret{ID: id} - } - return nil, err - } - defer resp.Body.Close() - var secret swarm.Secret - if err := json.NewDecoder(resp.Body).Decode(&secret); err != nil { - return nil, err - } - return &secret, nil -} - -// ListSecretsOptions specify parameters to the ListSecrets function. -// -// See https://goo.gl/DwvNMd for more details. -type ListSecretsOptions struct { - Filters map[string][]string - Context context.Context -} - -// ListSecrets returns a slice of secrets matching the given criteria. -// -// See https://goo.gl/DwvNMd for more details. -func (c *Client) ListSecrets(opts ListSecretsOptions) ([]swarm.Secret, error) { - path := "/secrets?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var secrets []swarm.Secret - if err := json.NewDecoder(resp.Body).Decode(&secrets); err != nil { - return nil, err - } - return secrets, nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_secrets_test.go b/vendor/github.com/fsouza/go-dockerclient/swarm_secrets_test.go deleted file mode 100644 index 29cb98c82828..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_secrets_test.go +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright 2017 go-dockerclient 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 docker - -import ( - "encoding/base64" - "encoding/json" - "net/http" - "net/url" - "reflect" - "testing" - - "github.com/docker/docker/api/types/swarm" -) - -func TestCreateSecret(t *testing.T) { - t.Parallel() - result := `{ - "Id": "13417726f7654bc286201f7c9accc98ccbd190efcc4753bf8ecfc0b61ef3dde8" -}` - var expected swarm.Secret - err := json.Unmarshal([]byte(result), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: result, status: http.StatusOK} - client := newTestClient(fakeRT) - opts := CreateSecretOptions{} - secret, err := client.CreateSecret(opts) - if err != nil { - t.Fatal(err) - } - id := "13417726f7654bc286201f7c9accc98ccbd190efcc4753bf8ecfc0b61ef3dde8" - if secret.ID != id { - t.Errorf("CreateSecret: wrong ID. Want %q. Got %q.", id, secret.ID) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("CreateSecret: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/secrets/create")) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("CreateSecret: Wrong path in request. Want %q. Got %q.", expectedURL.Path, gotPath) - } - var gotBody Config - err = json.NewDecoder(req.Body).Decode(&gotBody) - if err != nil { - t.Fatal(err) - } -} - -func TestRemoveSecret(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "13417726f7654bc286201f7c9accc98ccbd190efcc4753bf8ecfc0b61ef3dde8" - opts := RemoveSecretOptions{ID: id} - err := client.RemoveSecret(opts) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodDelete { - t.Errorf("RemoveSecret(%q): wrong HTTP method. Want %q. Got %q.", id, http.MethodDelete, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/secrets/" + id)) - if gotPath := req.URL.Path; gotPath != expectedURL.Path { - t.Errorf("RemoveSecret(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestRemoveSecretNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such secret", status: http.StatusNotFound}) - err := client.RemoveSecret(RemoveSecretOptions{ID: "a2334"}) - expectNoSuchSecret(t, "a2334", err) -} - -func TestUpdateSecret(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "13417726f7654bc286201f7c9accc98ccbd190efcc4753bf8ecfc0b61ef3dde8" - update := UpdateSecretOptions{Version: 23} - err := client.UpdateSecret(id, update) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateSecret: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/secrets/" + id + "/update?version=23")) - if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { - t.Errorf("UpdateSecret: Wrong path in request. Want %q. Got %q.", expectedURL.RequestURI(), gotURI) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("UpdateSecret: Wrong content-type in request. Want %q. Got %q.", expectedContentType, contentType) - } - var out UpdateSecretOptions - if err := json.NewDecoder(req.Body).Decode(&out); err != nil { - t.Fatal(err) - } - update.Version = 0 - if !reflect.DeepEqual(out, update) { - t.Errorf("UpdateSecret: wrong body\ngot %#v\nwant %#v", out, update) - } -} - -func TestUpdateSecretWithAuthentication(t *testing.T) { - t.Parallel() - fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} - client := newTestClient(fakeRT) - id := "13417726f7654bc286201f7c9accc98ccbd190efcc4753bf8ecfc0b61ef3dde8" - update := UpdateSecretOptions{Version: 23} - update.Auth = AuthConfiguration{ - Username: "gopher", - Password: "gopher123", - Email: "gopher@tsuru.io", - } - - err := client.UpdateSecret(id, update) - if err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - if req.Method != http.MethodPost { - t.Errorf("UpdateSecret: wrong HTTP method. Want %q. Got %q.", http.MethodPost, req.Method) - } - expectedURL, _ := url.Parse(client.getURL("/secrets/" + id + "/update?version=23")) - if gotURI := req.URL.RequestURI(); gotURI != expectedURL.RequestURI() { - t.Errorf("UpdateSecret: Wrong path in request. Want %q. Got %q.", expectedURL.RequestURI(), gotURI) - } - expectedContentType := "application/json" - if contentType := req.Header.Get("Content-Type"); contentType != expectedContentType { - t.Errorf("UpdateSecret: Wrong content-type in request. Want %q. Got %q.", expectedContentType, contentType) - } - var out UpdateSecretOptions - if err := json.NewDecoder(req.Body).Decode(&out); err != nil { - t.Fatal(err) - } - var updateAuth AuthConfiguration - - auth, err := base64.URLEncoding.DecodeString(req.Header.Get("X-Registry-Auth")) - if err != nil { - t.Errorf("UpdateSecret: caught error decoding auth. %#v", err.Error()) - } - - err = json.Unmarshal(auth, &updateAuth) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(updateAuth, update.Auth) { - t.Errorf("UpdateSecret: wrong auth configuration. Want %#v. Got %#v", update.Auth, updateAuth) - } -} - -func TestUpdateSecretNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such Secret", status: http.StatusNotFound}) - update := UpdateSecretOptions{} - err := client.UpdateSecret("notfound", update) - expectNoSuchSecret(t, "notfound", err) -} - -func TestInspectSecretNotFound(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "no such secret", status: http.StatusNotFound}) - secret, err := client.InspectSecret("notfound") - if secret != nil { - t.Errorf("InspectSecret: Expected Secret, got %#v", secret) - } - expectNoSuchSecret(t, "notfound", err) -} - -func TestInspectSecret(t *testing.T) { - t.Parallel() - jsonSecret := `{ - "ID": "ak7w3gjqoa3kuz8xcpnyy0pvl", - "Version": { - "Index": 11 - }, - "CreatedAt": "2016-11-05T01:20:17.327670065Z", - "UpdatedAt": "2016-11-05T01:20:17.327670065Z", - "Spec": { - "Name": "app-dev.crt", - "Labels": { - "foo": "bar" - }, - "Driver": { - "Name": "secret-bucket", - "Options": { - "OptionA": "value for driver option A", - "OptionB": "value for driver option B" - } - } - } -}` - var expected swarm.Secret - err := json.Unmarshal([]byte(jsonSecret), &expected) - if err != nil { - t.Fatal(err) - } - fakeRT := &FakeRoundTripper{message: jsonSecret, status: http.StatusOK} - client := newTestClient(fakeRT) - id := "ak7w3gjqoa3kuz8xcpnyy0pvl" - secret, err := client.InspectSecret(id) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(*secret, expected) { - t.Errorf("InspectSecret(%q): Expected %#v. Got %#v.", id, expected, secret) - } - expectedURL, _ := url.Parse(client.getURL("/secrets/ak7w3gjqoa3kuz8xcpnyy0pvl")) - if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { - t.Errorf("InspectSecret(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) - } -} - -func TestListSecrets(t *testing.T) { - t.Parallel() - jsonSecrets := `[ - { - "ID": "blt1owaxmitz71s9v5zh81zun", - "Version": { - "Index": 85 - }, - "CreatedAt": "2017-07-20T13:55:28.678958722Z", - "UpdatedAt": "2017-07-20T13:55:28.678958722Z", - "Spec": { - "Name": "mysql-passwd", - "Labels": { - "some.label": "some.value" - }, - "Driver": { - "Name": "secret-bucket", - "Options": { - "OptionA": "value for driver option A", - "OptionB": "value for driver option B" - } - } - } - }, - { - "ID": "ktnbjxoalbkvbvedmg1urrz8h", - "Version": { - "Index": 11 - }, - "CreatedAt": "2016-11-05T01:20:17.327670065Z", - "UpdatedAt": "2016-11-05T01:20:17.327670065Z", - "Spec": { - "Name": "app-dev.crt", - "Labels": { - "foo": "bar" - } - } - } -]` - var expected []swarm.Secret - err := json.Unmarshal([]byte(jsonSecrets), &expected) - if err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: jsonSecrets, status: http.StatusOK}) - secrets, err := client.ListSecrets(ListSecretsOptions{}) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(secrets, expected) { - t.Errorf("ListSecrets: Expected %#v. Got %#v.", expected, secrets) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_test.go b/vendor/github.com/fsouza/go-dockerclient/swarm_test.go index 8f464fa4c212..4023541bda14 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/swarm_test.go @@ -5,7 +5,6 @@ package docker import ( - "context" "net/http" "net/url" "reflect" @@ -23,7 +22,7 @@ func TestInitSwarm(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("InitSwarm: Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) } @@ -60,7 +59,7 @@ func TestJoinSwarm(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("JoinSwarm: Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) } @@ -88,7 +87,7 @@ func TestLeaveSwarm(t *testing.T) { t.Parallel() fakeRT := &FakeRoundTripper{message: "", status: http.StatusOK} client := newTestClient(fakeRT) - testData := []struct { + var testData = []struct { force bool expectedURI string }{ @@ -100,7 +99,7 @@ func TestLeaveSwarm(t *testing.T) { if err != nil { t.Fatal(err) } - expectedMethod := http.MethodPost + expectedMethod := "POST" req := fakeRT.requests[i] if req.Method != expectedMethod { t.Errorf("LeaveSwarm: Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) @@ -140,7 +139,7 @@ func TestUpdateSwarm(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("UpdateSwarm: Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) } @@ -177,12 +176,12 @@ func TestInspectSwarm(t *testing.T) { t.Parallel() fakeRT := &FakeRoundTripper{message: `{"ID": "123"}`, status: http.StatusOK} client := newTestClient(fakeRT) - response, err := client.InspectSwarm(context.TODO()) + response, err := client.InspectSwarm(nil) if err != nil { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodGet + expectedMethod := "GET" if req.Method != expectedMethod { t.Errorf("InspectSwarm: Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) } @@ -199,12 +198,12 @@ func TestInspectSwarm(t *testing.T) { func TestInspectSwarmNotInSwarm(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "", status: http.StatusNotAcceptable}) - _, err := client.InspectSwarm(context.TODO()) + _, err := client.InspectSwarm(nil) if err != ErrNodeNotInSwarm { t.Errorf("InspectSwarm: Wrong error type. Want %#v. Got %#v", ErrNodeNotInSwarm, err) } client = newTestClient(&FakeRoundTripper{message: "", status: http.StatusServiceUnavailable}) - _, err = client.InspectSwarm(context.TODO()) + _, err = client.InspectSwarm(nil) if err != ErrNodeNotInSwarm { t.Errorf("InspectSwarm: Wrong error type. Want %#v. Got %#v", ErrNodeNotInSwarm, err) } diff --git a/vendor/github.com/fsouza/go-dockerclient/system.go b/vendor/github.com/fsouza/go-dockerclient/system.go deleted file mode 100644 index 46b9faf00e2b..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/system.go +++ /dev/null @@ -1,73 +0,0 @@ -package docker - -import ( - "context" - "encoding/json" - "net/http" -) - -// VolumeUsageData represents usage data from the docker system api -// More Info Here https://dockr.ly/2PNzQyO -type VolumeUsageData struct { - - // The number of containers referencing this volume. This field - // is set to `-1` if the reference-count is not available. - // - // Required: true - RefCount int64 `json:"RefCount"` - - // Amount of disk space used by the volume (in bytes). This information - // is only available for volumes created with the `"local"` volume - // driver. For volumes created with other volume drivers, this field - // is set to `-1` ("not available") - // - // Required: true - Size int64 `json:"Size"` -} - -// ImageSummary represents data about what images are -// currently known to docker -// More Info Here https://dockr.ly/2PNzQyO -type ImageSummary struct { - Containers int64 `json:"Containers"` - Created int64 `json:"Created"` - ID string `json:"Id"` - Labels map[string]string `json:"Labels"` - ParentID string `json:"ParentId"` - RepoDigests []string `json:"RepoDigests"` - RepoTags []string `json:"RepoTags"` - SharedSize int64 `json:"SharedSize"` - Size int64 `json:"Size"` - VirtualSize int64 `json:"VirtualSize"` -} - -// DiskUsage holds information about what docker is using disk space on. -// More Info Here https://dockr.ly/2PNzQyO -type DiskUsage struct { - LayersSize int64 - Images []*ImageSummary - Containers []*APIContainers - Volumes []*Volume -} - -// DiskUsageOptions only contains a context for canceling. -type DiskUsageOptions struct { - Context context.Context -} - -// DiskUsage returns a *DiskUsage describing what docker is using disk on. -// -// More Info Here https://dockr.ly/2PNzQyO -func (c *Client) DiskUsage(opts DiskUsageOptions) (*DiskUsage, error) { - path := "/system/df" - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var du *DiskUsage - if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { - return nil, err - } - return du, nil -} diff --git a/vendor/github.com/fsouza/go-dockerclient/system_test.go b/vendor/github.com/fsouza/go-dockerclient/system_test.go deleted file mode 100644 index 41277f32e587..000000000000 --- a/vendor/github.com/fsouza/go-dockerclient/system_test.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2015 go-dockerclient 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 docker - -import ( - "encoding/json" - "net/http" - "reflect" - "testing" -) - -func TestDiskUsage(t *testing.T) { - t.Parallel() - duData := ` -{ - "LayersSize": 17667551166, - "Images": [ - { - "Containers": 7, - "Created": 1536130571, - "Id": "sha256:056f6f1952204e38bd67cd2901c0cb2fc4cc8b640d1264814a9916b33eb34794", - "Labels": null, - "ParentId": "", - "RepoDigests": [ - "fnproject/fn-test-utils@sha256:2ce83a86519d48b4f0deec062887c8aebf483708f4b87c0756a7cb108ecc98f8" - ], - "RepoTags": [ - "fnproject/fn-test-utils:latest" - ], - "SharedSize": 4413370, - "Size": 10861179, - "VirtualSize": 10861179 - } - ], - "Containers": [ - { - "Id": "52bd62a82a72d8db8162eeef45a15dbec0a9066903631bff99a02c5e8dafcb3c", - "Names": [ - "/0_prefork_01CP3AMNDS0000000000000001" - ], - "Image": "busybox", - "ImageID": "sha256:e1ddd7948a1c31709a23cc5b7dfe96e55fc364f90e1cebcde0773a1b5a30dcda", - "Command": "tail -f /dev/null", - "Created": 1535562634, - "Ports": [], - "SizeRootFs": 1162769, - "Labels": {}, - "State": "running", - "Status": "Up 2 weeks", - "HostConfig": { - "NetworkMode": "default" - }, - "NetworkSettings": { - "Networks": { - "bridge": { - "IPAMConfig": null, - "Links": null, - "Aliases": null, - "NetworkID": "2e879f7f3faba9c4970920e31b1185cadccb8a5c564a8393871c5ae114c49b39", - "EndpointID": "853c2b7bc4e7bd47834a45d0c93465ffaecea09103fcf4caa098c88b974f4124", - "Gateway": "172.17.0.1", - "IPAddress": "172.17.0.5", - "IPPrefixLen": 16, - "IPv6Gateway": "", - "GlobalIPv6Address": "", - "GlobalIPv6PrefixLen": 0, - "MacAddress": "02:42:ac:11:00:05", - "DriverOpts": null - } - } - }, - "Mounts": [] - } - ], - "Volumes": [ - { - "CreatedAt": "2018-07-18T11:17:34-07:00", - "Driver": "local", - "Labels": null, - "Mountpoint": "", - "Name": "1284e17abce1d43818d7136849095c6a449a8dcfbaa859c2ff7c40abc75653eb", - "Options": {}, - "Scope": "local", - "UsageData": { - "RefCount": 0, - "Size": 0 - } - } - ], - "BuilderSize": 0 -} - -` - var expected *DiskUsage - if err := json.Unmarshal([]byte(duData), &expected); err != nil { - t.Fatal(err) - } - client := newTestClient(&FakeRoundTripper{message: duData, status: http.StatusOK}) - du, err := client.DiskUsage(DiskUsageOptions{}) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(du, expected) { - t.Errorf("DiskUsage: Wrong return value. Want %#v. Got %#v.", expected, du) - } -} diff --git a/vendor/github.com/fsouza/go-dockerclient/tar.go b/vendor/github.com/fsouza/go-dockerclient/tar.go index f27a7bbf21ff..be4dfa573e43 100644 --- a/vendor/github.com/fsouza/go-dockerclient/tar.go +++ b/vendor/github.com/fsouza/go-dockerclient/tar.go @@ -18,11 +18,6 @@ import ( ) func createTarStream(srcPath, dockerfilePath string) (io.ReadCloser, error) { - srcPath, err := filepath.Abs(srcPath) - if err != nil { - return nil, err - } - excludes, err := parseDockerignore(srcPath) if err != nil { return nil, err @@ -47,7 +42,7 @@ func createTarStream(srcPath, dockerfilePath string) (io.ReadCloser, error) { } keepThem, err := fileutils.Matches(includeFile, excludes) if err != nil { - return nil, fmt.Errorf("cannot match .dockerfileignore: '%s', error: %w", includeFile, err) + return nil, fmt.Errorf("cannot match .dockerfile: '%s', error: %s", includeFile, err) } if keepThem { includes = append(includes, includeFile) @@ -85,7 +80,7 @@ func validateContextDirectory(srcPath string, excludes []string) error { if err != nil { if os.IsPermission(err) { - return fmt.Errorf("cannot stat %q: %w", filePath, err) + return fmt.Errorf("can't stat '%s'", filePath) } if os.IsNotExist(err) { return nil @@ -101,8 +96,8 @@ func validateContextDirectory(srcPath string, excludes []string) error { if !f.IsDir() { currentFile, err := os.Open(filePath) - if err != nil { - return fmt.Errorf("cannot open %q for reading: %w", filePath, err) + if err != nil && os.IsPermission(err) { + return fmt.Errorf("no permission to read from '%s'", filePath) } currentFile.Close() } @@ -114,7 +109,7 @@ func parseDockerignore(root string) ([]string, error) { var excludes []string ignore, err := ioutil.ReadFile(path.Join(root, ".dockerignore")) if err != nil && !os.IsNotExist(err) { - return excludes, fmt.Errorf("error reading .dockerignore: %w", err) + return excludes, fmt.Errorf("error reading .dockerignore: '%s'", err) } excludes = strings.Split(string(ignore), "\n") diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_task.go b/vendor/github.com/fsouza/go-dockerclient/task.go similarity index 91% rename from vendor/github.com/fsouza/go-dockerclient/swarm_task.go rename to vendor/github.com/fsouza/go-dockerclient/task.go index 547642f5e392..b1dad4b231bd 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_task.go +++ b/vendor/github.com/fsouza/go-dockerclient/task.go @@ -5,11 +5,11 @@ package docker import ( - "context" "encoding/json" "net/http" "github.com/docker/docker/api/types/swarm" + "golang.org/x/net/context" ) // NoSuchTask is the error returned when a given task does not exist. @@ -38,7 +38,7 @@ type ListTasksOptions struct { // See http://goo.gl/rByLzw for more details. func (c *Client) ListTasks(opts ListTasksOptions) ([]swarm.Task, error) { path := "/tasks?" + queryString(opts) - resp, err := c.do(http.MethodGet, path, doOptions{context: opts.Context}) + resp, err := c.do("GET", path, doOptions{context: opts.Context}) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func (c *Client) ListTasks(opts ListTasksOptions) ([]swarm.Task, error) { // // See http://goo.gl/kyziuq for more details. func (c *Client) InspectTask(id string) (*swarm.Task, error) { - resp, err := c.do(http.MethodGet, "/tasks/"+id, doOptions{}) + resp, err := c.do("GET", "/tasks/"+id, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, &NoSuchTask{ID: id} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_task_test.go b/vendor/github.com/fsouza/go-dockerclient/task_test.go similarity index 96% rename from vendor/github.com/fsouza/go-dockerclient/swarm_task_test.go rename to vendor/github.com/fsouza/go-dockerclient/task_test.go index 148b850d3748..920830235810 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_task_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/task_test.go @@ -6,7 +6,6 @@ package docker import ( "encoding/json" - "errors" "net/http" "net/url" "reflect" @@ -234,6 +233,7 @@ func TestListTasks(t *testing.T) { if !reflect.DeepEqual(tasks, expected) { t.Errorf("ListTasks: Expected %#v. Got %#v.", expected, tasks) } + } func TestInspectTask(t *testing.T) { @@ -359,21 +359,18 @@ func TestInspectTask(t *testing.T) { if gotPath := fakeRT.requests[0].URL.Path; gotPath != expectedURL.Path { t.Errorf("InspectTask(%q): Wrong path in request. Want %q. Got %q.", id, expectedURL.Path, gotPath) } + } func TestInspectTaskNotFound(t *testing.T) { t.Parallel() - const taskID = "notfound" client := newTestClient(&FakeRoundTripper{message: "no such task", status: http.StatusNotFound}) - task, err := client.InspectTask(taskID) + task, err := client.InspectTask("notfound") if task != nil { t.Errorf("InspectTask: Expected task, got %#v", task) } - var taskErr *NoSuchTask - if !errors.As(err, &taskErr) { - t.Fatalf("InspectTask: wrong error tyope returned. Want %#v. Got %#v.", taskErr, err) - } - if taskErr.ID != taskID { - t.Errorf("wrong taskID\nwant %q\ngot %q", taskID, taskErr.ID) + expected := &NoSuchTask{ID: "notfound"} + if !reflect.DeepEqual(err, expected) { + t.Errorf("InspectTask: Wrong error returned. Want %#v. Got %#v.", expected, err) } } diff --git a/vendor/github.com/fsouza/go-dockerclient/testing/server.go b/vendor/github.com/fsouza/go-dockerclient/testing/server.go index 8a1298f57c00..81e520084926 100644 --- a/vendor/github.com/fsouza/go-dockerclient/testing/server.go +++ b/vendor/github.com/fsouza/go-dockerclient/testing/server.go @@ -28,7 +28,7 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/stdcopy" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" "github.com/gorilla/mux" ) @@ -42,13 +42,12 @@ var nameRegexp = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]+$`) // // For more details on the remote API, check http://goo.gl/G3plxW. type DockerServer struct { - containers map[string]*docker.Container - contNameToID map[string]string + containers []*docker.Container uploadedFiles map[string]string execs []*docker.ExecInspect execMut sync.RWMutex cMut sync.RWMutex - images map[string]docker.Image + images []docker.Image iMut sync.RWMutex imgIDs map[string]string networks []*docker.Network @@ -81,25 +80,18 @@ type volumeCounter struct { count int } -func baseDockerServer() DockerServer { - return DockerServer{ - containers: make(map[string]*docker.Container), - contNameToID: make(map[string]string), +func buildDockerServer(listener net.Listener, containerChan chan<- *docker.Container, hook func(*http.Request)) *DockerServer { + server := DockerServer{ + listener: listener, imgIDs: make(map[string]string), - images: make(map[string]docker.Image), + hook: hook, failures: make(map[string]string), execCallbacks: make(map[string]func()), statsCallbacks: make(map[string]func(string) docker.Stats), customHandlers: make(map[string]http.Handler), uploadedFiles: make(map[string]string), + cChan: containerChan, } -} - -func buildDockerServer(listener net.Listener, containerChan chan<- *docker.Container, hook func(*http.Request)) *DockerServer { - server := baseDockerServer() - server.listener = listener - server.hook = hook - server.cChan = containerChan server.buildMuxer() return &server } @@ -167,65 +159,64 @@ func (s *DockerServer) notify(container *docker.Container) { func (s *DockerServer) buildMuxer() { s.mux = mux.NewRouter() - s.mux.Path("/commit").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.commitContainer)) - s.mux.Path("/containers/json").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.listContainers)) - s.mux.Path("/containers/create").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.createContainer)) - s.mux.Path("/containers/{id:.*}/json").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.inspectContainer)) - s.mux.Path("/containers/{id:.*}/rename").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.renameContainer)) - s.mux.Path("/containers/{id:.*}/top").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.topContainer)) - s.mux.Path("/containers/{id:.*}/start").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.startContainer)) - s.mux.Path("/containers/{id:.*}/kill").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.stopContainer)) - s.mux.Path("/containers/{id:.*}/stop").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.stopContainer)) - s.mux.Path("/containers/{id:.*}/pause").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.pauseContainer)) - s.mux.Path("/containers/{id:.*}/unpause").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.unpauseContainer)) - s.mux.Path("/containers/{id:.*}/wait").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.waitContainer)) - s.mux.Path("/containers/{id:.*}/attach").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.attachContainer)) - s.mux.Path("/containers/{id:.*}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.removeContainer)) - s.mux.Path("/containers/{id:.*}/exec").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.createExecContainer)) - s.mux.Path("/containers/{id:.*}/stats").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.statsContainer)) - s.mux.Path("/containers/{id:.*}/archive").Methods(http.MethodPut).HandlerFunc(s.handlerWrapper(s.uploadToContainer)) - s.mux.Path("/containers/{id:.*}/archive").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.downloadFromContainer)) - s.mux.Path("/containers/{id:.*}/logs").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.logContainer)) - s.mux.Path("/exec/{id:.*}/resize").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.resizeExecContainer)) - s.mux.Path("/exec/{id:.*}/start").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.startExecContainer)) - s.mux.Path("/exec/{id:.*}/json").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.inspectExecContainer)) - s.mux.Path("/images/create").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.pullImage)) - s.mux.Path("/build").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.buildImage)) - s.mux.Path("/images/json").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.listImages)) - s.mux.Path("/images/{id:.*}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.removeImage)) - s.mux.Path("/images/{name:.*}/json").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.inspectImage)) - s.mux.Path("/images/{name:.*}/push").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.pushImage)) - s.mux.Path("/images/{name:.*}/tag").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.tagImage)) - s.mux.Path("/events").Methods(http.MethodGet).HandlerFunc(s.listEvents) - s.mux.Path("/_ping").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.pingDocker)) - s.mux.Path("/images/load").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.loadImage)) - s.mux.Path("/images/{id:.*}/get").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.getImage)) - s.mux.Path("/networks").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.listNetworks)) - s.mux.Path("/networks/{id:.*}").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.networkInfo)) - s.mux.Path("/networks/{id:.*}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.removeNetwork)) - s.mux.Path("/networks/create").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.createNetwork)) - s.mux.Path("/networks/{id:.*}/connect").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.networksConnect)) - s.mux.Path("/volumes").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.listVolumes)) - s.mux.Path("/volumes/create").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.createVolume)) - s.mux.Path("/volumes/{name:.*}").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.inspectVolume)) - s.mux.Path("/volumes/{name:.*}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.removeVolume)) - s.mux.Path("/info").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.infoDocker)) - s.mux.Path("/version").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.versionDocker)) - s.mux.Path("/swarm/init").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.swarmInit)) - s.mux.Path("/swarm").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.swarmInspect)) - s.mux.Path("/swarm/join").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.swarmJoin)) - s.mux.Path("/swarm/leave").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.swarmLeave)) - s.mux.Path("/nodes/{id:.+}/update").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.nodeUpdate)) - s.mux.Path("/nodes/{id:.+}").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.nodeInspect)) - s.mux.Path("/nodes/{id:.+}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.nodeDelete)) - s.mux.Path("/nodes").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.nodeList)) - s.mux.Path("/services/create").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.serviceCreate)) - s.mux.Path("/services/{id:.+}").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.serviceInspect)) - s.mux.Path("/services").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.serviceList)) - s.mux.Path("/services/{id:.+}").Methods(http.MethodDelete).HandlerFunc(s.handlerWrapper(s.serviceDelete)) - s.mux.Path("/services/{id:.+}/update").Methods(http.MethodPost).HandlerFunc(s.handlerWrapper(s.serviceUpdate)) - s.mux.Path("/tasks").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.taskList)) - s.mux.Path("/tasks/{id:.+}").Methods(http.MethodGet).HandlerFunc(s.handlerWrapper(s.taskInspect)) + s.mux.Path("/commit").Methods("POST").HandlerFunc(s.handlerWrapper(s.commitContainer)) + s.mux.Path("/containers/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listContainers)) + s.mux.Path("/containers/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.createContainer)) + s.mux.Path("/containers/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectContainer)) + s.mux.Path("/containers/{id:.*}/rename").Methods("POST").HandlerFunc(s.handlerWrapper(s.renameContainer)) + s.mux.Path("/containers/{id:.*}/top").Methods("GET").HandlerFunc(s.handlerWrapper(s.topContainer)) + s.mux.Path("/containers/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startContainer)) + s.mux.Path("/containers/{id:.*}/kill").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer)) + s.mux.Path("/containers/{id:.*}/stop").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer)) + s.mux.Path("/containers/{id:.*}/pause").Methods("POST").HandlerFunc(s.handlerWrapper(s.pauseContainer)) + s.mux.Path("/containers/{id:.*}/unpause").Methods("POST").HandlerFunc(s.handlerWrapper(s.unpauseContainer)) + s.mux.Path("/containers/{id:.*}/wait").Methods("POST").HandlerFunc(s.handlerWrapper(s.waitContainer)) + s.mux.Path("/containers/{id:.*}/attach").Methods("POST").HandlerFunc(s.handlerWrapper(s.attachContainer)) + s.mux.Path("/containers/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeContainer)) + s.mux.Path("/containers/{id:.*}/exec").Methods("POST").HandlerFunc(s.handlerWrapper(s.createExecContainer)) + s.mux.Path("/containers/{id:.*}/stats").Methods("GET").HandlerFunc(s.handlerWrapper(s.statsContainer)) + s.mux.Path("/containers/{id:.*}/archive").Methods("PUT").HandlerFunc(s.handlerWrapper(s.uploadToContainer)) + s.mux.Path("/containers/{id:.*}/archive").Methods("GET").HandlerFunc(s.handlerWrapper(s.downloadFromContainer)) + s.mux.Path("/containers/{id:.*}/logs").Methods("GET").HandlerFunc(s.handlerWrapper(s.logContainer)) + s.mux.Path("/exec/{id:.*}/resize").Methods("POST").HandlerFunc(s.handlerWrapper(s.resizeExecContainer)) + s.mux.Path("/exec/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startExecContainer)) + s.mux.Path("/exec/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectExecContainer)) + s.mux.Path("/images/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.pullImage)) + s.mux.Path("/build").Methods("POST").HandlerFunc(s.handlerWrapper(s.buildImage)) + s.mux.Path("/images/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listImages)) + s.mux.Path("/images/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeImage)) + s.mux.Path("/images/{name:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectImage)) + s.mux.Path("/images/{name:.*}/push").Methods("POST").HandlerFunc(s.handlerWrapper(s.pushImage)) + s.mux.Path("/images/{name:.*}/tag").Methods("POST").HandlerFunc(s.handlerWrapper(s.tagImage)) + s.mux.Path("/events").Methods("GET").HandlerFunc(s.listEvents) + s.mux.Path("/_ping").Methods("GET").HandlerFunc(s.handlerWrapper(s.pingDocker)) + s.mux.Path("/images/load").Methods("POST").HandlerFunc(s.handlerWrapper(s.loadImage)) + s.mux.Path("/images/{id:.*}/get").Methods("GET").HandlerFunc(s.handlerWrapper(s.getImage)) + s.mux.Path("/networks").Methods("GET").HandlerFunc(s.handlerWrapper(s.listNetworks)) + s.mux.Path("/networks/{id:.*}").Methods("GET").HandlerFunc(s.handlerWrapper(s.networkInfo)) + s.mux.Path("/networks/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeNetwork)) + s.mux.Path("/networks/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.createNetwork)) + s.mux.Path("/volumes").Methods("GET").HandlerFunc(s.handlerWrapper(s.listVolumes)) + s.mux.Path("/volumes/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.createVolume)) + s.mux.Path("/volumes/{name:.*}").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectVolume)) + s.mux.Path("/volumes/{name:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeVolume)) + s.mux.Path("/info").Methods("GET").HandlerFunc(s.handlerWrapper(s.infoDocker)) + s.mux.Path("/version").Methods("GET").HandlerFunc(s.handlerWrapper(s.versionDocker)) + s.mux.Path("/swarm/init").Methods("POST").HandlerFunc(s.handlerWrapper(s.swarmInit)) + s.mux.Path("/swarm").Methods("GET").HandlerFunc(s.handlerWrapper(s.swarmInspect)) + s.mux.Path("/swarm/join").Methods("POST").HandlerFunc(s.handlerWrapper(s.swarmJoin)) + s.mux.Path("/swarm/leave").Methods("POST").HandlerFunc(s.handlerWrapper(s.swarmLeave)) + s.mux.Path("/nodes/{id:.+}/update").Methods("POST").HandlerFunc(s.handlerWrapper(s.nodeUpdate)) + s.mux.Path("/nodes/{id:.+}").Methods("GET").HandlerFunc(s.handlerWrapper(s.nodeInspect)) + s.mux.Path("/nodes/{id:.+}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.nodeDelete)) + s.mux.Path("/nodes").Methods("GET").HandlerFunc(s.handlerWrapper(s.nodeList)) + s.mux.Path("/services/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.serviceCreate)) + s.mux.Path("/services/{id:.+}").Methods("GET").HandlerFunc(s.handlerWrapper(s.serviceInspect)) + s.mux.Path("/services").Methods("GET").HandlerFunc(s.handlerWrapper(s.serviceList)) + s.mux.Path("/services/{id:.+}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.serviceDelete)) + s.mux.Path("/services/{id:.+}/update").Methods("POST").HandlerFunc(s.handlerWrapper(s.serviceUpdate)) + s.mux.Path("/tasks").Methods("GET").HandlerFunc(s.handlerWrapper(s.taskList)) + s.mux.Path("/tasks/{id:.+}").Methods("GET").HandlerFunc(s.handlerWrapper(s.taskInspect)) } // SetHook changes the hook function used by the server. @@ -308,9 +299,11 @@ func (s *DockerServer) CustomHandler(path string, handler http.Handler) { func (s *DockerServer) MutateContainer(id string, state docker.State) error { s.cMut.Lock() defer s.cMut.Unlock() - if container, ok := s.containers[id]; ok { - container.State = state - return nil + for _, container := range s.containers { + if container.ID == id { + container.State = state + return nil + } } return errors.New("container not found") } @@ -388,36 +381,14 @@ func (s *DockerServer) handlerWrapper(f http.HandlerFunc) http.HandlerFunc { func (s *DockerServer) listContainers(w http.ResponseWriter, r *http.Request) { all := r.URL.Query().Get("all") - filtersRaw := r.FormValue("filters") - filters := make(map[string][]string) - json.Unmarshal([]byte(filtersRaw), &filters) - labelFilters := make(map[string]*string) - for _, f := range filters["label"] { - parts := strings.Split(f, "=") - if len(parts) == 2 { - labelFilters[parts[0]] = &parts[1] - continue - } - labelFilters[parts[0]] = nil - } s.cMut.RLock() result := make([]docker.APIContainers, 0, len(s.containers)) -loop: for _, container := range s.containers { if all == "1" || container.State.Running { var ports []docker.APIPort if container.NetworkSettings != nil { ports = container.NetworkSettings.PortMappingAPI() } - for l, fv := range labelFilters { - lv, ok := container.Config.Labels[l] - if !ok { - continue loop - } - if fv != nil && lv != *fv { - continue loop - } - } result = append(result, docker.APIContainers{ ID: container.ID, Image: container.Image, @@ -439,8 +410,7 @@ loop: func (s *DockerServer) listImages(w http.ResponseWriter, r *http.Request) { s.cMut.RLock() result := make([]docker.APIImages, len(s.images)) - i := 0 - for _, image := range s.images { + for i, image := range s.images { result[i] = docker.APIImages{ ID: image.ID, Created: image.Created.Unix(), @@ -450,7 +420,6 @@ func (s *DockerServer) listImages(w http.ResponseWriter, r *http.Request) { result[i].RepoTags = append(result[i].RepoTags, tag) } } - i++ } s.cMut.RUnlock() w.Header().Set("Content-Type", "application/json") @@ -465,10 +434,19 @@ func (s *DockerServer) findImage(id string) (string, error) { if ok { return image, nil } - if _, ok := s.images[id]; ok { - return id, nil + image, _, err := s.findImageByID(id) + return image, err +} + +func (s *DockerServer) findImageByID(id string) (string, int, error) { + s.iMut.RLock() + defer s.iMut.RUnlock() + for i, image := range s.images { + if image.ID == id { + return image.ID, i, nil + } } - return "", errors.New("no such image") + return "", -1, errors.New("No such image") } func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) { @@ -500,7 +478,7 @@ func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) { }} } - // the container may not have cmd when using a Dockerfile + //the container may not have cmd when using a Dockerfile var path string var args []string if len(config.Cmd) == 1 { @@ -539,14 +517,15 @@ func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) { s.uploadedFiles[container.ID] = val } if container.Name != "" { - _, err = s.findContainerWithLock(container.Name, false) - if err == nil { - defer s.cMut.Unlock() - http.Error(w, "there's already a container with this name", http.StatusConflict) - return + for _, c := range s.containers { + if c.Name == container.Name { + defer s.cMut.Unlock() + http.Error(w, "there's already a container with this name", http.StatusConflict) + return + } } } - s.addContainer(&container) + s.containers = append(s.containers, &container) s.cMut.Unlock() w.WriteHeader(http.StatusCreated) s.notify(&container) @@ -554,13 +533,6 @@ func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(container) } -func (s *DockerServer) addContainer(container *docker.Container) { - s.containers[container.ID] = container - if container.Name != "" { - s.contNameToID[container.Name] = container.ID - } -} - func (s *DockerServer) generateID() string { var buf [16]byte rand.Read(buf[:]) @@ -569,36 +541,36 @@ func (s *DockerServer) generateID() string { func (s *DockerServer) renameContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - s.cMut.Lock() - defer s.cMut.Unlock() - container, err := s.findContainerWithLock(id, false) + container, index, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } - delete(s.contNameToID, container.Name) - container.Name = r.URL.Query().Get("name") - s.contNameToID[container.Name] = container.ID + copy := *container + copy.Name = r.URL.Query().Get("name") + s.cMut.Lock() + defer s.cMut.Unlock() + if s.containers[index].ID == copy.ID { + s.containers[index] = © + } w.WriteHeader(http.StatusNoContent) } func (s *DockerServer) inspectContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - s.cMut.RLock() - defer s.cMut.RUnlock() json.NewEncoder(w).Encode(container) } func (s *DockerServer) statsContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - _, err := s.findContainer(id) + _, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -622,7 +594,7 @@ func (s *DockerServer) statsContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) uploadToContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - _, err := s.findContainer(id) + _, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -642,7 +614,7 @@ func (s *DockerServer) uploadToContainer(w http.ResponseWriter, r *http.Request) func (s *DockerServer) downloadFromContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - _, err := s.findContainer(id) + _, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -662,13 +634,11 @@ func (s *DockerServer) downloadFromContainer(w http.ResponseWriter, r *http.Requ func (s *DockerServer) topContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } - s.cMut.RLock() - defer s.cMut.RUnlock() if !container.State.Running { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Container %s is not running", id) @@ -687,7 +657,7 @@ func (s *DockerServer) topContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) startContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -738,7 +708,7 @@ func (s *DockerServer) startContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) stopContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -756,7 +726,7 @@ func (s *DockerServer) stopContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) pauseContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -773,7 +743,7 @@ func (s *DockerServer) pauseContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) unpauseContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -790,7 +760,7 @@ func (s *DockerServer) unpauseContainer(w http.ResponseWriter, r *http.Request) func (s *DockerServer) attachContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -816,13 +786,11 @@ func (s *DockerServer) attachContainer(w http.ResponseWriter, r *http.Request) { }() } outStream := stdcopy.NewStdWriter(conn, stdcopy.Stdout) - s.cMut.RLock() if container.State.Running { fmt.Fprintf(outStream, "Container is running\n") } else { fmt.Fprintf(outStream, "Container is not running\n") } - s.cMut.RUnlock() fmt.Fprintln(outStream, "What happened?") fmt.Fprintln(outStream, "Something happened") wg.Wait() @@ -842,23 +810,21 @@ func (s *DockerServer) attachContainer(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) waitContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } - var exitCode int for { time.Sleep(1e6) s.cMut.RLock() if !container.State.Running { - exitCode = container.State.ExitCode s.cMut.RUnlock() break } s.cMut.RUnlock() } - result := map[string]int{"StatusCode": exitCode} + result := map[string]int{"StatusCode": container.State.ExitCode} json.NewEncoder(w).Encode(result) } @@ -867,7 +833,7 @@ func (s *DockerServer) removeContainer(w http.ResponseWriter, r *http.Request) { force := r.URL.Query().Get("force") s.cMut.Lock() defer s.cMut.Unlock() - container, err := s.findContainerWithLock(id, false) + container, index, err := s.findContainerWithLock(id, false) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -878,13 +844,13 @@ func (s *DockerServer) removeContainer(w http.ResponseWriter, r *http.Request) { return } w.WriteHeader(http.StatusNoContent) - delete(s.containers, container.ID) - delete(s.contNameToID, container.Name) + s.containers[index] = s.containers[len(s.containers)-1] + s.containers = s.containers[:len(s.containers)-1] } func (s *DockerServer) commitContainer(w http.ResponseWriter, r *http.Request) { id := r.URL.Query().Get("container") - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return @@ -910,7 +876,7 @@ func (s *DockerServer) commitContainer(w http.ResponseWriter, r *http.Request) { repository := r.URL.Query().Get("repo") tag := r.URL.Query().Get("tag") s.iMut.Lock() - s.images[image.ID] = image + s.images = append(s.images, image) if repository != "" { if tag != "" { repository += ":" + tag @@ -926,40 +892,37 @@ func (s *DockerServer) commitContainer(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, `{"ID":%q}`, image.ID) } -func (s *DockerServer) findContainer(idOrName string) (*docker.Container, error) { +func (s *DockerServer) findContainer(idOrName string) (*docker.Container, int, error) { return s.findContainerWithLock(idOrName, true) } -func (s *DockerServer) findContainerWithLock(idOrName string, shouldLock bool) (*docker.Container, error) { +func (s *DockerServer) findContainerWithLock(idOrName string, shouldLock bool) (*docker.Container, int, error) { if shouldLock { s.cMut.RLock() defer s.cMut.RUnlock() } - if contID, ok := s.contNameToID[idOrName]; ok { - idOrName = contID - } - if cont, ok := s.containers[idOrName]; ok { - return cont, nil + for i, container := range s.containers { + if container.ID == idOrName || container.Name == idOrName { + return container, i, nil + } } - return nil, errors.New("no such container") + return nil, -1, errors.New("No such container") } func (s *DockerServer) logContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } w.Header().Set("Content-Type", "application/vnd.docker.raw-stream") w.WriteHeader(http.StatusOK) - s.cMut.RLock() if container.State.Running { fmt.Fprintf(w, "Container is running\n") } else { fmt.Fprintf(w, "Container is not running\n") } - s.cMut.RUnlock() fmt.Fprintln(w, "What happened?") fmt.Fprintln(w, "Something happened") if r.URL.Query().Get("follow") == "1" { @@ -994,7 +957,7 @@ func (s *DockerServer) buildImage(w http.ResponseWriter, r *http.Request) { return } } - // we did not use that Dockerfile to build image cause we are a fake Docker daemon + //we did not use that Dockerfile to build image cause we are a fake Docker daemon image := docker.Image{ ID: s.generateID(), Created: time.Now(), @@ -1006,7 +969,7 @@ func (s *DockerServer) buildImage(w http.ResponseWriter, r *http.Request) { repository = t } s.iMut.Lock() - s.images[image.ID] = image + s.images = append(s.images, image) s.imgIDs[repository] = image.ID s.iMut.Unlock() w.Write([]byte(fmt.Sprintf("Successfully built %s", image.ID))) @@ -1015,6 +978,12 @@ func (s *DockerServer) buildImage(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) pullImage(w http.ResponseWriter, r *http.Request) { fromImageName := r.URL.Query().Get("fromImage") tag := r.URL.Query().Get("tag") + image := docker.Image{ + ID: s.generateID(), + Config: &docker.Config{}, + } + s.iMut.Lock() + s.images = append(s.images, image) if fromImageName != "" { if tag != "" { separator := ":" @@ -1023,17 +992,7 @@ func (s *DockerServer) pullImage(w http.ResponseWriter, r *http.Request) { } fromImageName = fmt.Sprintf("%s%s%s", fromImageName, separator, tag) } - } - image := docker.Image{ - ID: s.generateID(), - Config: &docker.Config{}, - } - s.iMut.Lock() - if _, exists := s.imgIDs[fromImageName]; fromImageName == "" || !exists { - s.images[image.ID] = image - if fromImageName != "" { - s.imgIDs[fromImageName] = image.ID - } + s.imgIDs[fromImageName] = image.ID } s.iMut.Unlock() } @@ -1057,11 +1016,13 @@ func (s *DockerServer) pushImage(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) tagImage(w http.ResponseWriter, r *http.Request) { name := mux.Vars(r)["name"] - id, err := s.findImage(name) - if err != nil { + s.iMut.RLock() + if _, ok := s.imgIDs[name]; !ok { + s.iMut.RUnlock() http.Error(w, "No such image", http.StatusNotFound) return } + s.iMut.RUnlock() s.iMut.Lock() defer s.iMut.Unlock() newRepo := r.URL.Query().Get("repo") @@ -1069,14 +1030,13 @@ func (s *DockerServer) tagImage(w http.ResponseWriter, r *http.Request) { if newTag != "" { newRepo += ":" + newTag } - s.imgIDs[newRepo] = id + s.imgIDs[newRepo] = s.imgIDs[name] w.WriteHeader(http.StatusCreated) } func (s *DockerServer) removeImage(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - s.iMut.Lock() - defer s.iMut.Unlock() + s.iMut.RLock() var tag string if img, ok := s.imgIDs[id]; ok { id, tag = img, id @@ -1087,28 +1047,21 @@ func (s *DockerServer) removeImage(w http.ResponseWriter, r *http.Request) { tags = append(tags, tag) } } - _, ok := s.images[id] - if !ok { - http.Error(w, "No such image", http.StatusNotFound) - return - } - if tag == "" && len(tags) > 1 { - http.Error(w, "image is referenced in multiple repositories", http.StatusConflict) + s.iMut.RUnlock() + _, index, err := s.findImageByID(id) + if err != nil { + http.Error(w, err.Error(), http.StatusNotFound) return } w.WriteHeader(http.StatusNoContent) - if tag == "" { - // delete called with image ID - for _, t := range tags { - delete(s.imgIDs, t) - } - delete(s.images, id) - } else { - // delete called with image repository name + s.iMut.Lock() + defer s.iMut.Unlock() + if len(tags) < 2 { + s.images[index] = s.images[len(s.images)-1] + s.images = s.images[:len(s.images)-1] + } + if tag != "" { delete(s.imgIDs, tag) - if len(tags) == 1 { - delete(s.images, id) - } } } @@ -1117,16 +1070,16 @@ func (s *DockerServer) inspectImage(w http.ResponseWriter, r *http.Request) { s.iMut.RLock() defer s.iMut.RUnlock() if id, ok := s.imgIDs[name]; ok { - name = id - } - img, ok := s.images[name] - if !ok { - http.Error(w, "not found", http.StatusNotFound) - return + for _, img := range s.images { + if img.ID == id { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + json.NewEncoder(w).Encode(img) + return + } + } } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(img) + http.Error(w, "not found", http.StatusNotFound) } func (s *DockerServer) listEvents(w http.ResponseWriter, r *http.Request) { @@ -1183,16 +1136,14 @@ func (s *DockerServer) getImage(w http.ResponseWriter, r *http.Request) { func (s *DockerServer) createExecContainer(w http.ResponseWriter, r *http.Request) { id := mux.Vars(r)["id"] - container, err := s.findContainer(id) + container, _, err := s.findContainer(id) if err != nil { http.Error(w, err.Error(), http.StatusNotFound) return } execID := s.generateID() - s.cMut.Lock() container.ExecIDs = append(container.ExecIDs, execID) - s.cMut.Unlock() exec := docker.ExecInspect{ ID: execID, @@ -1288,7 +1239,7 @@ func (s *DockerServer) findNetwork(idOrName string) (*docker.Network, int, error return network, i, nil } } - return nil, -1, errors.New("no such network") + return nil, -1, errors.New("No such network") } func (s *DockerServer) listNetworks(w http.ResponseWriter, r *http.Request) { @@ -1342,16 +1293,15 @@ func (s *DockerServer) createNetwork(w http.ResponseWriter, r *http.Request) { generatedID := s.generateID() network := docker.Network{ - Name: config.Name, - ID: generatedID, - Driver: config.Driver, - Containers: map[string]docker.Endpoint{}, + Name: config.Name, + ID: generatedID, + Driver: config.Driver, } s.netMut.Lock() s.networks = append(s.networks, &network) s.netMut.Unlock() w.WriteHeader(http.StatusCreated) - c := struct{ ID string }{ID: network.ID} + var c = struct{ ID string }{ID: network.ID} json.NewEncoder(w).Encode(c) } @@ -1369,35 +1319,6 @@ func (s *DockerServer) removeNetwork(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) } -func (s *DockerServer) networksConnect(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - var config *docker.NetworkConnectionOptions - defer r.Body.Close() - err := json.NewDecoder(r.Body).Decode(&config) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - network, index, _ := s.findNetwork(id) - container, _ := s.findContainer(config.Container) - if network == nil || container == nil { - http.Error(w, "network or container not found", http.StatusNotFound) - return - } - - if _, found := network.Containers[container.ID]; found { - http.Error(w, "endpoint already exists in network", http.StatusBadRequest) - return - } - - s.netMut.Lock() - s.networks[index].Containers[config.Container] = docker.Endpoint{} - s.netMut.Unlock() - - w.WriteHeader(http.StatusOK) -} - func (s *DockerServer) listVolumes(w http.ResponseWriter, r *http.Request) { s.volMut.RLock() result := make([]docker.Volume, 0, len(s.volStore)) diff --git a/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go b/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go index 9f85e349dc20..928510ad563a 100644 --- a/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/testing/server_test.go @@ -15,17 +15,15 @@ import ( "net" "net/http" "net/http/httptest" - "net/url" "os" "reflect" - "sort" "strings" "sync" "testing" "time" "github.com/docker/docker/api/types/swarm" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func TestNewServer(t *testing.T) { @@ -89,7 +87,7 @@ func TestServerStop(t *testing.T) { func TestServerStopNoListener(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.Stop() } @@ -108,7 +106,7 @@ func TestServerURL(t *testing.T) { func TestServerURLNoListener(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} url := server.URL() if url != "" { t.Errorf("DockerServer.URL(): Expected empty URL on handler mode, got %q.", url) @@ -121,7 +119,7 @@ func TestHandleWithHook(t *testing.T) { server, _ := NewServer("127.0.0.1:0", nil, func(*http.Request) { called = true }) defer server.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if !called { t.Error("ServeHTTP did not call the hook function.") @@ -135,7 +133,7 @@ func TestSetHook(t *testing.T) { defer server.Stop() server.SetHook(func(*http.Request) { called = true }) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if !called { t.Error("ServeHTTP did not call the hook function.") @@ -153,7 +151,7 @@ func TestCustomHandler(t *testing.T) { fmt.Fprint(w, "Hello world") })) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if !called { t.Error("Did not call the custom handler") @@ -174,7 +172,7 @@ func TestCustomHandlerRegexp(t *testing.T) { fmt.Fprint(w, "Hello world") })) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/.*/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/.*/json?all=1", nil) server.ServeHTTP(recorder, request) if !called { t.Error("Did not call the custom handler") @@ -186,17 +184,17 @@ func TestCustomHandlerRegexp(t *testing.T) { func TestListContainers(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("ListContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) } expected := make([]docker.APIContainers, 2) - for i, container := range containers { + for i, container := range server.containers { expected[i] = docker.APIContainers{ ID: container.ID, Image: container.Image, @@ -208,17 +206,11 @@ func TestListContainers(t *testing.T) { State: container.State.StateString(), } } - sort.Slice(expected, func(i, j int) bool { - return expected[i].ID < expected[j].ID - }) var got []docker.APIContainers err := json.NewDecoder(recorder.Body).Decode(&got) if err != nil { t.Fatal(err) } - sort.Slice(got, func(i, j int) bool { - return got[i].ID < got[j].ID - }) if !reflect.DeepEqual(got, expected) { t.Errorf("ListContainers. Want %#v. Got %#v.", expected, got) } @@ -226,11 +218,11 @@ func TestListContainers(t *testing.T) { func TestListRunningContainers(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=0", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=0", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("ListRunningContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -245,64 +237,16 @@ func TestListRunningContainers(t *testing.T) { } } -func TestListContainersFilterLabels(t *testing.T) { - t.Parallel() - server := baseDockerServer() - addContainers(&server, 3) - server.buildMuxer() - recorder := httptest.NewRecorder() - filters := url.QueryEscape(`{"label": ["key=val-1"]}`) - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1&filters="+filters, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("TestListContainersFilterLabels: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got []docker.APIContainers - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if len(got) != 1 { - t.Errorf("TestListContainersFilterLabels: Want 1. Got %d.", len(got)) - } - filters = url.QueryEscape(`{"label": ["key="]}`) - request, _ = http.NewRequest(http.MethodGet, "/containers/json?all=1&filters="+filters, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("TestListContainersFilterLabels: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - err = json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if len(got) != 0 { - t.Errorf("TestListContainersFilterLabels: Want 0. Got %d.", len(got)) - } - filters = url.QueryEscape(`{"label": ["key"]}`) - request, _ = http.NewRequest(http.MethodGet, "/containers/json?all=1&filters="+filters, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("TestListContainersFilterLabels: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - err = json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if len(got) != 3 { - t.Errorf("TestListContainersFilterLabels: Want 3. Got %d.", len(got)) - } -} - func TestCreateContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.imgIDs = map[string]string{"base": "a1234"} server.uploadedFiles = map[string]string{"a1234": "/abcd"} server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -312,7 +256,7 @@ func TestCreateContainer(t *testing.T) { if err != nil { t.Fatal(err) } - stored := getContainer(&server) + stored := server.containers[0] if returned.ID != stored.ID { t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) } @@ -339,39 +283,32 @@ func TestCreateContainer(t *testing.T) { } } -func getContainer(server *DockerServer) *docker.Container { - var cont *docker.Container - for _, cont = range server.containers { - } - return cont -} - func TestCreateContainerWithNotifyChannel(t *testing.T) { t.Parallel() ch := make(chan *docker.Container, 1) - server := baseDockerServer() + server := DockerServer{} server.imgIDs = map[string]string{"base": "a1234"} server.cChan = ch server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) } - if notified := <-ch; notified != getContainer(&server) { - t.Errorf("CreateContainer: did not notify the proper container. Want %q. Got %q.", getContainer(&server).ID, notified.ID) + if notified := <-ch; notified != server.containers[0] { + t.Errorf("CreateContainer: did not notify the proper container. Want %q. Got %q.", server.containers[0].ID, notified.ID) } } func TestCreateContainerInvalidBody(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader("whaaaaaat---")) + request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader("whaaaaaat---")) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -380,16 +317,15 @@ func TestCreateContainerInvalidBody(t *testing.T) { func TestCreateContainerDuplicateName(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() server.imgIDs = map[string]string{"base": "a1234"} - containers := addContainers(&server, 1) - containers[0].Name = "mycontainer" - server.contNameToID[containers[0].Name] = containers[0].ID + addContainers(&server, 1) + server.containers[0].Name = "mycontainer" recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create?name=mycontainer", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create?name=mycontainer", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusConflict { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) @@ -398,15 +334,15 @@ func TestCreateContainerDuplicateName(t *testing.T) { func TestCreateMultipleContainersEmptyName(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() server.imgIDs = map[string]string{"base": "a1234"} addContainers(&server, 1) - getContainer(&server).Name = "" + server.containers[0].Name = "" recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -416,10 +352,7 @@ func TestCreateMultipleContainersEmptyName(t *testing.T) { if err != nil { t.Fatal(err) } - stored, err := server.findContainer(returned.ID) - if err != nil { - t.Fatal(err) - } + stored := server.containers[1] if returned.ID != stored.ID { t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) } @@ -437,13 +370,13 @@ func TestCreateMultipleContainersEmptyName(t *testing.T) { func TestCreateContainerInvalidName(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create?name=myapp/container1", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create?name=myapp/container1", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusInternalServerError { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) @@ -456,13 +389,13 @@ func TestCreateContainerInvalidName(t *testing.T) { func TestCreateContainerImageNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -471,18 +404,18 @@ func TestCreateContainerImageNotFound(t *testing.T) { func TestRenameContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - newName := containers[0].Name + "abc" - path := fmt.Sprintf("/containers/%s/rename?name=%s", containers[0].ID, newName) - request, _ := http.NewRequest(http.MethodPost, path, nil) + newName := server.containers[0].Name + "abc" + path := fmt.Sprintf("/containers/%s/rename?name=%s", server.containers[0].ID, newName) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - container := containers[0] + container := server.containers[0] if container.Name != newName { t.Errorf("RenameContainer: did not rename the container. Want %q. Got %q.", newName, container.Name) } @@ -490,10 +423,10 @@ func TestRenameContainer(t *testing.T) { func TestRenameContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/containers/blabla/rename?name=something", nil) + request, _ := http.NewRequest("POST", "/containers/blabla/rename?name=something", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -502,28 +435,24 @@ func TestRenameContainerNotFound(t *testing.T) { func TestCommitContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) - server.uploadedFiles = map[string]string{containers[0].ID: "/abcd"} + server := DockerServer{} + addContainers(&server, 2) + server.uploadedFiles = map[string]string{server.containers[0].ID: "/abcd"} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/commit?container="+containers[0].ID, nil) + request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("CommitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if len(server.images) != 1 { - t.Errorf("CommitContainer: wrong images len in server. Want 1. Got %q.", len(server.images)) - } - imgID := fmt.Sprintf("img-%s", containers[0].ID) - expected := fmt.Sprintf(`{"ID":"%s"}`, imgID) + expected := fmt.Sprintf(`{"ID":"%s"}`, server.images[0].ID) if got := recorder.Body.String(); got != expected { t.Errorf("CommitContainer: wrong response body. Want %q. Got %q.", expected, got) } - if server.images[imgID].Config == nil { + if server.images[0].Config == nil { t.Error("CommitContainer: image Config should not be nil.") } - if val, ok := server.uploadedFiles[server.images[imgID].ID]; !ok { + if val, ok := server.uploadedFiles[server.images[0].ID]; !ok { t.Error("CommitContainer: uploadedFiles should exist.") } else if val != "/abcd" { t.Errorf("CommitContainer: wrong uploadedFile. Want '/abcd', got %s.", val) @@ -532,25 +461,21 @@ func TestCommitContainer(t *testing.T) { func TestCommitContainerComplete(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + server.imgIDs = make(map[string]string) + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - qs := make(url.Values) - qs.Add("container", containers[0].ID) - qs.Add("repo", "tsuru/python") - qs.Add("m", "saving") - qs.Add("author", "developers") - qs.Add("run", `{"Cmd": ["cat", "/world"],"PortSpecs":["22"]}`) - request, _ := http.NewRequest(http.MethodPost, "/commit?"+qs.Encode(), nil) + queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&m=saving&author=developers" + queryString += `&run={"Cmd": ["cat", "/world"],"PortSpecs":["22"]}` + request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) server.ServeHTTP(recorder, request) - imgID := fmt.Sprintf("img-%s", containers[0].ID) - image := server.images[imgID] - if image.Parent != containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", containers[0].Image, image.Parent) + image := server.images[0] + if image.Parent != server.containers[0].Image { + t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) } - if image.Container != containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", containers[0].ID, image.Container) + if image.Container != server.containers[0].ID { + t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) } message := "saving" if image.Comment != message { @@ -575,20 +500,20 @@ func TestCommitContainerComplete(t *testing.T) { func TestCommitContainerWithTag(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + server.imgIDs = make(map[string]string) + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - queryString := "container=" + containers[0].ID + "&repo=tsuru/python&tag=v1" - request, _ := http.NewRequest(http.MethodPost, "/commit?"+queryString, nil) + queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&tag=v1" + request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) server.ServeHTTP(recorder, request) - imgID := fmt.Sprintf("img-%s", containers[0].ID) - image := server.images[imgID] - if image.Parent != containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", containers[0].Image, image.Parent) + image := server.images[0] + if image.Parent != server.containers[0].Image { + t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) } - if image.Container != containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", containers[0].ID, image.Container) + if image.Container != server.containers[0].ID { + t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) } if id := server.imgIDs["tsuru/python:v1"]; id != image.ID { t.Errorf("CommitContainer: wrong ID saved for repository. Want %q. Got %q.", image.ID, id) @@ -597,11 +522,11 @@ func TestCommitContainerWithTag(t *testing.T) { func TestCommitContainerInvalidRun(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/commit?container="+getContainer(&server).ID+"&run=abc---", nil) + request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID+"&run=abc---", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -610,10 +535,10 @@ func TestCommitContainerInvalidRun(t *testing.T) { func TestCommitContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/commit?container=abc123", nil) + request, _ := http.NewRequest("POST", "/commit?container=abc123", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -622,17 +547,17 @@ func TestCommitContainerNotFound(t *testing.T) { func TestInspectContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/json", containers[0].ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/json", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("InspectContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) } - expected := containers[0] + expected := server.containers[0] var got docker.Container err := json.NewDecoder(recorder.Body).Decode(&got) if err != nil { @@ -656,10 +581,10 @@ func TestInspectContainer(t *testing.T) { func TestInspectContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/abc123/json", nil) + request, _ := http.NewRequest("GET", "/containers/abc123/json", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("InspectContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -668,13 +593,13 @@ func TestInspectContainerNotFound(t *testing.T) { func TestTopContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -697,10 +622,10 @@ func TestTopContainer(t *testing.T) { func TestTopContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/xyz/top", nil) + request, _ := http.NewRequest("GET", "/containers/xyz/top", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -709,12 +634,12 @@ func TestTopContainerNotFound(t *testing.T) { func TestTopContainerStopped(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusInternalServerError { t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) @@ -723,7 +648,7 @@ func TestTopContainerStopped(t *testing.T) { func TestStartContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() memory := int64(536870912) @@ -733,49 +658,49 @@ func TestStartContainer(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, bytes.NewBuffer(configBytes)) + path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, bytes.NewBuffer(configBytes)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if !getContainer(&server).State.Running { + if !server.containers[0].State.Running { t.Error("StartContainer: did not set the container to running state") } - if getContainer(&server).State.StartedAt.IsZero() { + if server.containers[0].State.StartedAt.IsZero() { t.Error("StartContainer: did not set the startedAt container state") } - if gotMemory := getContainer(&server).HostConfig.Memory; gotMemory != memory { + if gotMemory := server.containers[0].HostConfig.Memory; gotMemory != memory { t.Errorf("StartContainer: wrong HostConfig. Wants %d of memory. Got %d", memory, gotMemory) } } func TestStartContainerNoHostConfig(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() memory := int64(536870912) hostConfig := docker.HostConfig{Memory: memory} - getContainer(&server).HostConfig = &hostConfig + server.containers[0].HostConfig = &hostConfig recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader("")) + path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, strings.NewReader("")) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if !getContainer(&server).State.Running { + if !server.containers[0].State.Running { t.Error("StartContainer: did not set the container to running state") } - if gotMemory := getContainer(&server).HostConfig.Memory; gotMemory != memory { + if gotMemory := server.containers[0].HostConfig.Memory; gotMemory != memory { t.Errorf("StartContainer: wrong HostConfig. Wants %d of memory. Got %d", memory, gotMemory) } } func TestStartContainerChangeNetwork(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() hostConfig := docker.HostConfig{ @@ -788,16 +713,16 @@ func TestStartContainerChangeNetwork(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, bytes.NewBuffer(configBytes)) + path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, bytes.NewBuffer(configBytes)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if !getContainer(&server).State.Running { + if !server.containers[0].State.Running { t.Error("StartContainer: did not set the container to running state") } - portMapping := getContainer(&server).NetworkSettings.Ports["8888/tcp"] + portMapping := server.containers[0].NetworkSettings.Ports["8888/tcp"] expected := []docker.PortBinding{{HostIP: "0.0.0.0", HostPort: "12345"}} if !reflect.DeepEqual(portMapping, expected) { t.Errorf("StartContainer: network not updated. Wants %#v ports. Got %#v", expected, portMapping) @@ -807,29 +732,30 @@ func TestStartContainerChangeNetwork(t *testing.T) { func TestStartContainerWithNotifyChannel(t *testing.T) { t.Parallel() ch := make(chan *docker.Container, 1) - server := baseDockerServer() + server := DockerServer{} server.cChan = ch - containers := addContainers(&server, 2) + addContainers(&server, 1) + addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", containers[1].ID) - request, _ := http.NewRequest(http.MethodPost, path, bytes.NewBuffer([]byte("{}"))) + path := fmt.Sprintf("/containers/%s/start", server.containers[1].ID) + request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("{}"))) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if notified := <-ch; notified != containers[1] { - t.Errorf("StartContainer: did not notify the proper container. Want %q. Got %q.", containers[1].ID, notified.ID) + if notified := <-ch; notified != server.containers[1] { + t.Errorf("StartContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) } } func TestStartContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/start" - request, _ := http.NewRequest(http.MethodPost, path, bytes.NewBuffer([]byte("null"))) + request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -838,13 +764,13 @@ func TestStartContainerNotFound(t *testing.T) { func TestStartContainerAlreadyRunning(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, bytes.NewBuffer([]byte("null"))) + path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotModified { t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusNotModified, recorder.Code) @@ -853,36 +779,36 @@ func TestStartContainerAlreadyRunning(t *testing.T) { func TestStopContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - if getContainer(&server).State.Running { + if server.containers[0].State.Running { t.Error("StopContainer: did not stop the container") } } func TestKillContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/kill", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/kill", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("KillContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - if getContainer(&server).State.Running { + if server.containers[0].State.Running { t.Error("KillContainer: did not stop the container") } } @@ -890,30 +816,31 @@ func TestKillContainer(t *testing.T) { func TestStopContainerWithNotifyChannel(t *testing.T) { t.Parallel() ch := make(chan *docker.Container, 1) - server := baseDockerServer() + server := DockerServer{} server.cChan = ch - containers := addContainers(&server, 2) - containers[1].State.Running = true + addContainers(&server, 1) + addContainers(&server, 1) + server.containers[1].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", containers[1].ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/stop", server.containers[1].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - if notified := <-ch; notified != containers[1] { - t.Errorf("StopContainer: did not notify the proper container. Want %q. Got %q.", containers[1].ID, notified.ID) + if notified := <-ch; notified != server.containers[1] { + t.Errorf("StopContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) } } func TestStopContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/stop" - request, _ := http.NewRequest(http.MethodPost, path, nil) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -922,12 +849,12 @@ func TestStopContainerNotFound(t *testing.T) { func TestStopContainerNotRunning(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -936,30 +863,30 @@ func TestStopContainerNotRunning(t *testing.T) { func TestPauseContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - if !getContainer(&server).State.Paused { + if !server.containers[0].State.Paused { t.Error("PauseContainer: did not pause the container") } } func TestPauseContainerAlreadyPaused(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Paused = true + server.containers[0].State.Paused = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -968,11 +895,11 @@ func TestPauseContainerAlreadyPaused(t *testing.T) { func TestPauseContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/pause" - request, _ := http.NewRequest(http.MethodPost, path, nil) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -981,30 +908,30 @@ func TestPauseContainerNotFound(t *testing.T) { func TestUnpauseContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Paused = true + server.containers[0].State.Paused = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) } - if getContainer(&server).State.Paused { + if server.containers[0].State.Paused { t.Error("UnpauseContainer: did not unpause the container") } } func TestUnpauseContainerNotPaused(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -1013,11 +940,11 @@ func TestUnpauseContainerNotPaused(t *testing.T) { func TestUnpauseContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/unpause" - request, _ := http.NewRequest(http.MethodPost, path, nil) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1026,16 +953,16 @@ func TestUnpauseContainerNotFound(t *testing.T) { func TestWaitContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) go func() { server.cMut.Lock() - getContainer(&server).State.Running = false + server.containers[0].State.Running = false server.cMut.Unlock() }() server.ServeHTTP(recorder, request) @@ -1050,13 +977,13 @@ func TestWaitContainer(t *testing.T) { func TestWaitContainerStatus(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() - getContainer(&server).State.ExitCode = 63 + server.containers[0].State.ExitCode = 63 recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("WaitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1069,11 +996,11 @@ func TestWaitContainerStatus(t *testing.T) { func TestWaitContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/wait" - request, _ := http.NewRequest(http.MethodPost, path, nil) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("WaitContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1101,13 +1028,13 @@ func (r *HijackableResponseRecorder) HijackBuffer() string { func TestLogContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/logs", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/logs", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("LogContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1116,11 +1043,11 @@ func TestLogContainer(t *testing.T) { func TestLogContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() path := "/containers/abc123/logs" - request, _ := http.NewRequest(http.MethodGet, path, nil) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("LogContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1129,13 +1056,13 @@ func TestLogContainerNotFound(t *testing.T) { func TestAttachContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := &HijackableResponseRecorder{} - path := fmt.Sprintf("/containers/%s/attach?logs=1", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/attach?logs=1", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) lines := []string{ "\x01\x00\x00\x00\x00\x00\x00\x15Container is running", @@ -1150,11 +1077,11 @@ func TestAttachContainer(t *testing.T) { func TestAttachContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := &HijackableResponseRecorder{} path := "/containers/abc123/attach?logs=1" - request, _ := http.NewRequest(http.MethodPost, path, nil) + request, _ := http.NewRequest("POST", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("AttachContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1163,12 +1090,12 @@ func TestAttachContainerNotFound(t *testing.T) { func TestAttachContainerWithStreamBlocks(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() - path := fmt.Sprintf("/containers/%s/attach?logs=1&stdout=1&stream=1", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/attach?logs=1&stdout=1&stream=1", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) done := make(chan string) go func() { recorder := &HijackableResponseRecorder{} @@ -1181,7 +1108,7 @@ func TestAttachContainerWithStreamBlocks(t *testing.T) { case <-time.After(500 * time.Millisecond): } server.cMut.Lock() - getContainer(&server).State.Running = false + server.containers[0].State.Running = false server.cMut.Unlock() var body string select { @@ -1202,13 +1129,13 @@ func TestAttachContainerWithStreamBlocks(t *testing.T) { func TestAttachContainerWithStreamBlocksOnCreatedContainers(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = false - getContainer(&server).State.StartedAt = time.Time{} + server.containers[0].State.Running = false + server.containers[0].State.StartedAt = time.Time{} server.buildMuxer() - path := fmt.Sprintf("/containers/%s/attach?logs=1&stdout=1&stream=1", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, nil) + path := fmt.Sprintf("/containers/%s/attach?logs=1&stdout=1&stream=1", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, nil) done := make(chan string) go func() { recorder := &HijackableResponseRecorder{} @@ -1221,7 +1148,7 @@ func TestAttachContainerWithStreamBlocksOnCreatedContainers(t *testing.T) { case <-time.After(500 * time.Millisecond): } server.cMut.Lock() - getContainer(&server).State.StartedAt = time.Now() + server.containers[0].State.StartedAt = time.Now() server.cMut.Unlock() var body string select { @@ -1242,12 +1169,12 @@ func TestAttachContainerWithStreamBlocksOnCreatedContainers(t *testing.T) { func TestRemoveContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodDelete, path, nil) + path := fmt.Sprintf("/containers/%s", server.containers[0].ID) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -1259,12 +1186,12 @@ func TestRemoveContainer(t *testing.T) { func TestRemoveContainerByName(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", getContainer(&server).Name) - request, _ := http.NewRequest(http.MethodDelete, path, nil) + path := fmt.Sprintf("/containers/%s", server.containers[0].Name) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -1276,10 +1203,11 @@ func TestRemoveContainerByName(t *testing.T) { func TestRemoveContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/containers/abc123", nil) + path := fmt.Sprintf("/containers/abc123") + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1288,13 +1216,13 @@ func TestRemoveContainerNotFound(t *testing.T) { func TestRemoveContainerRunning(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodDelete, path, nil) + path := fmt.Sprintf("/containers/%s", server.containers[0].ID) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusInternalServerError { t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) @@ -1306,13 +1234,13 @@ func TestRemoveContainerRunning(t *testing.T) { func TestRemoveContainerRunningForce(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) - getContainer(&server).State.Running = true + server.containers[0].State.Running = true server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s?%s", getContainer(&server).ID, "force=1") - request, _ := http.NewRequest(http.MethodDelete, path, nil) + path := fmt.Sprintf("/containers/%s?%s", server.containers[0].ID, "force=1") + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -1324,10 +1252,10 @@ func TestRemoveContainerRunningForce(t *testing.T) { func TestPullImage(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{imgIDs: make(map[string]string)} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/create?fromImage=base", nil) + request, _ := http.NewRequest("POST", "/images/create?fromImage=base", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1338,20 +1266,17 @@ func TestPullImage(t *testing.T) { if _, ok := server.imgIDs["base"]; !ok { t.Error("PullImage: Repository should not be empty.") } - var image docker.Image - for _, image = range server.images { - } - if image.Config == nil { + if server.images[0].Config == nil { t.Error("PullImage: Image Config should not be nil.") } } func TestPullImageWithTag(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{imgIDs: make(map[string]string)} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/create?fromImage=base&tag=tag", nil) + request, _ := http.NewRequest("POST", "/images/create?fromImage=base&tag=tag", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1366,10 +1291,10 @@ func TestPullImageWithTag(t *testing.T) { func TestPullImageWithShaTag(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{imgIDs: make(map[string]string)} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/create?fromImage=base&tag=sha256:deadc0de", nil) + request, _ := http.NewRequest("POST", "/images/create?fromImage=base&tag=sha256:deadc0de", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1382,48 +1307,12 @@ func TestPullImageWithShaTag(t *testing.T) { } } -func TestPullImageExisting(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/create?fromImage=base", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } - oldID := server.imgIDs["base"] - recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodPost, "/images/create?fromImage=base", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } - newID := server.imgIDs["base"] - if oldID != newID { - t.Error("PullImage: Image ID should be the same after second pull.") - } -} - func TestPushImage(t *testing.T) { t.Parallel() - server := baseDockerServer() - server.imgIDs = map[string]string{"tsuru/python": "a123"} + server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/push", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1432,11 +1321,10 @@ func TestPushImage(t *testing.T) { func TestPushImageWithTag(t *testing.T) { t.Parallel() - server := baseDockerServer() - server.imgIDs = map[string]string{"tsuru/python:v1": "a123"} + server := DockerServer{imgIDs: map[string]string{"tsuru/python:v1": "a123"}} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/push?tag=v1", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/push?tag=v1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1445,10 +1333,10 @@ func TestPushImageWithTag(t *testing.T) { func TestPushImageNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/push", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1457,11 +1345,10 @@ func TestPushImageNotFound(t *testing.T) { func TestTagImage(t *testing.T) { t.Parallel() - server := baseDockerServer() - server.imgIDs = map[string]string{"tsuru/python": "a123"} + server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/tag?repo=tsuru/new-python", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -1473,11 +1360,10 @@ func TestTagImage(t *testing.T) { func TestTagImageWithRepoAndTag(t *testing.T) { t.Parallel() - server := baseDockerServer() - server.imgIDs = map[string]string{"tsuru/python": "a123"} + server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/tag?repo=tsuru/new-python&tag=v1", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python&tag=v1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -1487,101 +1373,21 @@ func TestTagImageWithRepoAndTag(t *testing.T) { } } -func TestTagImageWithID(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.images = map[string]docker.Image{"myimgid": {ID: "myimgid"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/myimgid/tag?repo=tsuru/new-python", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if server.imgIDs["tsuru/new-python"] != "myimgid" { - t.Errorf("TagImage: did not tag the image") - } -} - func TestTagImageNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/images/tsuru/python/tag", nil) + request, _ := http.NewRequest("POST", "/images/tsuru/python/tag", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) } } -func TestInspectImage(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.imgIDs = map[string]string{"tsuru/python": "a123"} - server.images = map[string]docker.Image{"a123": {ID: "a123", Author: "me"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/images/tsuru/python/json", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("InspectImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var img docker.Image - err := json.NewDecoder(recorder.Body).Decode(&img) - if err != nil { - t.Fatal(err) - } - expected := docker.Image{ - ID: "a123", - Author: "me", - } - if !reflect.DeepEqual(img, expected) { - t.Errorf("InspectImage: wrong image returned, expected %#v, got: %#v", expected, img) - } -} - -func TestInspectImageWithID(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.images = map[string]docker.Image{"myimgid": {ID: "myimgid", Author: "me"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/images/myimgid/json", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("InspectImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var img docker.Image - err := json.NewDecoder(recorder.Body).Decode(&img) - if err != nil { - t.Fatal(err) - } - expected := docker.Image{ - ID: "myimgid", - Author: "me", - } - if !reflect.DeepEqual(img, expected) { - t.Errorf("InspectImage: wrong image returned, expected %#v, got: %#v", expected, img) - } -} - -func TestInspectImageNotFound(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/images/tsuru/python/json", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("InspectImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func addContainers(server *DockerServer, n int) []*docker.Container { +func addContainers(server *DockerServer, n int) { server.cMut.Lock() defer server.cMut.Unlock() - var addedContainers []*docker.Container for i := 0; i < n; i++ { date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) container := docker.Container{ @@ -1597,7 +1403,6 @@ func addContainers(server *DockerServer, n int) []*docker.Container { Env: []string{"ME=you", fmt.Sprintf("NUMBER=%d", i)}, Cmd: []string{"ls", "-la", ".."}, Image: "base", - Labels: map[string]string{"key": fmt.Sprintf("val-%d", i)}, }, State: docker.State{ Running: false, @@ -1622,70 +1427,54 @@ func addContainers(server *DockerServer, n int) []*docker.Container { }, ResolvConfPath: "/etc/resolv.conf", } - server.addContainer(&container) - addedContainers = append(addedContainers, &container) + server.containers = append(server.containers, &container) } - return addedContainers } -func addImages(server *DockerServer, n int, repo bool) []docker.Image { +func addImages(server *DockerServer, n int, repo bool) { server.iMut.Lock() defer server.iMut.Unlock() if server.imgIDs == nil { server.imgIDs = make(map[string]string) } - if server.images == nil { - server.images = make(map[string]docker.Image) - } - var addedImages []docker.Image for i := 0; i < n; i++ { date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) image := docker.Image{ ID: fmt.Sprintf("%x", rand.Int()%10000), Created: date, } - addedImages = append(addedImages, image) - server.images[image.ID] = image + server.images = append(server.images, image) if repo { repo := "docker/python-" + image.ID server.imgIDs[repo] = image.ID } } - return addedImages } func TestListImages(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addImages(&server, 2, true) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/images/json?all=1", nil) + request, _ := http.NewRequest("GET", "/images/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("ListImages: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) } expected := make([]docker.APIImages, 2) - i := 0 - for _, image := range server.images { + for i, image := range server.images { expected[i] = docker.APIImages{ ID: image.ID, Created: image.Created.Unix(), RepoTags: []string{"docker/python-" + image.ID}, } - i++ } - sort.Slice(expected, func(i, j int) bool { - return expected[i].ID < expected[j].ID - }) var got []docker.APIImages err := json.NewDecoder(recorder.Body).Decode(&got) if err != nil { t.Fatal(err) } - sort.Slice(got, func(i, j int) bool { - return got[i].ID < got[j].ID - }) if !reflect.DeepEqual(got, expected) { t.Errorf("ListImages. Want %#v. Got %#v.", expected, got) } @@ -1693,12 +1482,12 @@ func TestListImages(t *testing.T) { func TestRemoveImage(t *testing.T) { t.Parallel() - server := baseDockerServer() - images := addImages(&server, 1, false) + server := DockerServer{} + addImages(&server, 1, false) server.buildMuxer() recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", images[0].ID) - request, _ := http.NewRequest(http.MethodDelete, path, nil) + path := fmt.Sprintf("/images/%s", server.images[0].ID) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -1710,13 +1499,13 @@ func TestRemoveImage(t *testing.T) { func TestRemoveImageByName(t *testing.T) { t.Parallel() - server := baseDockerServer() - images := addImages(&server, 1, true) + server := DockerServer{} + addImages(&server, 1, true) server.buildMuxer() recorder := httptest.NewRecorder() - imgName := "docker/python-" + images[0].ID + imgName := "docker/python-" + server.images[0].ID path := "/images/" + imgName - request, _ := http.NewRequest(http.MethodDelete, path, nil) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -1732,15 +1521,15 @@ func TestRemoveImageByName(t *testing.T) { func TestRemoveImageWithMultipleTags(t *testing.T) { t.Parallel() - server := baseDockerServer() - images := addImages(&server, 1, true) + server := DockerServer{} + addImages(&server, 1, true) server.buildMuxer() - imgID := images[0].ID + imgID := server.images[0].ID imgName := "docker/python-" + imgID server.imgIDs["docker/python-wat"] = imgID recorder := httptest.NewRecorder() path := fmt.Sprintf("/images/%s", imgName) - request, _ := http.NewRequest(http.MethodDelete, path, nil) + request, _ := http.NewRequest("DELETE", path, nil) server.ServeHTTP(recorder, request) _, ok := server.imgIDs[imgName] if ok { @@ -1756,58 +1545,19 @@ func TestRemoveImageWithMultipleTags(t *testing.T) { if len(server.images) < 1 { t.Fatal("RemoveImage: removed the image, but should keep it") } - if server.images[imgID].ID != imgID { + if server.images[0].ID != imgID { t.Error("RemoveImage: changed the ID of the image!") } } -func TestRemoveImageByIDWithMultipleTags(t *testing.T) { - t.Parallel() - server := baseDockerServer() - images := addImages(&server, 1, true) - server.buildMuxer() - imgID := images[0].ID - server.imgIDs["docker/python-wat"] = imgID - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", imgID) - request, _ := http.NewRequest(http.MethodDelete, path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusConflict { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) - } -} - -func TestRemoveImageByIDWithSingleTag(t *testing.T) { - t.Parallel() - server := baseDockerServer() - images := addImages(&server, 1, true) - server.buildMuxer() - imgID := images[0].ID - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", imgID) - request, _ := http.NewRequest(http.MethodDelete, path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.images) > 0 { - t.Error("RemoveImage: did not remove the image.") - } - imgName := "docker/python-" + imgID - _, ok := server.imgIDs[imgName] - if ok { - t.Error("RemoveImage: did not remove image tag name.") - } -} - func TestPrepareFailure(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{failures: make(map[string]string)} server.buildMuxer() errorID := "my_error" server.PrepareFailure(errorID, "containers/json") recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -1819,13 +1569,13 @@ func TestPrepareFailure(t *testing.T) { func TestPrepareMultiFailures(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{multiFailures: []map[string]string{}} server.buildMuxer() errorID := "multi error" server.PrepareMultiFailures(errorID, "containers/json") server.PrepareMultiFailures(errorID, "containers/json") recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -1834,7 +1584,7 @@ func TestPrepareMultiFailures(t *testing.T) { t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -1843,7 +1593,7 @@ func TestPrepareMultiFailures(t *testing.T) { t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1855,19 +1605,19 @@ func TestPrepareMultiFailures(t *testing.T) { func TestRemoveFailure(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{failures: make(map[string]string)} server.buildMuxer() errorID := "my_error" server.PrepareFailure(errorID, "containers/json") recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) } server.ResetFailure(errorID) recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodGet, "/containers/json?all=1", nil) + request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("RemoveFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1876,7 +1626,7 @@ func TestRemoveFailure(t *testing.T) { func TestResetMultiFailures(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{multiFailures: []map[string]string{}} server.buildMuxer() errorID := "multi error" server.PrepareMultiFailures(errorID, "containers/json") @@ -1892,23 +1642,23 @@ func TestResetMultiFailures(t *testing.T) { func TestMutateContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{failures: make(map[string]string)} server.buildMuxer() - server.addContainer(&docker.Container{ID: "id123"}) + server.containers = append(server.containers, &docker.Container{ID: "id123"}) state := docker.State{Running: false, ExitCode: 1} err := server.MutateContainer("id123", state) if err != nil { t.Fatal(err) } - if !reflect.DeepEqual(getContainer(&server).State, state) { + if !reflect.DeepEqual(server.containers[0].State, state) { t.Errorf("Wrong state after mutation.\nWant %#v.\nGot %#v.", - state, getContainer(&server).State) + state, server.containers[0].State) } } func TestMutateContainerNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{failures: make(map[string]string)} server.buildMuxer() state := docker.State{Running: false, ExitCode: 1} err := server.MutateContainer("id123", state) @@ -1922,7 +1672,7 @@ func TestMutateContainerNotFound(t *testing.T) { func TestBuildImageWithContentTypeTar(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{imgIDs: make(map[string]string)} imageName := "teste" recorder := httptest.NewRecorder() tarFile, err := os.Open("data/dockerfile.tar") @@ -1930,7 +1680,7 @@ func TestBuildImageWithContentTypeTar(t *testing.T) { t.Fatal(err) } defer tarFile.Close() - request, _ := http.NewRequest(http.MethodPost, "/build?t=teste", tarFile) + request, _ := http.NewRequest("POST", "/build?t=teste", tarFile) request.Header.Add("Content-Type", "application/tar") server.buildImage(recorder, request) if recorder.Body.String() == "miss Dockerfile" { @@ -1944,10 +1694,10 @@ func TestBuildImageWithContentTypeTar(t *testing.T) { func TestBuildImageWithRemoteDockerfile(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{imgIDs: make(map[string]string)} imageName := "teste" recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/build?t=teste&remote=http://localhost/Dockerfile", nil) + request, _ := http.NewRequest("POST", "/build?t=teste&remote=http://localhost/Dockerfile", nil) server.buildImage(recorder, request) if _, ok := server.imgIDs[imageName]; !ok { t.Errorf("BuildImage: image %s not builded", imageName) @@ -1956,9 +1706,9 @@ func TestBuildImageWithRemoteDockerfile(t *testing.T) { func TestPing(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/_ping", nil) + request, _ := http.NewRequest("GET", "/_ping", nil) server.pingDocker(recorder, request) if recorder.Body.String() != "" { t.Errorf("Ping: Unexpected body: %s", recorder.Body.String()) @@ -1982,13 +1732,13 @@ func TestDefaultHandler(t *testing.T) { func TestCreateExecContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() - containers := addContainers(&server, 2) + server := DockerServer{} + addContainers(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", containers[0].ID) - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2009,7 +1759,7 @@ func TestCreateExecContainer(t *testing.T) { EntryPoint: "bash", Arguments: []string{"-c", "ls"}, }, - ContainerID: containers[0].ID, + ContainerID: server.containers[0].ID, } if !reflect.DeepEqual(*serverExec, expected) { @@ -2019,13 +1769,13 @@ func TestCreateExecContainer(t *testing.T) { func TestInspectExecContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addContainers(&server, 1) server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", getContainer(&server).ID) - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2036,7 +1786,7 @@ func TestInspectExecContainer(t *testing.T) { t.Fatal(err) } path = fmt.Sprintf("/exec/%s/json", got.ID) - request, _ = http.NewRequest(http.MethodGet, path, nil) + request, _ = http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2052,7 +1802,7 @@ func TestInspectExecContainer(t *testing.T) { EntryPoint: "bash", Arguments: []string{"-c", "ls"}, }, - ContainerID: getContainer(&server).ID, + ContainerID: server.containers[0].ID, } if !reflect.DeepEqual(got2, expected) { @@ -2068,8 +1818,8 @@ func TestStartExecContainer(t *testing.T) { server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", getContainer(server).ID) - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2089,13 +1839,13 @@ func TestStartExecContainer(t *testing.T) { recorder := httptest.NewRecorder() path := fmt.Sprintf("/exec/%s/start", exec.ID) body := `{"Tty":true}` - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) close(sent) server.ServeHTTP(recorder, request) codes <- recorder.Code }() <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true) + execInfo, err := waitExec(server.URL(), exec.ID, true, 5) if err != nil { t.Fatal(err) } @@ -2106,7 +1856,7 @@ func TestStartExecContainer(t *testing.T) { if code := <-codes; code != http.StatusOK { t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) } - execInfo, err = waitExec(server.URL(), exec.ID, false) + execInfo, err = waitExec(server.URL(), exec.ID, false, 5) if err != nil { t.Fatal(err) } @@ -2123,8 +1873,8 @@ func TestStartExecContainerWildcardCallback(t *testing.T) { server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", getContainer(server).ID) - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2144,13 +1894,13 @@ func TestStartExecContainerWildcardCallback(t *testing.T) { recorder := httptest.NewRecorder() path := fmt.Sprintf("/exec/%s/start", exec.ID) body := `{"Tty":true}` - request, _ := http.NewRequest(http.MethodPost, path, strings.NewReader(body)) + request, _ := http.NewRequest("POST", path, strings.NewReader(body)) close(sent) server.ServeHTTP(recorder, request) codes <- recorder.Code }() <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true) + execInfo, err := waitExec(server.URL(), exec.ID, true, 5) if err != nil { t.Fatal(err) } @@ -2161,7 +1911,7 @@ func TestStartExecContainerWildcardCallback(t *testing.T) { if code := <-codes; code != http.StatusOK { t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) } - execInfo, err = waitExec(server.URL(), exec.ID, false) + execInfo, err = waitExec(server.URL(), exec.ID, false, 5) if err != nil { t.Fatal(err) } @@ -2178,12 +1928,11 @@ func TestStartExecContainerNotFound(t *testing.T) { server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Tty":true}` - request, _ := http.NewRequest(http.MethodPost, "/exec/something-wat/start", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/exec/something-wat/start", strings.NewReader(body)) server.ServeHTTP(recorder, request) } -func waitExec(url, execID string, running bool) (*docker.ExecInspect, error) { - const maxTry = 5 +func waitExec(url, execID string, running bool, maxTry int) (*docker.ExecInspect, error) { client, err := docker.NewClient(url) if err != nil { return nil, err @@ -2203,16 +1952,16 @@ func TestStatsContainer(t *testing.T) { t.Fatal(err) } defer server.Stop() - containers := addContainers(server, 2) + addContainers(server, 2) server.buildMuxer() expected := docker.Stats{} expected.CPUStats.CPUUsage.TotalUsage = 20 - server.PrepareStats(containers[0].ID, func(id string) docker.Stats { + server.PrepareStats(server.containers[0].ID, func(id string) docker.Stats { return expected }) recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stats?stream=false", containers[0].ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/stats?stream=false", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("StatsContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2248,19 +1997,19 @@ func TestStatsContainerStream(t *testing.T) { t.Fatal(err) } defer server.Stop() - containers := addContainers(server, 2) + addContainers(server, 2) server.buildMuxer() expected := docker.Stats{} expected.CPUStats.CPUUsage.TotalUsage = 20 - server.PrepareStats(containers[0].ID, func(id string) docker.Stats { + server.PrepareStats(server.containers[0].ID, func(id string) docker.Stats { time.Sleep(50 * time.Millisecond) return expected }) recorder := &safeWriter{ ResponseRecorder: httptest.NewRecorder(), } - path := fmt.Sprintf("/containers/%s/stats?stream=true", containers[0].ID) - request, _ := http.NewRequest(http.MethodGet, path, nil) + path := fmt.Sprintf("/containers/%s/stats?stream=true", server.containers[0].ID) + request, _ := http.NewRequest("GET", path, nil) go func() { server.ServeHTTP(recorder, request) }() @@ -2306,11 +2055,11 @@ func addNetworks(server *DockerServer, n int) { func TestListNetworks(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} addNetworks(&server, 2) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/networks", nil) + request, _ := http.NewRequest("GET", "/networks", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("ListNetworks: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2340,13 +2089,13 @@ type createNetworkResponse struct { func TestCreateNetwork(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() netid := fmt.Sprintf("%x", rand.Int()%10000) netname := fmt.Sprintf("%x", rand.Int()%10000) body := fmt.Sprintf(`{"ID": "%s", "Name": "%s", "Type": "bridge" }`, netid, netname) - request, _ := http.NewRequest(http.MethodPost, "/networks/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/networks/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -2365,10 +2114,10 @@ func TestCreateNetwork(t *testing.T) { func TestCreateNetworkInvalidBody(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/networks/create", strings.NewReader("whaaaaaat---")) + request, _ := http.NewRequest("POST", "/networks/create", strings.NewReader("whaaaaaat---")) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusBadRequest { t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) @@ -2377,13 +2126,13 @@ func TestCreateNetworkInvalidBody(t *testing.T) { func TestCreateNetworkDuplicateName(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() addNetworks(&server, 1) server.networks[0].Name = "mynetwork" recorder := httptest.NewRecorder() body := fmt.Sprintf(`{"ID": "%s", "Name": "mynetwork", "Type": "bridge" }`, fmt.Sprintf("%x", rand.Int()%10000)) - request, _ := http.NewRequest(http.MethodPost, "/networks/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/networks/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusForbidden { t.Errorf("CreateNetwork: wrong status. Want %d. Got %d.", http.StatusForbidden, recorder.Code) @@ -2392,14 +2141,14 @@ func TestCreateNetworkDuplicateName(t *testing.T) { func TestRemoveNetwork(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() server.networks = []*docker.Network{ {ID: "id1", Name: "name1"}, {ID: "id2", Name: "name2"}, } - request, _ := http.NewRequest(http.MethodDelete, "/networks/id1", nil) + request, _ := http.NewRequest("DELETE", "/networks/id1", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveNetwork: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -2408,7 +2157,7 @@ func TestRemoveNetwork(t *testing.T) { if !reflect.DeepEqual(server.networks, expected) { t.Errorf("RemoveNetwork: expected networks to be %#v, got %#v", expected, server.networks) } - request, _ = http.NewRequest(http.MethodDelete, "/networks/name2", nil) + request, _ = http.NewRequest("DELETE", "/networks/name2", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveNetwork: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -2419,29 +2168,9 @@ func TestRemoveNetwork(t *testing.T) { } } -func TestNetworkConnect(t *testing.T) { - t.Parallel() - server := baseDockerServer() - server.buildMuxer() - addNetworks(&server, 1) - server.networks[0].ID = fmt.Sprintf("%x", rand.Int()%10000) - server.imgIDs = map[string]string{"base": "a1234"} - containers := addContainers(&server, 1) - containers[0].ID = fmt.Sprintf("%x", rand.Int()%10000) - server.addContainer(containers[0]) - - recorder := httptest.NewRecorder() - body := fmt.Sprintf(`{"Container": "%s" }`, containers[0].ID) - request, _ := http.NewRequest(http.MethodPost, fmt.Sprintf("/networks/%s/connect", server.networks[0].ID), strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("NetworkConnect: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - func TestListVolumes(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() expected := []docker.Volume{{ Name: "test-vol-1", @@ -2456,7 +2185,7 @@ func TestListVolumes(t *testing.T) { } } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/volumes", nil) + request, _ := http.NewRequest("GET", "/volumes", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("ListVolumes: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -2469,7 +2198,7 @@ func TestListVolumes(t *testing.T) { gotVolumes, ok := got["Volumes"] if !ok { - t.Fatal("ListVolumes failed can not find Volumes") + t.Fatal(fmt.Errorf("ListVolumes failed can not find Volumes")) } if !reflect.DeepEqual(gotVolumes, expected) { t.Errorf("ListVolumes. Want %#v. Got %#v.", expected, got) @@ -2478,11 +2207,11 @@ func TestListVolumes(t *testing.T) { func TestCreateVolume(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() body := `{"Name":"test-volume"}` - request, _ := http.NewRequest(http.MethodPost, "/volumes/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/volumes/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateVolume: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -2505,7 +2234,7 @@ func TestCreateVolume(t *testing.T) { func TestCreateVolumeAlreadExists(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() server.volStore = make(map[string]*volumeCounter) server.volStore["test-volume"] = &volumeCounter{ @@ -2518,7 +2247,7 @@ func TestCreateVolumeAlreadExists(t *testing.T) { } body := `{"Name":"test-volume"}` recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/volumes/create", strings.NewReader(body)) + request, _ := http.NewRequest("POST", "/volumes/create", strings.NewReader(body)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusCreated { t.Errorf("CreateVolumeAlreadExists: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) @@ -2541,7 +2270,7 @@ func TestCreateVolumeAlreadExists(t *testing.T) { func TestInspectVolume(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() expected := docker.Volume{ @@ -2556,7 +2285,7 @@ func TestInspectVolume(t *testing.T) { volStore := make(map[string]*volumeCounter) volStore["test-volume"] = volC server.volStore = volStore - request, _ := http.NewRequest(http.MethodGet, "/volumes/test-volume", nil) + request, _ := http.NewRequest("GET", "/volumes/test-volume", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("InspectVolume: wrong status. Want %d. God %d.", http.StatusOK, recorder.Code) @@ -2579,10 +2308,10 @@ func TestInspectVolume(t *testing.T) { func TestInspectVolumeNotFound(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/volumes/test-volume", nil) + request, _ := http.NewRequest("GET", "/volumes/test-volume", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("RemoveMissingVolume: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -2591,7 +2320,7 @@ func TestInspectVolumeNotFound(t *testing.T) { func TestRemoveVolume(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() server.volStore = make(map[string]*volumeCounter) server.volStore["test-volume"] = &volumeCounter{ @@ -2603,7 +2332,7 @@ func TestRemoveVolume(t *testing.T) { count: 0, } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/volumes/test-volume", nil) + request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNoContent { t.Errorf("RemoveVolume: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) @@ -2612,10 +2341,10 @@ func TestRemoveVolume(t *testing.T) { func TestRemoveMissingVolume(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/volumes/test-volume", nil) + request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("RemoveMissingVolume: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -2624,7 +2353,7 @@ func TestRemoveMissingVolume(t *testing.T) { func TestRemoveVolumeInuse(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() server.volStore = make(map[string]*volumeCounter) server.volStore["test-volume"] = &volumeCounter{ @@ -2636,7 +2365,7 @@ func TestRemoveVolumeInuse(t *testing.T) { count: 1, } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/volumes/test-volume", nil) + request, _ := http.NewRequest("DELETE", "/volumes/test-volume", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusConflict { t.Errorf("RemoveVolume: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) @@ -2645,7 +2374,7 @@ func TestRemoveVolumeInuse(t *testing.T) { func TestUploadToContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() cont := &docker.Container{ ID: "id123", @@ -2654,10 +2383,10 @@ func TestUploadToContainer(t *testing.T) { ExitCode: 0, }, } - server.addContainer(cont) + server.containers = append(server.containers, cont) server.uploadedFiles = make(map[string]string) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPut, fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), nil) + request, _ := http.NewRequest("PUT", fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2671,7 +2400,7 @@ func TestUploadToContainer(t *testing.T) { func TestUploadToContainerWithBodyTarFile(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() cont := &docker.Container{ ID: "id123", @@ -2691,10 +2420,10 @@ func TestUploadToContainerWithBodyTarFile(t *testing.T) { tw.WriteHeader(hdr) tw.Write([]byte("something")) tw.Close() - server.addContainer(cont) + server.containers = append(server.containers, cont) server.uploadedFiles = make(map[string]string) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPut, fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), buf) + request, _ := http.NewRequest("PUT", fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), buf) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2708,7 +2437,7 @@ func TestUploadToContainerWithBodyTarFile(t *testing.T) { func TestUploadToContainerBodyNotTarFile(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() cont := &docker.Container{ ID: "id123", @@ -2718,10 +2447,10 @@ func TestUploadToContainerBodyNotTarFile(t *testing.T) { }, } buf := bytes.NewBufferString("something") - server.addContainer(cont) + server.containers = append(server.containers, cont) server.uploadedFiles = make(map[string]string) recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPut, fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), buf) + request, _ := http.NewRequest("PUT", fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), buf) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2735,10 +2464,10 @@ func TestUploadToContainerBodyNotTarFile(t *testing.T) { func TestUploadToContainerMissingContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPut, "/containers/missing-container/archive?path=abcd", nil) + request, _ := http.NewRequest("PUT", "/containers/missing-container/archive?path=abcd", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Errorf("UploadToContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -2752,7 +2481,7 @@ func TestInfoDocker(t *testing.T) { addContainers(server, 1) server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/info", nil) + request, _ := http.NewRequest("GET", "/info", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("InfoDocker: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2776,7 +2505,7 @@ func TestInfoDockerWithSwarm(t *testing.T) { defer srv1.Stop() defer srv2.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/info", nil) + request, _ := http.NewRequest("GET", "/info", nil) srv1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("InfoDocker: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2804,7 +2533,7 @@ func TestVersionDocker(t *testing.T) { defer server.Stop() server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/version", nil) + request, _ := http.NewRequest("GET", "/version", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("VersionDocker: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -2813,7 +2542,7 @@ func TestVersionDocker(t *testing.T) { func TestDownloadFromContainer(t *testing.T) { t.Parallel() - server := baseDockerServer() + server := DockerServer{} server.buildMuxer() cont := &docker.Container{ ID: "id123", @@ -2822,17 +2551,16 @@ func TestDownloadFromContainer(t *testing.T) { ExitCode: 0, }, } - server.addContainer(cont) + server.containers = append(server.containers, cont) server.uploadedFiles = make(map[string]string) server.uploadedFiles[cont.ID] = "abcd" recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf("/containers/%s/archive?path=abcd", cont.ID), nil) server.ServeHTTP(recorder, request) - resp := recorder.Result() - if resp.StatusCode != http.StatusOK { - t.Errorf("DownloadFromContainer: wrong status. Want %d. Got %d.", http.StatusOK, resp.StatusCode) + if recorder.Code != http.StatusOK { + t.Errorf("DownloadFromContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) } - if resp.Header.Get("Content-Type") != "application/x-tar" { - t.Errorf("DownloadFromContainer: wrong Content-Type. Want 'application/x-tar'. Got %s.", resp.Header.Get("Content-Type")) + if recorder.HeaderMap.Get("Content-Type") != "application/x-tar" { + t.Errorf("DownloadFromContainer: wrong Content-Type. Want 'application/x-tar'. Got %s.", recorder.HeaderMap.Get("Content-Type")) } } diff --git a/vendor/github.com/fsouza/go-dockerclient/testing/swarm.go b/vendor/github.com/fsouza/go-dockerclient/testing/swarm.go index 5001c89697a5..555302471e47 100644 --- a/vendor/github.com/fsouza/go-dockerclient/testing/swarm.go +++ b/vendor/github.com/fsouza/go-dockerclient/testing/swarm.go @@ -18,7 +18,7 @@ import ( "time" "github.com/docker/docker/api/types/swarm" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" "github.com/gorilla/mux" ) @@ -34,7 +34,7 @@ func newSwarmServer(srv *DockerServer, bind string) (*swarmServer, error) { return nil, err } router := mux.NewRouter() - router.Path("/internal/updatenodes").Methods(http.MethodPost).HandlerFunc(srv.handlerWrapper(srv.internalUpdateNodes)) + router.Path("/internal/updatenodes").Methods("POST").HandlerFunc(srv.handlerWrapper(srv.internalUpdateNodes)) server := &swarmServer{ listener: listener, mux: router, @@ -255,9 +255,6 @@ func (s *DockerServer) setServiceEndpoint(service *swarm.Service) { } func (s *DockerServer) addTasks(service *swarm.Service, update bool) { - if service.Spec.TaskTemplate.ContainerSpec == nil { - return - } containerCount := 1 if service.Spec.Mode.Global != nil { containerCount = len(s.nodes) @@ -280,7 +277,7 @@ func (s *DockerServer) addTasks(service *swarm.Service, update bool) { NodeID: chosenNode.ID, Status: swarm.TaskStatus{ State: swarm.TaskStateReady, - ContainerStatus: &swarm.ContainerStatus{ + ContainerStatus: swarm.ContainerStatus{ ContainerID: container.ID, }, }, @@ -288,7 +285,7 @@ func (s *DockerServer) addTasks(service *swarm.Service, update bool) { Spec: service.Spec.TaskTemplate, } s.tasks = append(s.tasks, &task) - s.addContainer(container) + s.containers = append(s.containers, container) s.notify(container) } } @@ -444,10 +441,9 @@ func (s *DockerServer) serviceDelete(w http.ResponseWriter, r *http.Request) { s.services = s.services[:len(s.services)-1] for i := 0; i < len(s.tasks); i++ { if s.tasks[i].ServiceID == toDelete.ID { - cont, _ := s.findContainerWithLock(s.tasks[i].Status.ContainerStatus.ContainerID, false) - if cont != nil { - delete(s.containers, cont.ID) - delete(s.contNameToID, cont.Name) + _, contIdx, _ := s.findContainerWithLock(s.tasks[i].Status.ContainerStatus.ContainerID, false) + if contIdx != -1 { + s.containers = append(s.containers[:contIdx], s.containers[contIdx+1:]...) } s.tasks = append(s.tasks[:i], s.tasks[i+1:]...) i-- @@ -461,7 +457,6 @@ func (s *DockerServer) serviceDelete(w http.ResponseWriter, r *http.Request) { } func (s *DockerServer) serviceUpdate(w http.ResponseWriter, r *http.Request) { - start := time.Now() s.swarmMut.Lock() defer s.swarmMut.Unlock() s.cMut.Lock() @@ -489,21 +484,14 @@ func (s *DockerServer) serviceUpdate(w http.ResponseWriter, r *http.Request) { return } toUpdate.Spec = newSpec - end := time.Now() - toUpdate.UpdateStatus = &swarm.UpdateStatus{ - State: swarm.UpdateStateCompleted, - CompletedAt: &end, - StartedAt: &start, - } s.setServiceEndpoint(toUpdate) for i := 0; i < len(s.tasks); i++ { if s.tasks[i].ServiceID != toUpdate.ID { continue } - cont, _ := s.findContainerWithLock(s.tasks[i].Status.ContainerStatus.ContainerID, false) - if cont != nil { - delete(s.containers, cont.ID) - delete(s.contNameToID, cont.Name) + _, contIdx, _ := s.findContainerWithLock(s.tasks[i].Status.ContainerStatus.ContainerID, false) + if contIdx != -1 { + s.containers = append(s.containers[:contIdx], s.containers[contIdx+1:]...) } s.tasks = append(s.tasks[:i], s.tasks[i+1:]...) i-- @@ -626,7 +614,6 @@ func (s *DockerServer) runNodeOperation(dst string, nodeOp nodeOperation) error if err != nil { return err } - defer rsp.Body.Close() if rsp.StatusCode != http.StatusOK { return fmt.Errorf("unexpected status code in updatenodes: %d", rsp.StatusCode) } @@ -677,13 +664,11 @@ func (s *DockerServer) internalUpdateNodes(w http.ResponseWriter, r *http.Reques continue } url := fmt.Sprintf("http://%s/internal/updatenodes?propagate=0", node.ManagerStatus.Addr) - var resp *http.Response - resp, err = http.Post(url, "application/json", bytes.NewReader(data)) + _, err = http.Post(url, "application/json", bytes.NewReader(data)) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp.Body.Close() } } if nodeOp.Services != nil { diff --git a/vendor/github.com/fsouza/go-dockerclient/testing/swarm_test.go b/vendor/github.com/fsouza/go-dockerclient/testing/swarm_test.go index 782eb4bd8f06..1059071a71ba 100644 --- a/vendor/github.com/fsouza/go-dockerclient/testing/swarm_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/testing/swarm_test.go @@ -7,19 +7,17 @@ package testing import ( "bytes" "encoding/json" - "errors" "fmt" "io" "net" "net/http" "net/http/httptest" - "net/url" "reflect" "strings" "testing" "github.com/docker/docker/api/types/swarm" - docker "github.com/fsouza/go-dockerclient" + "github.com/fsouza/go-dockerclient" ) func TestSwarmInit(t *testing.T) { @@ -30,7 +28,7 @@ func TestSwarmInit(t *testing.T) { defer server.Stop() server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", bytes.NewReader(nil)) + request, _ := http.NewRequest("POST", "/swarm/init", bytes.NewReader(nil)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmInit: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -66,7 +64,7 @@ func TestSwarmInitDynamicAdvertiseAddrPort(t *testing.T) { server.buildMuxer() data := `{"ListenAddr": "127.0.0.1:0", "AdvertiseAddr": "localhost"}` recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", strings.NewReader(data)) + request, _ := http.NewRequest("POST", "/swarm/init", strings.NewReader(data)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmInit: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -90,7 +88,7 @@ func TestSwarmInitAlreadyInSwarm(t *testing.T) { server.buildMuxer() server.swarm = &swarm.Swarm{} recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", nil) + request, _ := http.NewRequest("POST", "/swarm/init", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotAcceptable { t.Fatalf("SwarmInit: wrong status. Want %d. Got %d.", http.StatusNotAcceptable, recorder.Code) @@ -105,7 +103,7 @@ func TestSwarmJoinNoBody(t *testing.T) { defer server.Stop() server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/join", bytes.NewReader(nil)) + request, _ := http.NewRequest("POST", "/swarm/join", bytes.NewReader(nil)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusInternalServerError { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) @@ -131,7 +129,7 @@ func TestSwarmJoin(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", bytes.NewReader(data)) + request, _ := http.NewRequest("POST", "/swarm/init", bytes.NewReader(data)) server1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -143,7 +141,7 @@ func TestSwarmJoin(t *testing.T) { t.Fatal(err) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodPost, "/swarm/join", bytes.NewReader(data)) + request, _ = http.NewRequest("POST", "/swarm/join", bytes.NewReader(data)) server2.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -184,7 +182,7 @@ func TestSwarmJoinWithService(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", bytes.NewReader(data)) + request, _ := http.NewRequest("POST", "/swarm/init", bytes.NewReader(data)) server1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -203,7 +201,7 @@ func TestSwarmJoinWithService(t *testing.T) { t.Fatalf("ServiceCreate error: %s", err.Error()) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodPost, "/services/create", bytes.NewBuffer(buf)) + request, _ = http.NewRequest("POST", "/services/create", bytes.NewBuffer(buf)) server1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmJoin: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -215,7 +213,7 @@ func TestSwarmJoinWithService(t *testing.T) { t.Fatal(err) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodPost, "/swarm/join", bytes.NewReader(data)) + request, _ = http.NewRequest("POST", "/swarm/join", bytes.NewReader(data)) server2.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -243,7 +241,7 @@ func TestSwarmJoinAlreadyInSwarm(t *testing.T) { server.buildMuxer() server.swarm = &swarm.Swarm{} recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/join", nil) + request, _ := http.NewRequest("POST", "/swarm/join", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotAcceptable { t.Fatalf("SwarmJoin: wrong status. Want %d. Got %d.", http.StatusNotAcceptable, recorder.Code) @@ -260,7 +258,7 @@ func TestSwarmLeave(t *testing.T) { server.swarm = &swarm.Swarm{} server.swarmServer, _ = newSwarmServer(server, "127.0.0.1:0") recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/leave", nil) + request, _ := http.NewRequest("POST", "/swarm/leave", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmLeave: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -278,7 +276,7 @@ func TestSwarmLeaveNotInSwarm(t *testing.T) { defer server.Stop() server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/leave", nil) + request, _ := http.NewRequest("POST", "/swarm/leave", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotAcceptable { t.Fatalf("SwarmLeave: wrong status. Want %d. Got %d.", http.StatusNotAcceptable, recorder.Code) @@ -302,7 +300,7 @@ func TestSwarmInspect(t *testing.T) { } server.swarm = expected recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/swarm", nil) + request, _ := http.NewRequest("GET", "/swarm", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("SwarmInspect: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -325,7 +323,7 @@ func TestSwarmInspectNotInSwarm(t *testing.T) { defer server.Stop() server.buildMuxer() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/swarm", nil) + request, _ := http.NewRequest("GET", "/swarm", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotAcceptable { t.Fatalf("SwarmInspect: wrong status. Want %d. Got %d.", http.StatusNotAcceptable, recorder.Code) @@ -365,8 +363,9 @@ func TestServiceCreate(t *testing.T) { if err != nil { t.Fatalf("ServiceCreate error: %s", err.Error()) } - var params io.Reader = bytes.NewBuffer(buf) - request, _ := http.NewRequest(http.MethodPost, "/services/create", params) + var params io.Reader + params = bytes.NewBuffer(buf) + request, _ := http.NewRequest("POST", "/services/create", params) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceCreate: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -374,7 +373,7 @@ func TestServiceCreate(t *testing.T) { if len(server.services) != 1 || len(server.tasks) != 1 || len(server.containers) != 1 { t.Fatalf("ServiceCreate: wrong item count. Want 1. Got services: %d, tasks: %d, containers: %d.", len(server.services), len(server.tasks), len(server.containers)) } - cont := getContainer(server) + cont := server.containers[0] expectedContainer := &docker.Container{ ID: cont.ID, Created: cont.Created, @@ -415,7 +414,7 @@ func TestServiceCreate(t *testing.T) { NodeID: server.nodes[0].ID, Status: swarm.TaskStatus{ State: swarm.TaskStateReady, - ContainerStatus: &swarm.ContainerStatus{ + ContainerStatus: swarm.ContainerStatus{ ContainerID: cont.ID, }, }, @@ -460,8 +459,9 @@ func TestServiceCreateDynamicPort(t *testing.T) { if err != nil { t.Fatalf("ServiceCreate error: %s", err.Error()) } - var params io.Reader = bytes.NewBuffer(buf) - request, _ := http.NewRequest(http.MethodPost, "/services/create", params) + var params io.Reader + params = bytes.NewBuffer(buf) + request, _ := http.NewRequest("POST", "/services/create", params) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceCreate: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -508,33 +508,6 @@ func TestServiceCreateMultipleServers(t *testing.T) { } } -func TestServiceCreateNoContainers(t *testing.T) { - server, unused := setUpSwarm(t) - defer server.Stop() - defer unused.Stop() - recorder := httptest.NewRecorder() - serviceCreateOpts := docker.CreateServiceOptions{ - ServiceSpec: swarm.ServiceSpec{ - Annotations: swarm.Annotations{ - Name: "test", - }, - }, - } - buf, err := json.Marshal(serviceCreateOpts) - if err != nil { - t.Fatalf("ServiceCreate error: %s", err.Error()) - } - var params io.Reader = bytes.NewBuffer(buf) - request, _ := http.NewRequest(http.MethodPost, "/services/create", params) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("ServiceCreate: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.services) != 1 || len(server.tasks) != 0 || len(server.containers) != 0 { - t.Fatalf("ServiceCreate: wrong item count. Want 1 service and 0 tasks. Got services: %d, tasks: %d, containers: %d.", len(server.services), len(server.tasks), len(server.containers)) - } -} - func compareServices(srv1 *swarm.Service, srv2 *swarm.Service) bool { srv1.CreatedAt = srv2.CreatedAt srv1.UpdatedAt = srv2.UpdatedAt @@ -561,7 +534,7 @@ func TestServiceInspect(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/services/"+srv.ID, nil) + request, _ := http.NewRequest("GET", "/services/"+srv.ID, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceInspect: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -585,7 +558,7 @@ func TestServiceInspectByName(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/services/"+srv.Spec.Name, nil) + request, _ := http.NewRequest("GET", "/services/"+srv.Spec.Name, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceInspect: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -605,7 +578,7 @@ func TestServiceInspectNotFound(t *testing.T) { defer server.Stop() defer unused.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/services/abcd", nil) + request, _ := http.NewRequest("GET", "/services/abcd", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Fatalf("ServiceInspect: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -622,7 +595,7 @@ func TestTaskInspect(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/tasks/"+task.ID, nil) + request, _ := http.NewRequest("GET", "/tasks/"+task.ID, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskInspect: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -642,7 +615,7 @@ func TestTaskInspectNotFound(t *testing.T) { defer server.Stop() defer unused.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/tasks/abcd", nil) + request, _ := http.NewRequest("GET", "/tasks/abcd", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Fatalf("TaskInspect: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -658,7 +631,7 @@ func TestServiceList(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/services", nil) + request, _ := http.NewRequest("GET", "/services", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -682,7 +655,7 @@ func TestServiceListFilterID(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/services?filters={"id":[%q]}`, srv.ID), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/services?filters={"id":[%q]}`, srv.ID), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -706,7 +679,7 @@ func TestServiceListFilterName(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/services?filters={"name":[%q]}`, srv.Spec.Name), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/services?filters={"name":[%q]}`, srv.Spec.Name), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -730,7 +703,7 @@ func TestServiceListFilterEmpty(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/services?filters="+url.QueryEscape(`{"id":["something"]}`), nil) + request, _ := http.NewRequest("GET", `/services?filters={"id":["something"]}`, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -755,7 +728,7 @@ func TestTaskList(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/tasks", nil) + request, _ := http.NewRequest("GET", "/tasks", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -780,7 +753,7 @@ func TestTaskListFilterID(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/tasks?filters={"id":[%q]}`, task.ID), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/tasks?filters={"id":[%q]}`, task.ID), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -805,7 +778,7 @@ func TestTaskListFilterServiceID(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/tasks?filters={"service":[%q]}`, task.ServiceID), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/tasks?filters={"service":[%q]}`, task.ServiceID), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -830,7 +803,7 @@ func TestTaskListFilterServiceName(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/tasks?filters={"service":[%q]}`, srv.Spec.Name), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/tasks?filters={"service":[%q]}`, srv.Spec.Name), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -855,7 +828,7 @@ func TestTaskListFilterMultipleFields(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, fmt.Sprintf(`/tasks?filters={"service":[%q], "id":[%q]}`, srv.Spec.Name, task.ID), nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/tasks?filters={"service":[%q], "id":[%q]}`, srv.Spec.Name, task.ID), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -879,8 +852,7 @@ func TestTaskListFilterMultipleFieldsNotFound(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - filterParam := url.QueryEscape(fmt.Sprintf(`{"service":[%q], "id":["abc"]}`, srv.Spec.Name)) - request, _ := http.NewRequest(http.MethodGet, "/tasks?filters="+filterParam, nil) + request, _ := http.NewRequest("GET", fmt.Sprintf(`/tasks?filters={"service":[%q], "id":["abc"]}`, srv.Spec.Name), nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -904,8 +876,7 @@ func TestTaskListFilterNotFound(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - filter := url.QueryEscape(`{"id":["something"]}`) - request, _ := http.NewRequest(http.MethodGet, "/tasks?filters="+filter, nil) + request, _ := http.NewRequest("GET", `/tasks?filters={"id":["something"]}`, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -930,8 +901,7 @@ func TestTaskListFilterLabel(t *testing.T) { } task := server.tasks[0] recorder := httptest.NewRecorder() - filter := url.QueryEscape(`{"label":["mykey=myvalue"]}`) - request, _ := http.NewRequest(http.MethodGet, "/tasks?filters="+filter, nil) + request, _ := http.NewRequest("GET", `/tasks?filters={"label":["mykey=myvalue"]}`, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("TaskList: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -944,8 +914,7 @@ func TestTaskListFilterLabel(t *testing.T) { if !compareTasks(task, &taskInspect[0]) { t.Fatalf("TaskList: wrong task. Want\n%#v\nGot\n%#v", task, &taskInspect) } - filter = url.QueryEscape(`{"label":["mykey"]}`) - request, _ = http.NewRequest(http.MethodGet, "/tasks?filters="+filter, nil) + request, _ = http.NewRequest("GET", `/tasks?filters={"label":["mykey"]}`, nil) recorder = httptest.NewRecorder() server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { @@ -958,8 +927,7 @@ func TestTaskListFilterLabel(t *testing.T) { if !compareTasks(task, &taskInspect[0]) { t.Fatalf("TaskList: wrong task. Want\n%#v\nGot\n%#v", task, &taskInspect) } - filter = url.QueryEscape(`{"label":["otherkey"]}`) - request, _ = http.NewRequest(http.MethodGet, "/tasks?filters="+filter, nil) + request, _ = http.NewRequest("GET", `/tasks?filters={"label":["otherkey"]}`, nil) recorder = httptest.NewRecorder() server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { @@ -983,7 +951,7 @@ func TestServiceDelete(t *testing.T) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/services/"+srv.ID, nil) + request, _ := http.NewRequest("DELETE", "/services/"+srv.ID, nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceDelete: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1004,7 +972,7 @@ func TestServiceDeleteNotFound(t *testing.T) { defer server.Stop() defer unused.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/services/blahblah", nil) + request, _ := http.NewRequest("DELETE", "/services/blahblah", nil) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Fatalf("ServiceDelete: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1045,7 +1013,7 @@ func TestServiceUpdate(t *testing.T) { if err != nil { t.Fatalf("ServiceUpdate error: %s", err.Error()) } - request, _ := http.NewRequest(http.MethodPost, fmt.Sprintf("/services/%s/update", srv.ID), bytes.NewReader(buf)) + request, _ := http.NewRequest("POST", fmt.Sprintf("/services/%s/update", srv.ID), bytes.NewReader(buf)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceUpdate: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1053,7 +1021,7 @@ func TestServiceUpdate(t *testing.T) { if len(server.services) != 1 || len(server.tasks) != 1 || len(server.containers) != 1 { t.Fatalf("ServiceUpdate: wrong item count. Want 1. Got services: %d, tasks: %d, containers: %d.", len(server.services), len(server.tasks), len(server.containers)) } - cont := getContainer(server) + cont := server.containers[0] expectedContainer := &docker.Container{ ID: cont.ID, Created: cont.Created, @@ -1082,12 +1050,7 @@ func TestServiceUpdate(t *testing.T) { Spec: *updateOpts.EndpointSpec, Ports: []swarm.PortConfig{{Protocol: "tcp", TargetPort: 80, PublishedPort: 80}}, }, - UpdateStatus: &swarm.UpdateStatus{ - State: swarm.UpdateStateCompleted, - }, } - srv.UpdateStatus.CompletedAt = nil - srv.UpdateStatus.StartedAt = nil if !reflect.DeepEqual(srv, expectedService) { t.Fatalf("ServiceUpdate: wrong service. Want\n%#v\nGot\n%#v", expectedService, srv) } @@ -1098,7 +1061,7 @@ func TestServiceUpdate(t *testing.T) { NodeID: server.nodes[1].ID, Status: swarm.TaskStatus{ State: swarm.TaskStateReady, - ContainerStatus: &swarm.ContainerStatus{ + ContainerStatus: swarm.ContainerStatus{ ContainerID: cont.ID, }, }, @@ -1150,7 +1113,7 @@ func TestServiceUpdateMoreReplicas(t *testing.T) { if err != nil { t.Fatalf("ServiceUpdate error: %s", err.Error()) } - request, _ := http.NewRequest(http.MethodPost, fmt.Sprintf("/services/%s/update", srv.ID), bytes.NewReader(buf)) + request, _ := http.NewRequest("POST", fmt.Sprintf("/services/%s/update", srv.ID), bytes.NewReader(buf)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("ServiceUpdate: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) @@ -1190,7 +1153,7 @@ func TestServiceUpdateNotFound(t *testing.T) { if err != nil { t.Fatalf("ServiceUpdate error: %s", err.Error()) } - request, _ := http.NewRequest(http.MethodPost, "/services/pale/update", bytes.NewReader(buf)) + request, _ := http.NewRequest("POST", "/services/pale/update", bytes.NewReader(buf)) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusNotFound { t.Fatalf("ServiceUpdate: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) @@ -1203,7 +1166,7 @@ func TestNodeList(t *testing.T) { defer srv2.Stop() for _, srv := range []*DockerServer{srv1, srv2} { recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/nodes", nil) + request, _ := http.NewRequest("GET", "/nodes", nil) srv.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("invalid status code: %d", recorder.Code) @@ -1228,7 +1191,7 @@ func TestNodeInfo(t *testing.T) { defer srv2.Stop() for _, srv := range []*DockerServer{srv1, srv2} { recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodGet, "/nodes/"+srv.nodes[0].ID, nil) + request, _ := http.NewRequest("GET", "/nodes/"+srv.nodes[0].ID, nil) srv.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("invalid status code: %d", recorder.Code) @@ -1261,7 +1224,7 @@ func TestNodeUpdate(t *testing.T) { t.Fatal(err) } body := bytes.NewReader(data) - request, _ := http.NewRequest(http.MethodPost, "/nodes/"+srv.nodes[0].ID+"/update", body) + request, _ := http.NewRequest("POST", "/nodes/"+srv.nodes[0].ID+"/update", body) srv.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("invalid status code: %d", recorder.Code) @@ -1280,7 +1243,7 @@ func TestNodeDelete(t *testing.T) { defer srv1.Stop() defer srv2.Stop() recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodDelete, "/nodes/"+srv1.nodes[0].ID, nil) + request, _ := http.NewRequest("DELETE", "/nodes/"+srv1.nodes[0].ID, nil) srv1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("invalid status code: %d", recorder.Code) @@ -1303,7 +1266,7 @@ func setUpSwarm(t *testing.T) (*DockerServer, *DockerServer) { t.Fatal(err) } recorder := httptest.NewRecorder() - request, _ := http.NewRequest(http.MethodPost, "/swarm/init", bytes.NewReader(nil)) + request, _ := http.NewRequest("POST", "/swarm/init", bytes.NewReader(nil)) server1.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("setUpSwarm: invalid status code swarm init %d", recorder.Code) @@ -1315,7 +1278,7 @@ func setUpSwarm(t *testing.T) (*DockerServer, *DockerServer) { t.Fatal(err) } recorder = httptest.NewRecorder() - request, _ = http.NewRequest(http.MethodPost, "/swarm/join", bytes.NewReader(data)) + request, _ = http.NewRequest("POST", "/swarm/join", bytes.NewReader(data)) server2.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { t.Fatalf("setUpSwarm: invalid status code swarm join %d", recorder.Code) @@ -1355,17 +1318,18 @@ func addTestService(server *DockerServer) (*swarm.Service, error) { if err != nil { return nil, err } - var params io.Reader = bytes.NewBuffer(buf) - request, _ := http.NewRequest(http.MethodPost, "/services/create", params) + var params io.Reader + params = bytes.NewBuffer(buf) + request, _ := http.NewRequest("POST", "/services/create", params) server.ServeHTTP(recorder, request) if recorder.Code != http.StatusOK { return nil, fmt.Errorf("unexpected status %d", recorder.Code) } if len(server.services) == 0 { - return nil, errors.New("no service created on server") + return nil, fmt.Errorf("no service created on server") } if len(server.tasks) == 0 { - return nil, errors.New("no tasks created on server") + return nil, fmt.Errorf("no tasks created on server") } return server.services[0], nil } diff --git a/vendor/github.com/fsouza/go-dockerclient/tls.go b/vendor/github.com/fsouza/go-dockerclient/tls.go index 8a76f0dbf6e3..bb5790b5f0bf 100644 --- a/vendor/github.com/fsouza/go-dockerclient/tls.go +++ b/vendor/github.com/fsouza/go-dockerclient/tls.go @@ -38,7 +38,7 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con timeout := dialer.Timeout if !dialer.Deadline.IsZero() { - deadlineTimeout := time.Until(dialer.Deadline) + deadlineTimeout := dialer.Deadline.Sub(time.Now()) if timeout == 0 || deadlineTimeout < timeout { timeout = deadlineTimeout } @@ -103,15 +103,16 @@ func copyTLSConfig(cfg *tls.Config) *tls.Config { ClientCAs: cfg.ClientCAs, ClientSessionCache: cfg.ClientSessionCache, CurvePreferences: cfg.CurvePreferences, - InsecureSkipVerify: cfg.InsecureSkipVerify, //nolint:gosec + InsecureSkipVerify: cfg.InsecureSkipVerify, MaxVersion: cfg.MaxVersion, MinVersion: cfg.MinVersion, + NameToCertificate: cfg.NameToCertificate, NextProtos: cfg.NextProtos, PreferServerCipherSuites: cfg.PreferServerCipherSuites, - Rand: cfg.Rand, - RootCAs: cfg.RootCAs, - ServerName: cfg.ServerName, - SessionTicketKey: cfg.SessionTicketKey, - SessionTicketsDisabled: cfg.SessionTicketsDisabled, + Rand: cfg.Rand, + RootCAs: cfg.RootCAs, + ServerName: cfg.ServerName, + SessionTicketKey: cfg.SessionTicketKey, + SessionTicketsDisabled: cfg.SessionTicketsDisabled, } } diff --git a/vendor/github.com/fsouza/go-dockerclient/travis-scripts/install-docker.bash b/vendor/github.com/fsouza/go-dockerclient/travis-scripts/install-docker.bash new file mode 100755 index 000000000000..d151e033ad7e --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/travis-scripts/install-docker.bash @@ -0,0 +1,18 @@ +#!/bin/bash -x + +# Copyright 2016 go-dockerclient authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +if [[ $TRAVIS_OS_NAME == "linux" ]]; then + sudo stop docker || true + sudo rm -rf /var/lib/docker + sudo rm -f `which docker` + + set -e + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" + sudo apt-get update + sudo apt-get install docker-ce=${DOCKER_PKG_VERSION} -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" + sudo start docker || true +fi diff --git a/vendor/github.com/fsouza/go-dockerclient/travis-scripts/run-tests.bash b/vendor/github.com/fsouza/go-dockerclient/travis-scripts/run-tests.bash new file mode 100755 index 000000000000..b3792762c861 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/travis-scripts/run-tests.bash @@ -0,0 +1,11 @@ +#!/bin/bash -ex + +# Copyright 2016 go-dockerclient authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +make test + +if [[ $TRAVIS_OS_NAME == "linux" ]]; then + make integration +fi diff --git a/vendor/github.com/fsouza/go-dockerclient/volume.go b/vendor/github.com/fsouza/go-dockerclient/volume.go index c39a273bffa8..3c7bdeaa747e 100644 --- a/vendor/github.com/fsouza/go-dockerclient/volume.go +++ b/vendor/github.com/fsouza/go-dockerclient/volume.go @@ -5,11 +5,11 @@ package docker import ( - "context" "encoding/json" "errors" "net/http" - "time" + + "golang.org/x/net/context" ) var ( @@ -22,19 +22,17 @@ var ( // Volume represents a volume. // -// See https://goo.gl/3wgTsd for more details. +// See https://goo.gl/FZA4BK for more details. type Volume struct { Name string `json:"Name" yaml:"Name" toml:"Name"` Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"` Mountpoint string `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty" toml:"Mountpoint,omitempty"` Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"` - Options map[string]string `json:"Options,omitempty" yaml:"Options,omitempty" toml:"Options,omitempty"` - CreatedAt time.Time `json:"CreatedAt,omitempty" yaml:"CreatedAt,omitempty" toml:"CreatedAt,omitempty"` } // ListVolumesOptions specify parameters to the ListVolumes function. // -// See https://goo.gl/3wgTsd for more details. +// See https://goo.gl/FZA4BK for more details. type ListVolumesOptions struct { Filters map[string][]string Context context.Context @@ -42,9 +40,9 @@ type ListVolumesOptions struct { // ListVolumes returns a list of available volumes in the server. // -// See https://goo.gl/3wgTsd for more details. +// See https://goo.gl/FZA4BK for more details. func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error) { - resp, err := c.do(http.MethodGet, "/volumes?"+queryString(opts), doOptions{ + resp, err := c.do("GET", "/volumes?"+queryString(opts), doOptions{ context: opts.Context, }) if err != nil { @@ -72,7 +70,7 @@ func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error) { // CreateVolumeOptions specify parameters to the CreateVolume function. // -// See https://goo.gl/qEhmEC for more details. +// See https://goo.gl/pBUbZ9 for more details. type CreateVolumeOptions struct { Name string Driver string @@ -83,9 +81,9 @@ type CreateVolumeOptions struct { // CreateVolume creates a volume on the server. // -// See https://goo.gl/qEhmEC for more details. +// See https://goo.gl/pBUbZ9 for more details. func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error) { - resp, err := c.do(http.MethodPost, "/volumes/create", doOptions{ + resp, err := c.do("POST", "/volumes/create", doOptions{ data: opts, context: opts.Context, }) @@ -102,9 +100,9 @@ func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error) { // InspectVolume returns a volume by its name. // -// See https://goo.gl/GMjsMc for more details. +// See https://goo.gl/0g9A6i for more details. func (c *Client) InspectVolume(name string) (*Volume, error) { - resp, err := c.do(http.MethodGet, "/volumes/"+name, doOptions{}) + resp, err := c.do("GET", "/volumes/"+name, doOptions{}) if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return nil, ErrNoSuchVolume @@ -121,28 +119,9 @@ func (c *Client) InspectVolume(name string) (*Volume, error) { // RemoveVolume removes a volume by its name. // -// Deprecated: Use RemoveVolumeWithOptions instead. +// See https://goo.gl/79GNQz for more details. func (c *Client) RemoveVolume(name string) error { - return c.RemoveVolumeWithOptions(RemoveVolumeOptions{Name: name}) -} - -// RemoveVolumeOptions specify parameters to the RemoveVolumeWithOptions -// function. -// -// See https://goo.gl/nvd6qj for more details. -type RemoveVolumeOptions struct { - Context context.Context - Name string `qs:"-"` - Force bool -} - -// RemoveVolumeWithOptions removes a volume by its name and takes extra -// parameters. -// -// See https://goo.gl/nvd6qj for more details. -func (c *Client) RemoveVolumeWithOptions(opts RemoveVolumeOptions) error { - path := "/volumes/" + opts.Name - resp, err := c.do(http.MethodDelete, path+"?"+queryString(opts), doOptions{context: opts.Context}) + resp, err := c.do("DELETE", "/volumes/"+name, doOptions{}) if err != nil { if e, ok := err.(*Error); ok { if e.Status == http.StatusNotFound { @@ -152,7 +131,7 @@ func (c *Client) RemoveVolumeWithOptions(opts RemoveVolumeOptions) error { return ErrVolumeInUse } } - return err + return nil } defer resp.Body.Close() return nil @@ -160,7 +139,7 @@ func (c *Client) RemoveVolumeWithOptions(opts RemoveVolumeOptions) error { // PruneVolumesOptions specify parameters to the PruneVolumes function. // -// See https://goo.gl/f9XDem for more details. +// See https://goo.gl/pFN1Hj for more details. type PruneVolumesOptions struct { Filters map[string][]string Context context.Context @@ -168,7 +147,7 @@ type PruneVolumesOptions struct { // PruneVolumesResults specify results from the PruneVolumes function. // -// See https://goo.gl/f9XDem for more details. +// See https://goo.gl/pFN1Hj for more details. type PruneVolumesResults struct { VolumesDeleted []string SpaceReclaimed int64 @@ -176,10 +155,10 @@ type PruneVolumesResults struct { // PruneVolumes deletes volumes which are unused. // -// See https://goo.gl/f9XDem for more details. +// See https://goo.gl/pFN1Hj for more details. func (c *Client) PruneVolumes(opts PruneVolumesOptions) (*PruneVolumesResults, error) { path := "/volumes/prune?" + queryString(opts) - resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context}) + resp, err := c.do("POST", path, doOptions{context: opts.Context}) if err != nil { return nil, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/volume_test.go b/vendor/github.com/fsouza/go-dockerclient/volume_test.go index 366121e80b15..d042251a52dc 100644 --- a/vendor/github.com/fsouza/go-dockerclient/volume_test.go +++ b/vendor/github.com/fsouza/go-dockerclient/volume_test.go @@ -18,14 +18,12 @@ func TestListVolumes(t *testing.T) { { "Name": "tardis", "Driver": "local", - "Mountpoint": "/var/lib/docker/volumes/tardis", - "CreatedAt": "2017-07-19T12:00:26Z" + "Mountpoint": "/var/lib/docker/volumes/tardis" }, { "Name": "foo", "Driver": "bar", - "Mountpoint": "/var/lib/docker/volumes/bar", - "CreatedAt": "2017-07-19T12:01:26Z" + "Mountpoint": "/var/lib/docker/volumes/bar" } ]` body := `{ "Volumes": ` + volumesData + ` }` @@ -72,7 +70,7 @@ func TestCreateVolume(t *testing.T) { t.Errorf("CreateVolume: Wrong return value. Want %#v. Got %#v.", expected, volume) } req := fakeRT.requests[0] - expectedMethod := http.MethodPost + expectedMethod := "POST" if req.Method != expectedMethod { t.Errorf("CreateVolume(): Wrong HTTP method. Want %s. Got %s.", expectedMethod, req.Method) } @@ -87,10 +85,7 @@ func TestInspectVolume(t *testing.T) { body := `{ "Name": "tardis", "Driver": "local", - "Mountpoint": "/var/lib/docker/volumes/tardis", - "Options": { - "foo": "bar" - } + "Mountpoint": "/var/lib/docker/volumes/tardis" }` var expected Volume if err := json.Unmarshal([]byte(body), &expected); err != nil { @@ -107,7 +102,7 @@ func TestInspectVolume(t *testing.T) { t.Errorf("InspectVolume: Wrong return value. Want %#v. Got %#v.", expected, volume) } req := fakeRT.requests[0] - expectedMethod := http.MethodGet + expectedMethod := "GET" if req.Method != expectedMethod { t.Errorf("InspectVolume(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) } @@ -126,7 +121,7 @@ func TestRemoveVolume(t *testing.T) { t.Fatal(err) } req := fakeRT.requests[0] - expectedMethod := http.MethodDelete + expectedMethod := "DELETE" if req.Method != expectedMethod { t.Errorf("RemoveVolume(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) } @@ -136,28 +131,6 @@ func TestRemoveVolume(t *testing.T) { } } -func TestRemoveVolumeWithOptions(t *testing.T) { - t.Parallel() - name := "test" - fakeRT := &FakeRoundTripper{message: "", status: http.StatusNoContent} - client := newTestClient(fakeRT) - if err := client.RemoveVolumeWithOptions(RemoveVolumeOptions{ - Name: name, - Force: true, - }); err != nil { - t.Fatal(err) - } - req := fakeRT.requests[0] - expectedMethod := http.MethodDelete - if req.Method != expectedMethod { - t.Errorf("RemoveVolume(%q): Wrong HTTP method. Want %s. Got %s.", name, expectedMethod, req.Method) - } - u, _ := url.Parse(client.getURL("/volumes/" + name + "?force=1")) - if req.URL.RequestURI() != u.RequestURI() { - t.Errorf("RemoveVolume(%q): Wrong request path. Want %q. Got %q.", name, u.RequestURI(), req.URL.RequestURI()) - } -} - func TestRemoveVolumeNotFound(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "no such volume", status: http.StatusNotFound}) @@ -166,14 +139,6 @@ func TestRemoveVolumeNotFound(t *testing.T) { } } -func TestRemoveVolumeInternalError(t *testing.T) { - t.Parallel() - client := newTestClient(&FakeRoundTripper{message: "something went wrong", status: http.StatusInternalServerError}) - if err := client.RemoveVolume("test:test"); err == nil { - t.Error("RemoveVolume: unexpected error") - } -} - func TestRemoveVolumeInUse(t *testing.T) { t.Parallel() client := newTestClient(&FakeRoundTripper{message: "volume in use and cannot be removed", status: http.StatusConflict}) diff --git a/vendor/github.com/getsentry/raven-go/README.md b/vendor/github.com/getsentry/raven-go/README.md index 1fd829f5ba90..16c9483e8a2e 100644 --- a/vendor/github.com/getsentry/raven-go/README.md +++ b/vendor/github.com/getsentry/raven-go/README.md @@ -4,13 +4,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/getsentry/raven-go)](https://goreportcard.com/report/github.com/getsentry/raven-go) [![GoDoc](https://godoc.org/github.com/getsentry/raven-go?status.svg)](https://godoc.org/github.com/getsentry/raven-go) ---- - -> The `raven-go` SDK is no longer maintained and was superseded by the `sentry-go` SDK. -> Learn more about the project on [GitHub](https://github.com/getsentry/sentry-go) and check out the [migration guide](https://docs.sentry.io/platforms/go/migration/). - ---- - raven is the official Go SDK for the [Sentry](https://github.com/getsentry/sentry) event/error logging system. diff --git a/vendor/github.com/getsentry/raven-go/client.go b/vendor/github.com/getsentry/raven-go/client.go index aff398ca4368..7419a11693d9 100644 --- a/vendor/github.com/getsentry/raven-go/client.go +++ b/vendor/github.com/getsentry/raven-go/client.go @@ -643,11 +643,6 @@ func (client *Client) Capture(packet *Packet, captureTags map[string]string) (ev packet.Logger = defaultLoggerName } - // Set Severity if value is provided - if Severity(captureTags["level"]) != "" { - packet.Level = Severity(captureTags["level"]) - } - err := packet.Init(projectID) if err != nil { ch <- err @@ -1074,15 +1069,8 @@ func init() { // } // // If the error does not implement Cause, the original error will -// be returned. -// -// If the cause of the error is nil, then the original -// error will be returned. -// -// If the error is nil, nil will be returned without further +// be returned. If the error is nil, nil will be returned without further // investigation. -// -// Will return the deepest cause which is not nil. func Cause(err error) error { type causer interface { Cause() error @@ -1093,13 +1081,7 @@ func Cause(err error) error { if !ok { break } - - if _cause := cause.Cause(); _cause != nil { - err = _cause - } else { - break - } - + err = cause.Cause() } return err } diff --git a/vendor/github.com/getsentry/raven-go/client_test.go b/vendor/github.com/getsentry/raven-go/client_test.go index e766502141b0..9ff8b4e4f4f7 100644 --- a/vendor/github.com/getsentry/raven-go/client_test.go +++ b/vendor/github.com/getsentry/raven-go/client_test.go @@ -3,7 +3,6 @@ package raven import ( "encoding/json" "fmt" - pkgErrors "github.com/pkg/errors" "reflect" "testing" "time" @@ -287,41 +286,6 @@ func TestCaptureNilError(t *testing.T) { } } -// Custom error which implements causer -type customErr struct { - msg string - cause error -} - -func (e *customErr) Error() (errorMsg string) { - if e.msg != "" && e.cause != nil { - errorMsg = fmt.Sprintf("%v \n\t==>> %v", e.msg, e.cause) - } else if e.msg == "" && e.cause != nil { - errorMsg = fmt.Sprintf("%v", e.cause) - } else if e.msg != "" && e.cause == nil { - errorMsg = fmt.Sprintf("%s", e.msg) - } - return -} - -// Implementing the causer interface from github.com/pkg/errors -func (e *customErr) Cause() error { - return e.cause -} - -func TestCaptureNilCauseError(t *testing.T) { - var client = DefaultClient - err := pkgErrors.WithStack(&customErr{ - // Setting a nil cause - cause: nil, - msg: "This is a test", - }) - eventID := client.CaptureError(err, nil) - if eventID == "" { - t.Error("expected non-empty eventID:", eventID) - } -} - func TestNewPacketWithExtraSetsDefault(t *testing.T) { testCases := []struct { Extra Extra diff --git a/vendor/github.com/gonum/graph/.github/ISSUE_TEMPLATE.md b/vendor/github.com/gonum/graph/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 4719865119bd..000000000000 --- a/vendor/github.com/gonum/graph/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,4 +0,0 @@ -### This repository is no longer actively maintained. - -Development of the packages in this repository has moved to https://github.com/gonum/gonum. -Please file issues [there](https://github.com/gonum/gonum/issues) after having checked that your issue has not been fixed. diff --git a/vendor/github.com/gonum/graph/.github/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/gonum/graph/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index a5312f44858b..000000000000 --- a/vendor/github.com/gonum/graph/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,4 +0,0 @@ -### This repository is no longer actively maintained. - -Development of the packages in this repository has moved to https://github.com/gonum/gonum. -Please send pull requests [there](https://github.com/gonum/gonum/pulls) after having checked that your addition has not already been made. diff --git a/vendor/github.com/gonum/graph/README.md b/vendor/github.com/gonum/graph/README.md index b71b62ff851e..469a8f60cae5 100644 --- a/vendor/github.com/gonum/graph/README.md +++ b/vendor/github.com/gonum/graph/README.md @@ -1,14 +1,12 @@ # Gonum Graph [![Build Status](https://travis-ci.org/gonum/graph.svg?branch=master)](https://travis-ci.org/gonum/graph) [![Coverage Status](https://coveralls.io/repos/gonum/graph/badge.svg?branch=master&service=github)](https://coveralls.io/github/gonum/graph?branch=master) [![GoDoc](https://godoc.org/github.com/gonum/graph?status.svg)](https://godoc.org/github.com/gonum/graph) -# This repository is no longer maintained. Development has moved to https://github.com/gonum/gonum. - This is a generalized graph package for the Go language. It aims to provide a clean, transparent API for common algorithms on arbitrary graphs such as finding the graph's strongly connected components, dominators, or searces. The package is currently in testing, and the API is "semi-stable". The signatures of any functions like AStar are unlikely to change much, but the Graph, Node, and Edge interfaces may change a bit. ## Issues -If you find any bugs, feel free to file an issue on the github [issue tracker for gonum/gonum](https://github.com/gonum/gonum/issues) if the bug exists in that reposity; no code changes will be made to this repository. Other dicussions should be taken to the gonum-dev Google Group. +If you find any bugs, feel free to file an issue on the github issue tracker. Discussions on API changes, added features, code review, or similar requests are preferred on the Gonum-dev Google Group. https://groups.google.com/forum/#!forum/gonum-dev diff --git a/vendor/github.com/gonum/graph/community/louvain_common.go b/vendor/github.com/gonum/graph/community/louvain_common.go index 81d5e475aa01..e806096a0ee1 100644 --- a/vendor/github.com/gonum/graph/community/louvain_common.go +++ b/vendor/github.com/gonum/graph/community/louvain_common.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package community provides graph community detection functions. package community diff --git a/vendor/github.com/gonum/graph/doc.go b/vendor/github.com/gonum/graph/doc.go index fe75ec77cbaa..7b7b3cc8711e 100644 --- a/vendor/github.com/gonum/graph/doc.go +++ b/vendor/github.com/gonum/graph/doc.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. /* -This repository is no longer maintained. -Development has moved to https://github.com/gonum/gonum. - Package graph implements functions and interfaces to deal with formal discrete graphs. It aims to be first and foremost flexible, with speed as a strong second priority. diff --git a/vendor/github.com/gonum/graph/encoding/dot/dot.go b/vendor/github.com/gonum/graph/encoding/dot/dot.go index 7ce01e8ed908..7e3dc30c55a0 100644 --- a/vendor/github.com/gonum/graph/encoding/dot/dot.go +++ b/vendor/github.com/gonum/graph/encoding/dot/dot.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package dot implements GraphViz DOT marshaling of graphs. // // See the GraphViz DOT Guide and the DOT grammar for more information diff --git a/vendor/github.com/gonum/graph/ex/fdpclust/main.go b/vendor/github.com/gonum/graph/ex/fdpclust/main.go index d23dd2613dcd..78ad275f64fd 100644 --- a/vendor/github.com/gonum/graph/ex/fdpclust/main.go +++ b/vendor/github.com/gonum/graph/ex/fdpclust/main.go @@ -1,6 +1,3 @@ -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// package main import ( diff --git a/vendor/github.com/gonum/graph/formats/dot/ast/ast.go b/vendor/github.com/gonum/graph/formats/dot/ast/ast.go index 2d88258207d7..a8ac7bf83035 100644 --- a/vendor/github.com/gonum/graph/formats/dot/ast/ast.go +++ b/vendor/github.com/gonum/graph/formats/dot/ast/ast.go @@ -8,9 +8,6 @@ // This file is made available under a Creative Commons CC0 1.0 // Universal Public Domain Dedication. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package ast declares the types used to represent abstract syntax trees of // Graphviz DOT graphs. package ast diff --git a/vendor/github.com/gonum/graph/formats/dot/dot.go b/vendor/github.com/gonum/graph/formats/dot/dot.go index f23bb5c10243..890083b2593f 100644 --- a/vendor/github.com/gonum/graph/formats/dot/dot.go +++ b/vendor/github.com/gonum/graph/formats/dot/dot.go @@ -8,9 +8,6 @@ // This file is made available under a Creative Commons CC0 1.0 // Universal Public Domain Dedication. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package dot implements a parser for Graphviz DOT files. package dot diff --git a/vendor/github.com/gonum/graph/formats/dot/internal/astx/astx.go b/vendor/github.com/gonum/graph/formats/dot/internal/astx/astx.go index ccd54a6408c1..987124a082e8 100644 --- a/vendor/github.com/gonum/graph/formats/dot/internal/astx/astx.go +++ b/vendor/github.com/gonum/graph/formats/dot/internal/astx/astx.go @@ -8,9 +8,6 @@ // This file is made available under a Creative Commons CC0 1.0 // Universal Public Domain Dedication. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package astx implements utility functions for generating abstract syntax // trees of Graphviz DOT graphs. package astx diff --git a/vendor/github.com/gonum/graph/graphs/gen/gen.go b/vendor/github.com/gonum/graph/graphs/gen/gen.go index 28c9437178d2..33cb03d91f7b 100644 --- a/vendor/github.com/gonum/graph/graphs/gen/gen.go +++ b/vendor/github.com/gonum/graph/graphs/gen/gen.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package gen provides random graph generation functions. package gen diff --git a/vendor/github.com/gonum/graph/internal/linear/linear.go b/vendor/github.com/gonum/graph/internal/linear/linear.go index 690a7e02b8bd..532226bb5f1e 100644 --- a/vendor/github.com/gonum/graph/internal/linear/linear.go +++ b/vendor/github.com/gonum/graph/internal/linear/linear.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package linear provides common linear data structures. package linear diff --git a/vendor/github.com/gonum/graph/internal/ordered/sort.go b/vendor/github.com/gonum/graph/internal/ordered/sort.go index af488bdfcf42..8cc9657e3e4f 100644 --- a/vendor/github.com/gonum/graph/internal/ordered/sort.go +++ b/vendor/github.com/gonum/graph/internal/ordered/sort.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package ordered provides common sort ordering types. package ordered diff --git a/vendor/github.com/gonum/graph/internal/set/set.go b/vendor/github.com/gonum/graph/internal/set/set.go index 36f52a7700d9..f2a01ea40a12 100644 --- a/vendor/github.com/gonum/graph/internal/set/set.go +++ b/vendor/github.com/gonum/graph/internal/set/set.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package set provides integer and graph.Node sets. package set diff --git a/vendor/github.com/gonum/graph/network/network.go b/vendor/github.com/gonum/graph/network/network.go index 18b950428ea8..f0ead5bc22da 100644 --- a/vendor/github.com/gonum/graph/network/network.go +++ b/vendor/github.com/gonum/graph/network/network.go @@ -10,8 +10,5 @@ // http://www.vldb.org/pvldb/vol7/p1023-maehara.pdf // * other centrality measures -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package network provides network analysis functions. package network diff --git a/vendor/github.com/gonum/graph/path/doc.go b/vendor/github.com/gonum/graph/path/doc.go index 152467a2be9a..2a86fed04aa9 100644 --- a/vendor/github.com/gonum/graph/path/doc.go +++ b/vendor/github.com/gonum/graph/path/doc.go @@ -2,8 +2,5 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package path provides graph path finding functions. package path diff --git a/vendor/github.com/gonum/graph/path/dynamic/doc.go b/vendor/github.com/gonum/graph/path/dynamic/doc.go index 37fbdff03e1f..597bd9567d66 100644 --- a/vendor/github.com/gonum/graph/path/dynamic/doc.go +++ b/vendor/github.com/gonum/graph/path/dynamic/doc.go @@ -2,8 +2,5 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package dynamic provides incremental heuristic graph path finding functions. package dynamic diff --git a/vendor/github.com/gonum/graph/path/internal/grid.go b/vendor/github.com/gonum/graph/path/internal/grid.go index b2148a21cce7..8122ebf36dad 100644 --- a/vendor/github.com/gonum/graph/path/internal/grid.go +++ b/vendor/github.com/gonum/graph/path/internal/grid.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// package internal import ( diff --git a/vendor/github.com/gonum/graph/simple/simple.go b/vendor/github.com/gonum/graph/simple/simple.go index 1b493be98982..ab9fff0b8334 100644 --- a/vendor/github.com/gonum/graph/simple/simple.go +++ b/vendor/github.com/gonum/graph/simple/simple.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package simple provides a suite of simple graph implementations satisfying // the gonum/graph interfaces. package simple diff --git a/vendor/github.com/gonum/graph/topo/topo.go b/vendor/github.com/gonum/graph/topo/topo.go index af36d216f3f1..23568bb7b5a2 100644 --- a/vendor/github.com/gonum/graph/topo/topo.go +++ b/vendor/github.com/gonum/graph/topo/topo.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package topo provides graph topology analysis functions. package topo diff --git a/vendor/github.com/gonum/graph/traverse/traverse.go b/vendor/github.com/gonum/graph/traverse/traverse.go index fc5f7a6d14f4..6a351b07149e 100644 --- a/vendor/github.com/gonum/graph/traverse/traverse.go +++ b/vendor/github.com/gonum/graph/traverse/traverse.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This repository is no longer maintained. -// Development has moved to https://github.com/gonum/gonum. -// // Package traverse provides basic graph traversal primitives. package traverse diff --git a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index a6b96d88fdfd..b732937cdfa3 100644 --- a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -258,7 +258,7 @@ func Fail(message string, callerSkip ...int) { skip = callerSkip[0] } - globalFailer.Fail(message, codelocation.New(skip+1)) + globalFailer.Fail(message, codelocation.NewWithStack(skip+1)) panic(GINKGO_PANIC) } @@ -275,7 +275,7 @@ func Fail(message string, callerSkip ...int) { func GinkgoRecover() { e := recover() if e != nil { - globalFailer.Panic(codelocation.New(1), e) + globalFailer.Panic(codelocation.NewWithStack(1), e) } } diff --git a/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go b/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go index 92ba5d69c714..9a98e3fe7831 100644 --- a/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go +++ b/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go @@ -3,6 +3,7 @@ package codelocation import ( "regexp" "runtime" + "runtime/debug" "strings" "github.com/onsi/ginkgo/types" @@ -13,6 +14,12 @@ func New(skip int) types.CodeLocation { return types.CodeLocation{FileName: file, LineNumber: line} } +func NewWithStack(skip int) types.CodeLocation { + _, file, line, _ := runtime.Caller(skip + 1) + stackTrace := PruneStack(string(debug.Stack()), skip) + return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace} +} + func PruneStack(fullStackTrace string, skip int) string { stack := strings.Split(fullStackTrace, "\n") if len(stack) > 2*(skip+1) { diff --git a/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go b/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go index 16cb66c3e492..5b9390528217 100644 --- a/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go +++ b/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go @@ -73,7 +73,7 @@ func (r *runner) runAsync() (outcome types.SpecState, failure types.SpecFailure) defer func() { if e := recover(); e != nil || !finished { - r.failer.Panic(codelocation.New(2), e) + r.failer.Panic(codelocation.NewWithStack(2), e) select { case <-done: break @@ -104,7 +104,7 @@ func (r *runner) runSync() (outcome types.SpecState, failure types.SpecFailure) defer func() { if e := recover(); e != nil || !finished { - r.failer.Panic(codelocation.New(2), e) + r.failer.Panic(codelocation.NewWithStack(2), e) } failure, outcome = r.failer.Drain(r.nodeType, r.componentIndex, r.codeLocation) diff --git a/vendor/github.com/openshift/api/README.md b/vendor/github.com/openshift/api/README.md index aacb32bc0e7e..60a7e0d7db5d 100644 --- a/vendor/github.com/openshift/api/README.md +++ b/vendor/github.com/openshift/api/README.md @@ -34,16 +34,16 @@ Then do the following with your openshift/origin pull request: Since Kubernetes 1.16, every CRD created in `apiextensions.k8s.io/v1` is required to have a [structural OpenAPIV3 schema](https://kubernetes.io/blog/2019/06/20/crd-structural-schema/). The schemas provide server-side validation for fields, as well as providing the descriptions for `oc explain`. Moreover, schemas ensure structural consistency of data in etcd. Without it anything can be stored in a resource which can have security implications. As we host many of our CRDs in this repo along with their corresponding Go types we also require them to have schemas. However, the following instructions apply for CRDs that are not hosted here as well. -These schemas are often very long and complex, and should not be written by hand. For OpenShift, we provide Makefile targets in [library-go's alpha-build-machinery](https://github.com/openshift/library-go/tree/master/alpha-build-machinery) which generate the schema, built on upstream's [controller-gen](https://github.com/kubernetes-sigs/controller-tools) tool. +These schemas are often very long and complex, and should not be written by hand. For OpenShift, we provide Makefile targets in [build-machinery-go](https://github.com/openshift/build-machinery-go/) which generate the schema, built on upstream's [controller-gen](https://github.com/kubernetes-sigs/controller-tools) tool. If you make a change to a CRD type in this repo, simply calling `make update-codegen-crds` should regenerate all CRDs and update the manifests. If yours is not updated, ensure that the path to its API is included in our [calls to the Makefile targets](https://github.com/openshift/api/blob/release-4.5/Makefile#L17-L29). To add this generator to another repo: -1. Vendor `github.com/openshift/library-go` (and ensure that the `alpha-build-machinery` subdirectory is also included in your `vendor`) +1. Vendor `github.com/openshift/build-machinery-go` 2. Update your `Makefile` to include the following: ``` -include $(addprefix ./vendor/github.com/openshift/library-go/alpha-build-machinery/make/, \ +include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ targets/openshift/crd-schema-gen.mk \ ) diff --git a/vendor/github.com/openshift/api/build/v1/types.go b/vendor/github.com/openshift/api/build/v1/types.go index feb17f658f2e..eeb29e9d0938 100644 --- a/vendor/github.com/openshift/api/build/v1/types.go +++ b/vendor/github.com/openshift/api/build/v1/types.go @@ -35,7 +35,7 @@ type BuildSpec struct { // triggeredBy describes which triggers started the most recent update to the // build configuration and contains information about those triggers. - TriggeredBy []BuildTriggerCause `json:"triggeredBy" protobuf:"bytes,2,rep,name=triggeredBy"` + TriggeredBy []BuildTriggerCause `json:"triggeredBy,omitempty" protobuf:"bytes,2,rep,name=triggeredBy"` } // OptionalNodeSelector is a map that may also be left nil to distinguish between set and unset. @@ -464,13 +464,13 @@ type ImageSource struct { // does not reference an image source it is ignored. This field and paths may both be set, in which case // the contents will be used twice. // +optional - As []string `json:"as" protobuf:"bytes,4,rep,name=as"` + As []string `json:"as,omitempty" protobuf:"bytes,4,rep,name=as"` // paths is a list of source and destination paths to copy from the image. This content will be copied // into the build context prior to starting the build. If no paths are set, the build context will // not be altered. // +optional - Paths []ImageSourcePath `json:"paths" protobuf:"bytes,2,rep,name=paths"` + Paths []ImageSourcePath `json:"paths,omitempty" protobuf:"bytes,2,rep,name=paths"` // pullSecret is a reference to a secret to be used to pull the image from a registry // If the image is pulled from the OpenShift registry, this field does not need to be set. @@ -1165,7 +1165,7 @@ type BuildRequest struct { // triggeredBy describes which triggers started the most recent update to the // build configuration and contains information about those triggers. - TriggeredBy []BuildTriggerCause `json:"triggeredBy" protobuf:"bytes,8,rep,name=triggeredBy"` + TriggeredBy []BuildTriggerCause `json:"triggeredBy,omitempty" protobuf:"bytes,8,rep,name=triggeredBy"` // DockerStrategyOptions contains additional docker-strategy specific options for the build DockerStrategyOptions *DockerStrategyOptions `json:"dockerStrategyOptions,omitempty" protobuf:"bytes,9,opt,name=dockerStrategyOptions"` diff --git a/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_authentication.crd.yaml b/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_authentication.crd.yaml index bb95918d9dad..0fbf020bd81a 100644 --- a/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_authentication.crd.yaml +++ b/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_authentication.crd.yaml @@ -64,7 +64,7 @@ spec: type: string serviceAccountIssuer: description: serviceAccountIssuer is the identifier of the bound service - account token issuer. The default is auth.openshift.io. + account token issuer. The default is https://kubernetes.default.svc type: string type: description: type identifies the cluster managed, user facing authentication diff --git a/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_infrastructure.crd.yaml b/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_infrastructure.crd.yaml index 076ff0ad77a0..35e38f10377d 100644 --- a/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_infrastructure.crd.yaml +++ b/vendor/github.com/openshift/api/config/v1/0000_10_config-operator_01_infrastructure.crd.yaml @@ -11,6 +11,8 @@ spec: singular: infrastructure scope: Cluster preserveUnknownFields: false + subresources: + status: {} versions: - name: v1 served: true @@ -40,11 +42,18 @@ spec: type: object properties: cloudConfig: - description: cloudConfig is a reference to a ConfigMap containing the + description: "cloudConfig is a reference to a ConfigMap containing the cloud provider configuration file. This configuration file is used to configure the Kubernetes cloud provider integration when using the built-in cloud provider integration or the external cloud controller - manager. The namespace for this config map is openshift-config. + manager. The namespace for this config map is openshift-config. \n + cloudConfig should only be consumed by the kube_cloud_config controller. + The controller is responsible for using the user configuration in + the spec for various platforms and combining that with the user provided + ConfigMap in this field to create a stitched kube cloud config. The + controller generates a ConfigMap `kube-cloud-config` in `openshift-config-managed` + namespace with the kube cloud config is stored in `cloud.conf` key. + All the clients are expected to use the generated ConfigMap only." type: object properties: key: @@ -53,6 +62,89 @@ spec: type: string name: type: string + platformSpec: + description: platformSpec holds desired information specific to the + underlying infrastructure provider. + type: object + properties: + aws: + description: AWS contains settings specific to the Amazon Web Services + infrastructure provider. + type: object + properties: + serviceEndpoints: + description: serviceEndpoints list contains custom endpoints + which will override default service endpoint of AWS Services. + There must be only one ServiceEndpoint for a service. + type: array + items: + description: AWSServiceEndpoint store the configuration of + a custom url to override existing defaults of AWS Services. + type: object + properties: + name: + description: name is the name of the AWS service. The + list of all the service names can be found at https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html + This must be provided and cannot be empty. + type: string + pattern: ^[a-z0-9-]+$ + url: + description: url is fully qualified URI with scheme https, + that overrides the default generated endpoint for a + client. This must be provided and cannot be empty. + type: string + pattern: ^https:// + azure: + description: Azure contains settings specific to the Azure infrastructure + provider. + type: object + baremetal: + description: BareMetal contains settings specific to the BareMetal + platform. + type: object + gcp: + description: GCP contains settings specific to the Google Cloud + Platform infrastructure provider. + type: object + ibmcloud: + description: IBMCloud contains settings specific to the IBMCloud + infrastructure provider. + type: object + openstack: + description: OpenStack contains settings specific to the OpenStack + infrastructure provider. + type: object + ovirt: + description: Ovirt contains settings specific to the oVirt infrastructure + provider. + type: object + type: + description: type is the underlying infrastructure provider for + the cluster. This value controls whether infrastructure automation + such as service load balancers, dynamic volume provisioning, machine + creation and deletion, and other integrations are enabled. If + None, no infrastructure automation is enabled. Allowed values + are "AWS", "Azure", "BareMetal", "GCP", "Libvirt", "OpenStack", + "VSphere", "oVirt", and "None". Individual components may not + support all platforms, and must handle unrecognized platforms + as None if they do not support that platform. + type: string + enum: + - "" + - AWS + - Azure + - BareMetal + - GCP + - Libvirt + - OpenStack + - None + - VSphere + - oVirt + - IBMCloud + vsphere: + description: VSphere contains settings specific to the VSphere infrastructure + provider. + type: object status: description: status holds observed values from the cluster. They may not be overridden. @@ -82,6 +174,18 @@ spec: description: "platform is the underlying infrastructure provider for the cluster. \n Deprecated: Use platformStatus.type instead." type: string + enum: + - "" + - AWS + - Azure + - BareMetal + - GCP + - Libvirt + - OpenStack + - None + - VSphere + - oVirt + - IBMCloud platformStatus: description: platformStatus holds status information specific to the underlying infrastructure provider. @@ -96,6 +200,28 @@ spec: description: region holds the default AWS region for new AWS resources created by the cluster. type: string + serviceEndpoints: + description: ServiceEndpoints list contains custom endpoints + which will override default service endpoint of AWS Services. + There must be only one ServiceEndpoint for a service. + type: array + items: + description: AWSServiceEndpoint store the configuration of + a custom url to override existing defaults of AWS Services. + type: object + properties: + name: + description: name is the name of the AWS service. The + list of all the service names can be found at https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html + This must be provided and cannot be empty. + type: string + pattern: ^[a-z0-9-]+$ + url: + description: url is fully qualified URI with scheme https, + that overrides the default generated endpoint for a + client. This must be provided and cannot be empty. + type: string + pattern: ^https:// azure: description: Azure contains settings specific to the Azure infrastructure provider. @@ -225,16 +351,30 @@ spec: to the nodes in the cluster. type: string type: - description: type is the underlying infrastructure provider for + description: "type is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values - are "AWS", "Azure", "BareMetal", "GCP", "Libvirt", "OpenStack", - "VSphere", "oVirt", and "None". Individual components may not - support all platforms, and must handle unrecognized platforms - as None if they do not support that platform. + are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", + \"VSphere\", \"oVirt\", and \"None\". Individual components may + not support all platforms, and must handle unrecognized platforms + as None if they do not support that platform. \n This value will + be synced with to the `status.platform` and `status.platformStatus.type`. + Currently this value cannot be changed once set." type: string + enum: + - "" + - AWS + - Azure + - BareMetal + - GCP + - Libvirt + - OpenStack + - None + - VSphere + - oVirt + - IBMCloud vsphere: description: VSphere contains settings specific to the VSphere infrastructure provider. diff --git a/vendor/github.com/openshift/api/config/v1/types_authentication.go b/vendor/github.com/openshift/api/config/v1/types_authentication.go index df2cdf2b9aee..4f87bd5219d7 100644 --- a/vendor/github.com/openshift/api/config/v1/types_authentication.go +++ b/vendor/github.com/openshift/api/config/v1/types_authentication.go @@ -53,7 +53,7 @@ type AuthenticationSpec struct { // serviceAccountIssuer is the identifier of the bound service account token // issuer. - // The default is auth.openshift.io. + // The default is https://kubernetes.default.svc // +optional ServiceAccountIssuer string `json:"serviceAccountIssuer"` } diff --git a/vendor/github.com/openshift/api/config/v1/types_feature.go b/vendor/github.com/openshift/api/config/v1/types_feature.go index ce9012627290..8bbed607774b 100644 --- a/vendor/github.com/openshift/api/config/v1/types_feature.go +++ b/vendor/github.com/openshift/api/config/v1/types_feature.go @@ -112,6 +112,7 @@ var FeatureSets = map[FeatureSet]*FeatureGateEnabledDisabled{ var defaultFeatures = &FeatureGateEnabledDisabled{ Enabled: []string{ + "APIPriorityAndFairness", // sig-apimachinery, deads2k "RotateKubeletServerCertificate", // sig-pod, sjenning "SupportPodPidsLimit", // sig-pod, sjenning "NodeDisruptionExclusion", // sig-scheduling, ccoleman diff --git a/vendor/github.com/openshift/api/config/v1/types_features_test.go b/vendor/github.com/openshift/api/config/v1/types_features_test.go index 2ba34d7ff895..ddd71857417c 100644 --- a/vendor/github.com/openshift/api/config/v1/types_features_test.go +++ b/vendor/github.com/openshift/api/config/v1/types_features_test.go @@ -21,6 +21,7 @@ func TestFeatureBuilder(t *testing.T) { actual: newDefaultFeatures().without("SCTPSupport").toFeatures(), expected: &FeatureGateEnabledDisabled{ Enabled: []string{ + "APIPriorityAndFairness", "RotateKubeletServerCertificate", "SupportPodPidsLimit", "NodeDisruptionExclusion", @@ -37,6 +38,7 @@ func TestFeatureBuilder(t *testing.T) { actual: newDefaultFeatures().with("LegacyNodeRoleBehavior").toFeatures(), expected: &FeatureGateEnabledDisabled{ Enabled: []string{ + "APIPriorityAndFairness", "RotateKubeletServerCertificate", "SupportPodPidsLimit", "NodeDisruptionExclusion", @@ -52,6 +54,7 @@ func TestFeatureBuilder(t *testing.T) { actual: newDefaultFeatures().without("SCTPSupport", "other").toFeatures(), expected: &FeatureGateEnabledDisabled{ Enabled: []string{ + "APIPriorityAndFairness", "RotateKubeletServerCertificate", "SupportPodPidsLimit", "NodeDisruptionExclusion", @@ -69,6 +72,7 @@ func TestFeatureBuilder(t *testing.T) { actual: newDefaultFeatures().with("LegacyNodeRoleBehavior", "other").toFeatures(), expected: &FeatureGateEnabledDisabled{ Enabled: []string{ + "APIPriorityAndFairness", "RotateKubeletServerCertificate", "SupportPodPidsLimit", "NodeDisruptionExclusion", diff --git a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go index 8ca323df0273..baa5af379738 100644 --- a/vendor/github.com/openshift/api/config/v1/types_infrastructure.go +++ b/vendor/github.com/openshift/api/config/v1/types_infrastructure.go @@ -5,6 +5,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:subresource:status // Infrastructure holds cluster-wide information about Infrastructure. The canonical name is `cluster` type Infrastructure struct { @@ -26,8 +27,21 @@ type InfrastructureSpec struct { // This configuration file is used to configure the Kubernetes cloud provider integration // when using the built-in cloud provider integration or the external cloud controller manager. // The namespace for this config map is openshift-config. + // + // cloudConfig should only be consumed by the kube_cloud_config controller. + // The controller is responsible for using the user configuration in the spec + // for various platforms and combining that with the user provided ConfigMap in this field + // to create a stitched kube cloud config. + // The controller generates a ConfigMap `kube-cloud-config` in `openshift-config-managed` namespace + // with the kube cloud config is stored in `cloud.conf` key. + // All the clients are expected to use the generated ConfigMap only. + // // +optional CloudConfig ConfigMapFileReference `json:"cloudConfig"` + + // platformSpec holds desired information specific to the underlying + // infrastructure provider. + PlatformSpec PlatformSpec `json:"platformSpec,omitempty"` } // InfrastructureStatus describes the infrastructure the cluster is leveraging. @@ -65,6 +79,7 @@ type InfrastructureStatus struct { } // PlatformType is a specific supported infrastructure provider. +// +kubebuilder:validation:Enum="";AWS;Azure;BareMetal;GCP;Libvirt;OpenStack;None;VSphere;oVirt;IBMCloud type PlatformType string const ( @@ -110,6 +125,55 @@ const ( IBMCloudProviderTypeVPC IBMCloudProviderType = "VPC" ) +// PlatformSpec holds the desired state specific to the underlying infrastructure provider +// of the current cluster. Since these are used at spec-level for the underlying cluster, it +// is supposed that only one of the spec structs is set. +type PlatformSpec struct { + // type is the underlying infrastructure provider for the cluster. This + // value controls whether infrastructure automation such as service load + // balancers, dynamic volume provisioning, machine creation and deletion, and + // other integrations are enabled. If None, no infrastructure automation is + // enabled. Allowed values are "AWS", "Azure", "BareMetal", "GCP", "Libvirt", + // "OpenStack", "VSphere", "oVirt", and "None". Individual components may not support + // all platforms, and must handle unrecognized platforms as None if they do + // not support that platform. + // + // +unionDiscriminator + Type PlatformType `json:"type"` + + // AWS contains settings specific to the Amazon Web Services infrastructure provider. + // +optional + AWS *AWSPlatformSpec `json:"aws,omitempty"` + + // Azure contains settings specific to the Azure infrastructure provider. + // +optional + Azure *AzurePlatformSpec `json:"azure,omitempty"` + + // GCP contains settings specific to the Google Cloud Platform infrastructure provider. + // +optional + GCP *GCPPlatformSpec `json:"gcp,omitempty"` + + // BareMetal contains settings specific to the BareMetal platform. + // +optional + BareMetal *BareMetalPlatformSpec `json:"baremetal,omitempty"` + + // OpenStack contains settings specific to the OpenStack infrastructure provider. + // +optional + OpenStack *OpenStackPlatformSpec `json:"openstack,omitempty"` + + // Ovirt contains settings specific to the oVirt infrastructure provider. + // +optional + Ovirt *OvirtPlatformSpec `json:"ovirt,omitempty"` + + // VSphere contains settings specific to the VSphere infrastructure provider. + // +optional + VSphere *VSpherePlatformSpec `json:"vsphere,omitempty"` + + // IBMCloud contains settings specific to the IBMCloud infrastructure provider. + // +optional + IBMCloud *IBMCloudPlatformSpec `json:"ibmcloud,omitempty"` +} + // PlatformStatus holds the current status specific to the underlying infrastructure provider // of the current cluster. Since these are used at status-level for the underlying cluster, it // is supposed that only one of the status structs is set. @@ -122,6 +186,9 @@ type PlatformStatus struct { // "OpenStack", "VSphere", "oVirt", and "None". Individual components may not support // all platforms, and must handle unrecognized platforms as None if they do // not support that platform. + // + // This value will be synced with to the `status.platform` and `status.platformStatus.type`. + // Currently this value cannot be changed once set. Type PlatformType `json:"type"` // AWS contains settings specific to the Amazon Web Services infrastructure provider. @@ -157,12 +224,50 @@ type PlatformStatus struct { IBMCloud *IBMCloudPlatformStatus `json:"ibmcloud,omitempty"` } +// AWSServiceEndpoint store the configuration of a custom url to +// override existing defaults of AWS Services. +type AWSServiceEndpoint struct { + // name is the name of the AWS service. + // The list of all the service names can be found at https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html + // This must be provided and cannot be empty. + // + // +kubebuilder:validation:Pattern=`^[a-z0-9-]+$` + Name string `json:"name"` + + // url is fully qualified URI with scheme https, that overrides the default generated + // endpoint for a client. + // This must be provided and cannot be empty. + // + // +kubebuilder:validation:Pattern=`^https://` + URL string `json:"url"` +} + +// AWSPlatformSpec holds the desired state of the Amazon Web Services infrastructure provider. +// This only includes fields that can be modified in the cluster. +type AWSPlatformSpec struct { + // serviceEndpoints list contains custom endpoints which will override default + // service endpoint of AWS Services. + // There must be only one ServiceEndpoint for a service. + // +optional + ServiceEndpoints []AWSServiceEndpoint `json:"serviceEndpoints,omitempty"` +} + // AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider. type AWSPlatformStatus struct { // region holds the default AWS region for new AWS resources created by the cluster. Region string `json:"region"` + + // ServiceEndpoints list contains custom endpoints which will override default + // service endpoint of AWS Services. + // There must be only one ServiceEndpoint for a service. + // +optional + ServiceEndpoints []AWSServiceEndpoint `json:"serviceEndpoints,omitempty"` } +// AzurePlatformSpec holds the desired state of the Azure infrastructure provider. +// This only includes fields that can be modified in the cluster. +type AzurePlatformSpec struct{} + // AzurePlatformStatus holds the current status of the Azure infrastructure provider. type AzurePlatformStatus struct { // resourceGroupName is the Resource Group for new Azure resources created for the cluster. @@ -174,6 +279,10 @@ type AzurePlatformStatus struct { NetworkResourceGroupName string `json:"networkResourceGroupName,omitempty"` } +// GCPPlatformSpec holds the desired state of the Google Cloud Platform infrastructure provider. +// This only includes fields that can be modified in the cluster. +type GCPPlatformSpec struct{} + // GCPPlatformStatus holds the current status of the Google Cloud Platform infrastructure provider. type GCPPlatformStatus struct { // resourceGroupName is the Project ID for new GCP resources created for the cluster. @@ -183,6 +292,10 @@ type GCPPlatformStatus struct { Region string `json:"region"` } +// BareMetalPlatformSpec holds the desired state of the BareMetal infrastructure provider. +// This only includes fields that can be modified in the cluster. +type BareMetalPlatformSpec struct{} + // BareMetalPlatformStatus holds the current status of the BareMetal infrastructure provider. // For more information about the network architecture used with the BareMetal platform type, see: // https://github.com/openshift/installer/blob/master/docs/design/baremetal/networking-infrastructure.md @@ -206,6 +319,10 @@ type BareMetalPlatformStatus struct { NodeDNSIP string `json:"nodeDNSIP,omitempty"` } +// OpenStackPlatformSpec holds the desired state of the OpenStack infrastructure provider. +// This only includes fields that can be modified in the cluster. +type OpenStackPlatformSpec struct{} + // OpenStackPlatformStatus holds the current status of the OpenStack infrastructure provider. type OpenStackPlatformStatus struct { // apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used @@ -231,6 +348,10 @@ type OpenStackPlatformStatus struct { NodeDNSIP string `json:"nodeDNSIP,omitempty"` } +// OvirtPlatformSpec holds the desired state of the oVirt infrastructure provider. +// This only includes fields that can be modified in the cluster. +type OvirtPlatformSpec struct{} + // OvirtPlatformStatus holds the current status of the oVirt infrastructure provider. type OvirtPlatformStatus struct { // apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used @@ -252,6 +373,10 @@ type OvirtPlatformStatus struct { NodeDNSIP string `json:"nodeDNSIP,omitempty"` } +// VSpherePlatformSpec holds the desired state of the vSphere infrastructure provider. +// This only includes fields that can be modified in the cluster. +type VSpherePlatformSpec struct{} + // VSpherePlatformStatus holds the current status of the vSphere infrastructure provider. type VSpherePlatformStatus struct { // apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used @@ -273,6 +398,10 @@ type VSpherePlatformStatus struct { NodeDNSIP string `json:"nodeDNSIP,omitempty"` } +// IBMCloudPlatformSpec holds the desired state of the IBMCloud infrastructure provider. +// This only includes fields that can be modified in the cluster. +type IBMCloudPlatformSpec struct{} + //IBMCloudPlatformStatus holds the current status of the IBMCloud infrastructure provider. type IBMCloudPlatformStatus struct { // Location is where the cluster has been deployed diff --git a/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go index 4b666fe2df6a..1403ca3b26f3 100644 --- a/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/api/config/v1/zz_generated.deepcopy.go @@ -176,9 +176,35 @@ func (in *APIServerStatus) DeepCopy() *APIServerStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlatformSpec) DeepCopyInto(out *AWSPlatformSpec) { + *out = *in + if in.ServiceEndpoints != nil { + in, out := &in.ServiceEndpoints, &out.ServiceEndpoints + *out = make([]AWSServiceEndpoint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlatformSpec. +func (in *AWSPlatformSpec) DeepCopy() *AWSPlatformSpec { + if in == nil { + return nil + } + out := new(AWSPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AWSPlatformStatus) DeepCopyInto(out *AWSPlatformStatus) { *out = *in + if in.ServiceEndpoints != nil { + in, out := &in.ServiceEndpoints, &out.ServiceEndpoints + *out = make([]AWSServiceEndpoint, len(*in)) + copy(*out, *in) + } return } @@ -192,6 +218,22 @@ func (in *AWSPlatformStatus) DeepCopy() *AWSPlatformStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSServiceEndpoint) DeepCopyInto(out *AWSServiceEndpoint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSServiceEndpoint. +func (in *AWSServiceEndpoint) DeepCopy() *AWSServiceEndpoint { + if in == nil { + return nil + } + out := new(AWSServiceEndpoint) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AdmissionConfig) DeepCopyInto(out *AdmissionConfig) { *out = *in @@ -359,6 +401,22 @@ func (in *AuthenticationStatus) DeepCopy() *AuthenticationStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzurePlatformSpec) DeepCopyInto(out *AzurePlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzurePlatformSpec. +func (in *AzurePlatformSpec) DeepCopy() *AzurePlatformSpec { + if in == nil { + return nil + } + out := new(AzurePlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzurePlatformStatus) DeepCopyInto(out *AzurePlatformStatus) { *out = *in @@ -375,6 +433,22 @@ func (in *AzurePlatformStatus) DeepCopy() *AzurePlatformStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BareMetalPlatformSpec) DeepCopyInto(out *BareMetalPlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BareMetalPlatformSpec. +func (in *BareMetalPlatformSpec) DeepCopy() *BareMetalPlatformSpec { + if in == nil { + return nil + } + out := new(BareMetalPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BareMetalPlatformStatus) DeepCopyInto(out *BareMetalPlatformStatus) { *out = *in @@ -1451,6 +1525,22 @@ func (in *FeatureGateStatus) DeepCopy() *FeatureGateStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPPlatformSpec) DeepCopyInto(out *GCPPlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPPlatformSpec. +func (in *GCPPlatformSpec) DeepCopy() *GCPPlatformSpec { + if in == nil { + return nil + } + out := new(GCPPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCPPlatformStatus) DeepCopyInto(out *GCPPlatformStatus) { *out = *in @@ -1643,6 +1733,22 @@ func (in *HubSourceStatus) DeepCopy() *HubSourceStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IBMCloudPlatformSpec) DeepCopyInto(out *IBMCloudPlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMCloudPlatformSpec. +func (in *IBMCloudPlatformSpec) DeepCopy() *IBMCloudPlatformSpec { + if in == nil { + return nil + } + out := new(IBMCloudPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IBMCloudPlatformStatus) DeepCopyInto(out *IBMCloudPlatformStatus) { *out = *in @@ -1868,7 +1974,7 @@ func (in *Infrastructure) DeepCopyInto(out *Infrastructure) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } @@ -1928,6 +2034,7 @@ func (in *InfrastructureList) DeepCopyObject() runtime.Object { func (in *InfrastructureSpec) DeepCopyInto(out *InfrastructureSpec) { *out = *in out.CloudConfig = in.CloudConfig + in.PlatformSpec.DeepCopyInto(&out.PlatformSpec) return } @@ -2569,6 +2676,22 @@ func (in *OpenIDIdentityProvider) DeepCopy() *OpenIDIdentityProvider { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenStackPlatformSpec) DeepCopyInto(out *OpenStackPlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackPlatformSpec. +func (in *OpenStackPlatformSpec) DeepCopy() *OpenStackPlatformSpec { + if in == nil { + return nil + } + out := new(OpenStackPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpenStackPlatformStatus) DeepCopyInto(out *OpenStackPlatformStatus) { *out = *in @@ -2704,6 +2827,22 @@ func (in *OperatorHubStatus) DeepCopy() *OperatorHubStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OvirtPlatformSpec) DeepCopyInto(out *OvirtPlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OvirtPlatformSpec. +func (in *OvirtPlatformSpec) DeepCopy() *OvirtPlatformSpec { + if in == nil { + return nil + } + out := new(OvirtPlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OvirtPlatformStatus) DeepCopyInto(out *OvirtPlatformStatus) { *out = *in @@ -2720,13 +2859,69 @@ func (in *OvirtPlatformStatus) DeepCopy() *OvirtPlatformStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformSpec) DeepCopyInto(out *PlatformSpec) { + *out = *in + if in.AWS != nil { + in, out := &in.AWS, &out.AWS + *out = new(AWSPlatformSpec) + (*in).DeepCopyInto(*out) + } + if in.Azure != nil { + in, out := &in.Azure, &out.Azure + *out = new(AzurePlatformSpec) + **out = **in + } + if in.GCP != nil { + in, out := &in.GCP, &out.GCP + *out = new(GCPPlatformSpec) + **out = **in + } + if in.BareMetal != nil { + in, out := &in.BareMetal, &out.BareMetal + *out = new(BareMetalPlatformSpec) + **out = **in + } + if in.OpenStack != nil { + in, out := &in.OpenStack, &out.OpenStack + *out = new(OpenStackPlatformSpec) + **out = **in + } + if in.Ovirt != nil { + in, out := &in.Ovirt, &out.Ovirt + *out = new(OvirtPlatformSpec) + **out = **in + } + if in.VSphere != nil { + in, out := &in.VSphere, &out.VSphere + *out = new(VSpherePlatformSpec) + **out = **in + } + if in.IBMCloud != nil { + in, out := &in.IBMCloud, &out.IBMCloud + *out = new(IBMCloudPlatformSpec) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformSpec. +func (in *PlatformSpec) DeepCopy() *PlatformSpec { + if in == nil { + return nil + } + out := new(PlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PlatformStatus) DeepCopyInto(out *PlatformStatus) { *out = *in if in.AWS != nil { in, out := &in.AWS, &out.AWS *out = new(AWSPlatformStatus) - **out = **in + (*in).DeepCopyInto(*out) } if in.Azure != nil { in, out := &in.Azure, &out.Azure @@ -3373,6 +3568,22 @@ func (in *UpdateHistory) DeepCopy() *UpdateHistory { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VSpherePlatformSpec) DeepCopyInto(out *VSpherePlatformSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VSpherePlatformSpec. +func (in *VSpherePlatformSpec) DeepCopy() *VSpherePlatformSpec { + if in == nil { + return nil + } + out := new(VSpherePlatformSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VSpherePlatformStatus) DeepCopyInto(out *VSpherePlatformStatus) { *out = *in diff --git a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go index 7a46ba489056..1b850ea5b44d 100644 --- a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go @@ -303,7 +303,7 @@ var map_AuthenticationSpec = map[string]string{ "type": "type identifies the cluster managed, user facing authentication mode in use. Specifically, it manages the component that responds to login attempts. The default is IntegratedOAuth.", "oauthMetadata": "oauthMetadata contains the discovery endpoint data for OAuth 2.0 Authorization Server Metadata for an external OAuth server. This discovery document can be viewed from its served location: oc get --raw '/.well-known/oauth-authorization-server' For further details, see the IETF Draft: https://tools.ietf.org/html/draft-ietf-oauth-discovery-04#section-2 If oauthMetadata.name is non-empty, this value has precedence over any metadata reference stored in status. The key \"oauthMetadata\" is used to locate the data. If specified and the config map or expected key is not found, no metadata is served. If the specified metadata is not valid, no metadata is served. The namespace for this config map is openshift-config.", "webhookTokenAuthenticators": "webhookTokenAuthenticators configures remote token reviewers. These remote authentication webhooks can be used to verify bearer tokens via the tokenreviews.authentication.k8s.io REST API. This is required to honor bearer tokens that are provisioned by an external authentication service. The namespace for these secrets is openshift-config.", - "serviceAccountIssuer": "serviceAccountIssuer is the identifier of the bound service account token issuer. The default is auth.openshift.io.", + "serviceAccountIssuer": "serviceAccountIssuer is the identifier of the bound service account token issuer. The default is https://kubernetes.default.svc", } func (AuthenticationSpec) SwaggerDoc() map[string]string { @@ -677,15 +677,43 @@ func (RegistrySources) SwaggerDoc() map[string]string { return map_RegistrySources } +var map_AWSPlatformSpec = map[string]string{ + "": "AWSPlatformSpec holds the desired state of the Amazon Web Services infrastructure provider. This only includes fields that can be modified in the cluster.", + "serviceEndpoints": "serviceEndpoints list contains custom endpoints which will override default service endpoint of AWS Services. There must be only one ServiceEndpoint for a service.", +} + +func (AWSPlatformSpec) SwaggerDoc() map[string]string { + return map_AWSPlatformSpec +} + var map_AWSPlatformStatus = map[string]string{ - "": "AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider.", - "region": "region holds the default AWS region for new AWS resources created by the cluster.", + "": "AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider.", + "region": "region holds the default AWS region for new AWS resources created by the cluster.", + "serviceEndpoints": "ServiceEndpoints list contains custom endpoints which will override default service endpoint of AWS Services. There must be only one ServiceEndpoint for a service.", } func (AWSPlatformStatus) SwaggerDoc() map[string]string { return map_AWSPlatformStatus } +var map_AWSServiceEndpoint = map[string]string{ + "": "AWSServiceEndpoint store the configuration of a custom url to override existing defaults of AWS Services.", + "name": "name is the name of the AWS service. The list of all the service names can be found at https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html This must be provided and cannot be empty.", + "url": "url is fully qualified URI with scheme https, that overrides the default generated endpoint for a client. This must be provided and cannot be empty.", +} + +func (AWSServiceEndpoint) SwaggerDoc() map[string]string { + return map_AWSServiceEndpoint +} + +var map_AzurePlatformSpec = map[string]string{ + "": "AzurePlatformSpec holds the desired state of the Azure infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (AzurePlatformSpec) SwaggerDoc() map[string]string { + return map_AzurePlatformSpec +} + var map_AzurePlatformStatus = map[string]string{ "": "AzurePlatformStatus holds the current status of the Azure infrastructure provider.", "resourceGroupName": "resourceGroupName is the Resource Group for new Azure resources created for the cluster.", @@ -696,6 +724,14 @@ func (AzurePlatformStatus) SwaggerDoc() map[string]string { return map_AzurePlatformStatus } +var map_BareMetalPlatformSpec = map[string]string{ + "": "BareMetalPlatformSpec holds the desired state of the BareMetal infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (BareMetalPlatformSpec) SwaggerDoc() map[string]string { + return map_BareMetalPlatformSpec +} + var map_BareMetalPlatformStatus = map[string]string{ "": "BareMetalPlatformStatus holds the current status of the BareMetal infrastructure provider. For more information about the network architecture used with the BareMetal platform type, see: https://github.com/openshift/installer/blob/master/docs/design/baremetal/networking-infrastructure.md", "apiServerInternalIP": "apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used by components inside the cluster, like kubelets using the infrastructure rather than Kubernetes networking. It is the IP that the Infrastructure.status.apiServerInternalURI points to. It is the IP for a self-hosted load balancer in front of the API servers.", @@ -707,6 +743,14 @@ func (BareMetalPlatformStatus) SwaggerDoc() map[string]string { return map_BareMetalPlatformStatus } +var map_GCPPlatformSpec = map[string]string{ + "": "GCPPlatformSpec holds the desired state of the Google Cloud Platform infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (GCPPlatformSpec) SwaggerDoc() map[string]string { + return map_GCPPlatformSpec +} + var map_GCPPlatformStatus = map[string]string{ "": "GCPPlatformStatus holds the current status of the Google Cloud Platform infrastructure provider.", "projectID": "resourceGroupName is the Project ID for new GCP resources created for the cluster.", @@ -717,6 +761,14 @@ func (GCPPlatformStatus) SwaggerDoc() map[string]string { return map_GCPPlatformStatus } +var map_IBMCloudPlatformSpec = map[string]string{ + "": "IBMCloudPlatformSpec holds the desired state of the IBMCloud infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (IBMCloudPlatformSpec) SwaggerDoc() map[string]string { + return map_IBMCloudPlatformSpec +} + var map_IBMCloudPlatformStatus = map[string]string{ "": "IBMCloudPlatformStatus holds the current status of the IBMCloud infrastructure provider.", "location": "Location is where the cluster has been deployed", @@ -747,8 +799,9 @@ func (InfrastructureList) SwaggerDoc() map[string]string { } var map_InfrastructureSpec = map[string]string{ - "": "InfrastructureSpec contains settings that apply to the cluster infrastructure.", - "cloudConfig": "cloudConfig is a reference to a ConfigMap containing the cloud provider configuration file. This configuration file is used to configure the Kubernetes cloud provider integration when using the built-in cloud provider integration or the external cloud controller manager. The namespace for this config map is openshift-config.", + "": "InfrastructureSpec contains settings that apply to the cluster infrastructure.", + "cloudConfig": "cloudConfig is a reference to a ConfigMap containing the cloud provider configuration file. This configuration file is used to configure the Kubernetes cloud provider integration when using the built-in cloud provider integration or the external cloud controller manager. The namespace for this config map is openshift-config.\n\ncloudConfig should only be consumed by the kube_cloud_config controller. The controller is responsible for using the user configuration in the spec for various platforms and combining that with the user provided ConfigMap in this field to create a stitched kube cloud config. The controller generates a ConfigMap `kube-cloud-config` in `openshift-config-managed` namespace with the kube cloud config is stored in `cloud.conf` key. All the clients are expected to use the generated ConfigMap only.", + "platformSpec": "platformSpec holds desired information specific to the underlying infrastructure provider.", } func (InfrastructureSpec) SwaggerDoc() map[string]string { @@ -769,6 +822,14 @@ func (InfrastructureStatus) SwaggerDoc() map[string]string { return map_InfrastructureStatus } +var map_OpenStackPlatformSpec = map[string]string{ + "": "OpenStackPlatformSpec holds the desired state of the OpenStack infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (OpenStackPlatformSpec) SwaggerDoc() map[string]string { + return map_OpenStackPlatformSpec +} + var map_OpenStackPlatformStatus = map[string]string{ "": "OpenStackPlatformStatus holds the current status of the OpenStack infrastructure provider.", "apiServerInternalIP": "apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used by components inside the cluster, like kubelets using the infrastructure rather than Kubernetes networking. It is the IP that the Infrastructure.status.apiServerInternalURI points to. It is the IP for a self-hosted load balancer in front of the API servers.", @@ -781,6 +842,14 @@ func (OpenStackPlatformStatus) SwaggerDoc() map[string]string { return map_OpenStackPlatformStatus } +var map_OvirtPlatformSpec = map[string]string{ + "": "OvirtPlatformSpec holds the desired state of the oVirt infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (OvirtPlatformSpec) SwaggerDoc() map[string]string { + return map_OvirtPlatformSpec +} + var map_OvirtPlatformStatus = map[string]string{ "": "OvirtPlatformStatus holds the current status of the oVirt infrastructure provider.", "apiServerInternalIP": "apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used by components inside the cluster, like kubelets using the infrastructure rather than Kubernetes networking. It is the IP that the Infrastructure.status.apiServerInternalURI points to. It is the IP for a self-hosted load balancer in front of the API servers.", @@ -792,9 +861,26 @@ func (OvirtPlatformStatus) SwaggerDoc() map[string]string { return map_OvirtPlatformStatus } +var map_PlatformSpec = map[string]string{ + "": "PlatformSpec holds the desired state specific to the underlying infrastructure provider of the current cluster. Since these are used at spec-level for the underlying cluster, it is supposed that only one of the spec structs is set.", + "type": "type is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", \"VSphere\", \"oVirt\", and \"None\". Individual components may not support all platforms, and must handle unrecognized platforms as None if they do not support that platform.", + "aws": "AWS contains settings specific to the Amazon Web Services infrastructure provider.", + "azure": "Azure contains settings specific to the Azure infrastructure provider.", + "gcp": "GCP contains settings specific to the Google Cloud Platform infrastructure provider.", + "baremetal": "BareMetal contains settings specific to the BareMetal platform.", + "openstack": "OpenStack contains settings specific to the OpenStack infrastructure provider.", + "ovirt": "Ovirt contains settings specific to the oVirt infrastructure provider.", + "vsphere": "VSphere contains settings specific to the VSphere infrastructure provider.", + "ibmcloud": "IBMCloud contains settings specific to the IBMCloud infrastructure provider.", +} + +func (PlatformSpec) SwaggerDoc() map[string]string { + return map_PlatformSpec +} + var map_PlatformStatus = map[string]string{ "": "PlatformStatus holds the current status specific to the underlying infrastructure provider of the current cluster. Since these are used at status-level for the underlying cluster, it is supposed that only one of the status structs is set.", - "type": "type is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", \"VSphere\", \"oVirt\", and \"None\". Individual components may not support all platforms, and must handle unrecognized platforms as None if they do not support that platform.", + "type": "type is the underlying infrastructure provider for the cluster. This value controls whether infrastructure automation such as service load balancers, dynamic volume provisioning, machine creation and deletion, and other integrations are enabled. If None, no infrastructure automation is enabled. Allowed values are \"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\", \"OpenStack\", \"VSphere\", \"oVirt\", and \"None\". Individual components may not support all platforms, and must handle unrecognized platforms as None if they do not support that platform.\n\nThis value will be synced with to the `status.platform` and `status.platformStatus.type`. Currently this value cannot be changed once set.", "aws": "AWS contains settings specific to the Amazon Web Services infrastructure provider.", "azure": "Azure contains settings specific to the Azure infrastructure provider.", "gcp": "GCP contains settings specific to the Google Cloud Platform infrastructure provider.", @@ -809,6 +895,14 @@ func (PlatformStatus) SwaggerDoc() map[string]string { return map_PlatformStatus } +var map_VSpherePlatformSpec = map[string]string{ + "": "VSpherePlatformSpec holds the desired state of the vSphere infrastructure provider. This only includes fields that can be modified in the cluster.", +} + +func (VSpherePlatformSpec) SwaggerDoc() map[string]string { + return map_VSpherePlatformSpec +} + var map_VSpherePlatformStatus = map[string]string{ "": "VSpherePlatformStatus holds the current status of the vSphere infrastructure provider.", "apiServerInternalIP": "apiServerInternalIP is an IP address to contact the Kubernetes API server that can be used by components inside the cluster, like kubelets using the infrastructure rather than Kubernetes networking. It is the IP that the Infrastructure.status.apiServerInternalURI points to. It is the IP for a self-hosted load balancer in front of the API servers.", diff --git a/vendor/github.com/openshift/api/go.mod b/vendor/github.com/openshift/api/go.mod index 17212dd25c70..c52b7da9e0e4 100644 --- a/vendor/github.com/openshift/api/go.mod +++ b/vendor/github.com/openshift/api/go.mod @@ -8,8 +8,8 @@ require ( github.com/spf13/pflag v1.0.5 golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect golang.org/x/tools v0.0.0-20200115044656-831fdb1e1868 // indirect - k8s.io/api v0.18.0 - k8s.io/apimachinery v0.18.0 - k8s.io/code-generator v0.18.0 + k8s.io/api v0.18.2 + k8s.io/apimachinery v0.18.2 + k8s.io/code-generator v0.18.2 k8s.io/klog v1.0.0 ) diff --git a/vendor/github.com/openshift/api/go.sum b/vendor/github.com/openshift/api/go.sum index 023a7789a0fc..2189914076fc 100644 --- a/vendor/github.com/openshift/api/go.sum +++ b/vendor/github.com/openshift/api/go.sum @@ -144,12 +144,12 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= -k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= -k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= -k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= -k8s.io/code-generator v0.18.0 h1:0xIRWzym+qMgVpGmLESDeMfz/orwgxwxFFAo1xfGNtQ= -k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= +k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= +k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= +k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/code-generator v0.18.2 h1:C1Nn2JiMf244CvBDKVPX0W2mZFJkVBg54T8OV7/Imso= +k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= diff --git a/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml b/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml similarity index 87% rename from vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml rename to vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml index 2d17132bebfc..66648561f082 100644 --- a/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml +++ b/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml @@ -10,8 +10,8 @@ spec: listKind: IngressControllerList plural: ingresscontrollers singular: ingresscontroller - scope: "" preserveUnknownFields: false + scope: "" subresources: scale: labelSelectorPath: .status.selector @@ -29,7 +29,6 @@ spec: may be rolled out. \n https://kubernetes.io/docs/concepts/services-networking/ingress-controllers \n Whenever possible, sensible defaults for the platform are used. See each field for more details." - type: object properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -45,7 +44,6 @@ spec: type: object spec: description: spec is the specification of the desired behavior of the IngressController. - type: object properties: defaultCertificate: description: "defaultCertificate is a reference to a secret containing @@ -59,12 +57,12 @@ spec: cluster's trust store. \n The in-use certificate (whether generated or user-specified) will be automatically integrated with OpenShift's built-in OAuth server." - type: object properties: name: description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' type: string + type: object domain: description: "domain is a DNS name serviced by the ingress controller and is used to configure multiple features: \n * For the LoadBalancerService @@ -87,9 +85,6 @@ spec: (with External scope) Libvirt: HostNetwork \n Any other platform types (including None) default to HostNetwork. \n endpointPublishingStrategy cannot be updated." - type: object - required: - - type properties: hostNetwork: description: hostNetwork holds parameters for the HostNetwork endpoint @@ -98,17 +93,17 @@ spec: loadBalancer: description: loadBalancer holds parameters for the load balancer. Present only if type is LoadBalancerService. - type: object - required: - - scope properties: scope: description: scope indicates the scope at which the load balancer is exposed. Possible values are "External" and "Internal". - type: string enum: - Internal - External + type: string + required: + - scope + type: object nodePort: description: nodePort holds parameters for the NodePortService endpoint publishing strategy. Present only if type is NodePortService. @@ -145,29 +140,132 @@ spec: by OpenShift; however, to support static port allocations, user changes to the node port field of the managed NodePort Service will preserved." - type: string enum: - LoadBalancerService - HostNetwork - Private - NodePortService + type: string + required: + - type + type: object + logging: + description: logging defines parameters for what should be logged where. If + this field is empty, operational logs are enabled but access logs + are disabled. + properties: + access: + description: "access describes how the client requests should be + logged. \n If this field is empty, access logging is disabled." + properties: + destination: + description: destination is where access logs go. + properties: + container: + description: container holds parameters for the Container + logging destination. Present only if type is Container. + type: object + syslog: + description: syslog holds parameters for a syslog endpoint. Present + only if type is Syslog. + oneOf: + - properties: + address: + format: ipv4 + - properties: + address: + format: ipv6 + properties: + address: + description: address is the IP address of the syslog + endpoint that receives log messages. + type: string + facility: + description: "facility specifies the syslog facility + of log messages. \n If this field is empty, the facility + is \"local1\"." + enum: + - kern + - user + - mail + - daemon + - auth + - syslog + - lpr + - news + - uucp + - cron + - auth2 + - ftp + - ntp + - audit + - alert + - cron2 + - local0 + - local1 + - local2 + - local3 + - local4 + - local5 + - local6 + - local7 + type: string + port: + description: port is the UDP port number of the syslog + endpoint that receives log messages. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - address + - port + type: object + type: + description: "type is the type of destination for logs. + \ It must be one of the following: \n * Container \n The + ingress operator configures the sidecar container named + \"logs\" on the ingress controller pod and configures + the ingress controller to write logs to the sidecar. The + logs are then available as container logs. The expectation + is that the administrator configures a custom logging + solution that reads logs from this sidecar. Note that + using container logs means that logs may be dropped if + the rate of logs exceeds the container runtime's or the + custom logging solution's capacity. \n * Syslog \n Logs + are sent to a syslog endpoint. The administrator must + specify an endpoint that can receive syslog messages. + \ The expectation is that the administrator has configured + a custom syslog instance." + enum: + - Container + - Syslog + type: string + required: + - type + type: object + httpLogFormat: + description: "httpLogFormat specifies the format of the log + message for an HTTP request. \n If this field is empty, log + messages use the implementation's default HTTP log format. + \ For HAProxy's default HTTP log format, see the HAProxy documentation: + http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3" + type: string + required: + - destination + type: object + type: object namespaceSelector: description: "namespaceSelector is used to filter the set of namespaces serviced by the ingress controller. This is useful for implementing shards. \n If unset, the default is no filtering." - type: object properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - type: array items: description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - type: object - required: - - key - - operator properties: key: description: key is the label key that the selector applies @@ -184,43 +282,42 @@ spec: operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - type: array items: type: string + type: array + required: + - key + - operator + type: object + type: array matchLabels: + additionalProperties: + type: string description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. type: object - additionalProperties: - type: string + type: object nodePlacement: description: "nodePlacement enables explicit control over the scheduling of the ingress controller. \n If unset, defaults are used. See NodePlacement for more details." - type: object properties: nodeSelector: description: "nodeSelector is the node selector applied to ingress controller deployments. \n If unset, the default is: \n beta.kubernetes.io/os: linux node-role.kubernetes.io/worker: '' \n If set, the specified selector is used and replaces the default." - type: object properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - type: array items: description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - type: object - required: - - key - - operator properties: key: description: key is the label key that the selector applies @@ -237,28 +334,32 @@ spec: If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - type: array items: type: string + type: array + required: + - key + - operator + type: object + type: array matchLabels: + additionalProperties: + type: string description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. type: object - additionalProperties: - type: string + type: object tolerations: description: "tolerations is a list of tolerations applied to ingress controller deployments. \n The default is an empty list. \n See https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/" - type: array items: description: The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . - type: object properties: effect: description: Effect indicates the taint effect to match. Empty @@ -284,24 +385,26 @@ spec: it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. - type: integer format: int64 + type: integer value: description: Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string. type: string + type: object + type: array + type: object replicas: description: replicas is the desired number of ingress controller replicas. If unset, defaults to 2. - type: integer format: int32 + type: integer routeAdmission: description: "routeAdmission defines a policy for handling new route claims (for example, to allow or deny claims across namespaces). \n If empty, defaults will be applied. See specific routeAdmission fields for details about their defaults." - type: object properties: namespaceOwnership: description: "namespaceOwnership describes how host name claims @@ -310,10 +413,10 @@ spec: the same host. \n - InterNamespaceAllowed: Allow routes to claim different paths of the same host name across namespaces. \n If empty, the default is Strict." - type: string enum: - InterNamespaceAllowed - Strict + type: string wildcardPolicy: description: "wildcardPolicy describes how routes with wildcard policies should be handled for the ingress controller. WildcardPolicy @@ -325,27 +428,22 @@ spec: of None to be readmitted by the ingress controller. \n WildcardPolicy supports WildcardsAllowed and WildcardsDisallowed values. \n If empty, defaults to \"WildcardsDisallowed\"." - type: string enum: - WildcardsAllowed - WildcardsDisallowed + type: string + type: object routeSelector: description: "routeSelector is used to filter the set of Routes serviced by the ingress controller. This is useful for implementing shards. \n If unset, the default is no filtering." - type: object properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - type: array items: description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - type: object - required: - - key - - operator properties: key: description: key is the label key that the selector applies @@ -362,18 +460,24 @@ spec: operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - type: array items: type: string + type: array + required: + - key + - operator + type: object + type: array matchLabels: + additionalProperties: + type: string description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. type: object - additionalProperties: - type: string + type: object tlsSecurityProfile: description: "tlsSecurityProfile specifies settings for TLS connections for ingresscontrollers. \n If unset, the default is based on the apiservers.config.openshift.io/cluster @@ -386,7 +490,6 @@ spec: controllers is 1.1, and the maximum TLS version is 1.2. An implication of this restriction is that the Modern TLS profile type cannot be used because it requires TLS 1.3." - type: object properties: custom: description: "custom is a user-defined TLS security profile. Be @@ -395,29 +498,29 @@ spec: \n ciphers: - ECDHE-ECDSA-CHACHA20-POLY1305 - ECDHE-RSA-CHACHA20-POLY1305 \ - ECDHE-RSA-AES128-GCM-SHA256 - ECDHE-ECDSA-AES128-GCM-SHA256 \ minTLSVersion: TLSv1.1" - type: object + nullable: true properties: ciphers: description: "ciphers is used to specify the cipher algorithms that are negotiated during the TLS handshake. Operators may remove entries their operands do not support. For example, to use DES-CBC3-SHA (yaml): \n ciphers: - DES-CBC3-SHA" - type: array items: type: string + type: array minTLSVersion: description: "minTLSVersion is used to specify the minimal version of the TLS protocol that is negotiated during the TLS handshake. For example, to use TLS versions 1.1, 1.2 and 1.3 (yaml): \n minTLSVersion: TLSv1.1 \n NOTE: currently the highest minTLSVersion allowed is VersionTLS12" - type: string enum: - VersionTLS10 - VersionTLS11 - VersionTLS12 - VersionTLS13 - nullable: true + type: string + type: object intermediate: description: "intermediate is a TLS security profile based on: \n https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29 @@ -428,15 +531,15 @@ spec: \ - ECDHE-ECDSA-CHACHA20-POLY1305 - ECDHE-RSA-CHACHA20-POLY1305 \ - DHE-RSA-AES128-GCM-SHA256 - DHE-RSA-AES256-GCM-SHA384 \ minTLSVersion: TLSv1.2" - type: object nullable: true + type: object modern: description: "modern is a TLS security profile based on: \n https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility \n and looks like this (yaml): \n ciphers: - TLS_AES_128_GCM_SHA256 \ - TLS_AES_256_GCM_SHA384 - TLS_CHACHA20_POLY1305_SHA256 \ minTLSVersion: TLSv1.3 \n NOTE: Currently unsupported." - type: object nullable: true + type: object old: description: "old is a TLS security profile based on: \n https://wiki.mozilla.org/Security/Server_Side_TLS#Old_backward_compatibility \n and looks like this (yaml): \n ciphers: - TLS_AES_128_GCM_SHA256 @@ -453,8 +556,8 @@ spec: \ - AES256-GCM-SHA384 - AES128-SHA256 - AES256-SHA256 \ - AES128-SHA - AES256-SHA - DES-CBC3-SHA minTLSVersion: TLSv1.0" - type: object nullable: true + type: object type: description: "type is one of Old, Intermediate, Modern or Custom. Custom provides the ability to specify individual TLS security @@ -466,21 +569,22 @@ spec: to a process, the list may be reduced. \n Note that the Modern profile is currently not supported because it is not yet well adopted by common software libraries." - type: string enum: - Old - Intermediate - Modern - Custom + type: string + type: object + type: object status: description: status is the most recently observed status of the IngressController. - type: object properties: availableReplicas: description: availableReplicas is number of observed available replicas according to the ingress controller deployment. - type: integer format: int32 + type: integer conditions: description: "conditions is a list of conditions and their status. \n Available means the ingress controller deployment is available and @@ -500,14 +604,12 @@ spec: DNSReady - True if the following conditions are met: * DNS is managed. * DNS records have been successfully created. - False if any of those conditions are unsatisfied." - type: array items: description: OperatorCondition is just the standard condition fields. - type: object properties: lastTransitionTime: - type: string format: date-time + type: string message: type: string reason: @@ -516,14 +618,13 @@ spec: type: string type: type: string + type: object + type: array domain: description: domain is the actual domain in use. type: string endpointPublishingStrategy: description: endpointPublishingStrategy is the actual strategy in use. - type: object - required: - - type properties: hostNetwork: description: hostNetwork holds parameters for the HostNetwork endpoint @@ -532,17 +633,17 @@ spec: loadBalancer: description: loadBalancer holds parameters for the load balancer. Present only if type is LoadBalancerService. - type: object - required: - - scope properties: scope: description: scope indicates the scope at which the load balancer is exposed. Possible values are "External" and "Internal". - type: string enum: - Internal - External + type: string + required: + - scope + type: object nodePort: description: nodePort holds parameters for the NodePortService endpoint publishing strategy. Present only if type is NodePortService. @@ -579,16 +680,19 @@ spec: by OpenShift; however, to support static port allocations, user changes to the node port field of the managed NodePort Service will preserved." - type: string enum: - LoadBalancerService - HostNetwork - Private - NodePortService + type: string + required: + - type + type: object observedGeneration: description: observedGeneration is the most recent generation observed. - type: integer format: int64 + type: integer selector: description: selector is a label selector, in string format, for ingress controller pods corresponding to the IngressController. The number @@ -597,28 +701,30 @@ spec: tlsProfile: description: tlsProfile is the TLS connection configuration that is in effect. - type: object properties: ciphers: description: "ciphers is used to specify the cipher algorithms that are negotiated during the TLS handshake. Operators may remove entries their operands do not support. For example, to use DES-CBC3-SHA \ (yaml): \n ciphers: - DES-CBC3-SHA" - type: array items: type: string + type: array minTLSVersion: description: "minTLSVersion is used to specify the minimal version of the TLS protocol that is negotiated during the TLS handshake. For example, to use TLS versions 1.1, 1.2 and 1.3 (yaml): \n minTLSVersion: TLSv1.1 \n NOTE: currently the highest minTLSVersion allowed is VersionTLS12" - type: string enum: - VersionTLS10 - VersionTLS11 - VersionTLS12 - VersionTLS13 + type: string + type: object + type: object + type: object version: v1 versions: - name: v1 diff --git a/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml-merge-patch b/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml-merge-patch new file mode 100644 index 000000000000..0439275bc309 --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml-merge-patch @@ -0,0 +1,20 @@ +spec: + validation: + openAPIV3Schema: + properties: + spec: + properties: + logging: + properties: + access: + properties: + destination: + properties: + syslog: + oneOf: + - properties: + address: + format: ipv4 + - properties: + address: + format: ipv6 diff --git a/vendor/github.com/openshift/api/operator/v1/types_ingress.go b/vendor/github.com/openshift/api/operator/v1/types_ingress.go index 9ebe913df793..f49bc433df43 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_ingress.go +++ b/vendor/github.com/openshift/api/operator/v1/types_ingress.go @@ -155,6 +155,13 @@ type IngressControllerSpec struct { // // +optional RouteAdmission *RouteAdmissionPolicy `json:"routeAdmission,omitempty"` + + // logging defines parameters for what should be logged where. If this + // field is empty, operational logs are enabled but access logs are + // disabled. + // + // +optional + Logging *IngressControllerLogging `json:"logging,omitempty"` } // NodePlacement describes node scheduling configuration for an ingress @@ -382,6 +389,130 @@ const ( StrictNamespaceOwnershipCheck NamespaceOwnershipCheck = "Strict" ) +// LoggingDestinationType is a type of destination to which to send log +// messages. +// +// +kubebuilder:validation:Enum=Container;Syslog +type LoggingDestinationType string + +const ( + // Container sends log messages to a sidecar container. + ContainerLoggingDestinationType LoggingDestinationType = "Container" + + // Syslog sends log messages to a syslog endpoint. + SyslogLoggingDestinationType LoggingDestinationType = "Syslog" + + // ContainerLoggingSidecarContainerName is the name of the container + // with the log output in an ingress controller pod when container + // logging is used. + ContainerLoggingSidecarContainerName = "logs" +) + +// SyslogLoggingDestinationParameters describes parameters for the Syslog +// logging destination type. +type SyslogLoggingDestinationParameters struct { + // address is the IP address of the syslog endpoint that receives log + // messages. + // + // +kubebuilder:validation:Required + // +required + Address string `json:"address"` + + // port is the UDP port number of the syslog endpoint that receives log + // messages. + // + // +kubebuilder:validation:Required + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=65535 + // +required + Port uint32 `json:"port"` + + // facility specifies the syslog facility of log messages. + // + // If this field is empty, the facility is "local1". + // + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=kern;user;mail;daemon;auth;syslog;lpr;news;uucp;cron;auth2;ftp;ntp;audit;alert;cron2;local0;local1;local2;local3;local4;local5;local6;local7 + // +optional + Facility string `json:"facility,omitempty"` +} + +// ContainerLoggingDestinationParameters describes parameters for the Container +// logging destination type. +type ContainerLoggingDestinationParameters struct { +} + +// LoggingDestination describes a destination for log messages. +// +union +type LoggingDestination struct { + // type is the type of destination for logs. It must be one of the + // following: + // + // * Container + // + // The ingress operator configures the sidecar container named "logs" on + // the ingress controller pod and configures the ingress controller to + // write logs to the sidecar. The logs are then available as container + // logs. The expectation is that the administrator configures a custom + // logging solution that reads logs from this sidecar. Note that using + // container logs means that logs may be dropped if the rate of logs + // exceeds the container runtime's or the custom logging solution's + // capacity. + // + // * Syslog + // + // Logs are sent to a syslog endpoint. The administrator must specify + // an endpoint that can receive syslog messages. The expectation is + // that the administrator has configured a custom syslog instance. + // + // +unionDiscriminator + // +kubebuilder:validation:Required + // +required + Type LoggingDestinationType `json:"type"` + + // syslog holds parameters for a syslog endpoint. Present only if + // type is Syslog. + // + // +optional + Syslog *SyslogLoggingDestinationParameters `json:"syslog,omitempty"` + + // container holds parameters for the Container logging destination. + // Present only if type is Container. + // + // +optional + Container *ContainerLoggingDestinationParameters `json:"container,omitempty"` +} + +// AccessLogging describes how client requests should be logged. +type AccessLogging struct { + // destination is where access logs go. + // + // +kubebuilder:validation:Required + // +required + Destination LoggingDestination `json:"destination"` + + // httpLogFormat specifies the format of the log message for an HTTP + // request. + // + // If this field is empty, log messages use the implementation's default + // HTTP log format. For HAProxy's default HTTP log format, see the + // HAProxy documentation: + // http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3 + // + // +optional + HttpLogFormat string `json:"httpLogFormat,omitempty"` +} + +// IngressControllerLogging describes what should be logged where. +type IngressControllerLogging struct { + // access describes how the client requests should be logged. + // + // If this field is empty, access logging is disabled. + // + // +optional + Access *AccessLogging `json:"access,omitempty"` +} + var ( // Available indicates the ingress controller deployment is available. IngressControllerAvailableConditionType = "Available" diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift/api/operator/v1/zz_generated.deepcopy.go index 12db4239e3b8..e27bc5158bb0 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.deepcopy.go @@ -11,6 +11,23 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AccessLogging) DeepCopyInto(out *AccessLogging) { + *out = *in + in.Destination.DeepCopyInto(&out.Destination) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessLogging. +func (in *AccessLogging) DeepCopy() *AccessLogging { + if in == nil { + return nil + } + out := new(AccessLogging) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AdditionalNetworkDefinition) DeepCopyInto(out *AdditionalNetworkDefinition) { *out = *in @@ -487,6 +504,22 @@ func (in *ConsoleStatus) DeepCopy() *ConsoleStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerLoggingDestinationParameters) DeepCopyInto(out *ContainerLoggingDestinationParameters) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerLoggingDestinationParameters. +func (in *ContainerLoggingDestinationParameters) DeepCopy() *ContainerLoggingDestinationParameters { + if in == nil { + return nil + } + out := new(ContainerLoggingDestinationParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DNS) DeepCopyInto(out *DNS) { *out = *in @@ -912,6 +945,27 @@ func (in *IngressControllerList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IngressControllerLogging) DeepCopyInto(out *IngressControllerLogging) { + *out = *in + if in.Access != nil { + in, out := &in.Access, &out.Access + *out = new(AccessLogging) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressControllerLogging. +func (in *IngressControllerLogging) DeepCopy() *IngressControllerLogging { + if in == nil { + return nil + } + out := new(IngressControllerLogging) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IngressControllerSpec) DeepCopyInto(out *IngressControllerSpec) { *out = *in @@ -955,6 +1009,11 @@ func (in *IngressControllerSpec) DeepCopyInto(out *IngressControllerSpec) { *out = new(RouteAdmissionPolicy) **out = **in } + if in.Logging != nil { + in, out := &in.Logging, &out.Logging + *out = new(IngressControllerLogging) + (*in).DeepCopyInto(*out) + } return } @@ -1428,6 +1487,32 @@ func (in *LoadBalancerStrategy) DeepCopy() *LoadBalancerStrategy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingDestination) DeepCopyInto(out *LoggingDestination) { + *out = *in + if in.Syslog != nil { + in, out := &in.Syslog, &out.Syslog + *out = new(SyslogLoggingDestinationParameters) + **out = **in + } + if in.Container != nil { + in, out := &in.Container, &out.Container + *out = new(ContainerLoggingDestinationParameters) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingDestination. +func (in *LoggingDestination) DeepCopy() *LoggingDestination { + if in == nil { + return nil + } + out := new(LoggingDestination) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MyOperatorResource) DeepCopyInto(out *MyOperatorResource) { *out = *in @@ -2565,3 +2650,19 @@ func (in *StatuspageProvider) DeepCopy() *StatuspageProvider { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SyslogLoggingDestinationParameters) DeepCopyInto(out *SyslogLoggingDestinationParameters) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyslogLoggingDestinationParameters. +func (in *SyslogLoggingDestinationParameters) DeepCopy() *SyslogLoggingDestinationParameters { + if in == nil { + return nil + } + out := new(SyslogLoggingDestinationParameters) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go index 21ffc10c8926..6e70887c22ea 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go @@ -329,6 +329,24 @@ func (EtcdList) SwaggerDoc() map[string]string { return map_EtcdList } +var map_AccessLogging = map[string]string{ + "": "AccessLogging describes how client requests should be logged.", + "destination": "destination is where access logs go.", + "httpLogFormat": "httpLogFormat specifies the format of the log message for an HTTP request.\n\nIf this field is empty, log messages use the implementation's default HTTP log format. For HAProxy's default HTTP log format, see the HAProxy documentation: http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3", +} + +func (AccessLogging) SwaggerDoc() map[string]string { + return map_AccessLogging +} + +var map_ContainerLoggingDestinationParameters = map[string]string{ + "": "ContainerLoggingDestinationParameters describes parameters for the Container logging destination type.", +} + +func (ContainerLoggingDestinationParameters) SwaggerDoc() map[string]string { + return map_ContainerLoggingDestinationParameters +} + var map_EndpointPublishingStrategy = map[string]string{ "": "EndpointPublishingStrategy is a way to publish the endpoints of an IngressController, and represents the type and any additional configuration for a specific type.", "type": "type is the publishing strategy to use. Valid values are:\n\n* LoadBalancerService\n\nPublishes the ingress controller using a Kubernetes LoadBalancer Service.\n\nIn this configuration, the ingress controller deployment uses container networking. A LoadBalancer Service is created to publish the deployment.\n\nSee: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer\n\nIf domain is set, a wildcard DNS record will be managed to point at the LoadBalancer Service's external name. DNS records are managed only in DNS zones defined by dns.config.openshift.io/cluster .spec.publicZone and .spec.privateZone.\n\nWildcard DNS management is currently supported only on the AWS, Azure, and GCP platforms.\n\n* HostNetwork\n\nPublishes the ingress controller on node ports where the ingress controller is deployed.\n\nIn this configuration, the ingress controller deployment uses host networking, bound to node ports 80 and 443. The user is responsible for configuring an external load balancer to publish the ingress controller via the node ports.\n\n* Private\n\nDoes not publish the ingress controller.\n\nIn this configuration, the ingress controller deployment uses container networking, and is not explicitly published. The user must manually publish the ingress controller.\n\n* NodePortService\n\nPublishes the ingress controller using a Kubernetes NodePort Service.\n\nIn this configuration, the ingress controller deployment uses container networking. A NodePort Service is created to publish the deployment. The specific node ports are dynamically allocated by OpenShift; however, to support static port allocations, user changes to the node port field of the managed NodePort Service will preserved.", @@ -368,6 +386,15 @@ func (IngressControllerList) SwaggerDoc() map[string]string { return map_IngressControllerList } +var map_IngressControllerLogging = map[string]string{ + "": "IngressControllerLogging describes what should be logged where.", + "access": "access describes how the client requests should be logged.\n\nIf this field is empty, access logging is disabled.", +} + +func (IngressControllerLogging) SwaggerDoc() map[string]string { + return map_IngressControllerLogging +} + var map_IngressControllerSpec = map[string]string{ "": "IngressControllerSpec is the specification of the desired behavior of the IngressController.", "domain": "domain is a DNS name serviced by the ingress controller and is used to configure multiple features:\n\n* For the LoadBalancerService endpoint publishing strategy, domain is\n used to configure DNS records. See endpointPublishingStrategy.\n\n* When using a generated default certificate, the certificate will be valid\n for domain and its subdomains. See defaultCertificate.\n\n* The value is published to individual Route statuses so that end-users\n know where to target external DNS records.\n\ndomain must be unique among all IngressControllers, and cannot be updated.\n\nIf empty, defaults to ingress.config.openshift.io/cluster .spec.domain.", @@ -379,6 +406,7 @@ var map_IngressControllerSpec = map[string]string{ "nodePlacement": "nodePlacement enables explicit control over the scheduling of the ingress controller.\n\nIf unset, defaults are used. See NodePlacement for more details.", "tlsSecurityProfile": "tlsSecurityProfile specifies settings for TLS connections for ingresscontrollers.\n\nIf unset, the default is based on the apiservers.config.openshift.io/cluster resource.\n\nNote that when using the Old, Intermediate, and Modern profile types, the effective profile configuration is subject to change between releases. For example, given a specification to use the Intermediate profile deployed on release X.Y.Z, an upgrade to release X.Y.Z+1 may cause a new profile configuration to be applied to the ingress controller, resulting in a rollout.\n\nNote that the minimum TLS version for ingress controllers is 1.1, and the maximum TLS version is 1.2. An implication of this restriction is that the Modern TLS profile type cannot be used because it requires TLS 1.3.", "routeAdmission": "routeAdmission defines a policy for handling new route claims (for example, to allow or deny claims across namespaces).\n\nIf empty, defaults will be applied. See specific routeAdmission fields for details about their defaults.", + "logging": "logging defines parameters for what should be logged where. If this field is empty, operational logs are enabled but access logs are disabled.", } func (IngressControllerSpec) SwaggerDoc() map[string]string { @@ -409,6 +437,17 @@ func (LoadBalancerStrategy) SwaggerDoc() map[string]string { return map_LoadBalancerStrategy } +var map_LoggingDestination = map[string]string{ + "": "LoggingDestination describes a destination for log messages.", + "type": "type is the type of destination for logs. It must be one of the following:\n\n* Container\n\nThe ingress operator configures the sidecar container named \"logs\" on the ingress controller pod and configures the ingress controller to write logs to the sidecar. The logs are then available as container logs. The expectation is that the administrator configures a custom logging solution that reads logs from this sidecar. Note that using container logs means that logs may be dropped if the rate of logs exceeds the container runtime's or the custom logging solution's capacity.\n\n* Syslog\n\nLogs are sent to a syslog endpoint. The administrator must specify an endpoint that can receive syslog messages. The expectation is that the administrator has configured a custom syslog instance.", + "syslog": "syslog holds parameters for a syslog endpoint. Present only if type is Syslog.", + "container": "container holds parameters for the Container logging destination. Present only if type is Container.", +} + +func (LoggingDestination) SwaggerDoc() map[string]string { + return map_LoggingDestination +} + var map_NodePlacement = map[string]string{ "": "NodePlacement describes node scheduling configuration for an ingress controller.", "nodeSelector": "nodeSelector is the node selector applied to ingress controller deployments.\n\nIf unset, the default is:\n\n beta.kubernetes.io/os: linux\n node-role.kubernetes.io/worker: ''\n\nIf set, the specified selector is used and replaces the default.", @@ -445,6 +484,17 @@ func (RouteAdmissionPolicy) SwaggerDoc() map[string]string { return map_RouteAdmissionPolicy } +var map_SyslogLoggingDestinationParameters = map[string]string{ + "": "SyslogLoggingDestinationParameters describes parameters for the Syslog logging destination type.", + "address": "address is the IP address of the syslog endpoint that receives log messages.", + "port": "port is the UDP port number of the syslog endpoint that receives log messages.", + "facility": "facility specifies the syslog facility of log messages.\n\nIf this field is empty, the facility is \"local1\".", +} + +func (SyslogLoggingDestinationParameters) SwaggerDoc() map[string]string { + return map_SyslogLoggingDestinationParameters +} + var map_KubeAPIServer = map[string]string{ "": "KubeAPIServer provides information to configure an operator to manage kube-apiserver.", "spec": "spec is the specification of the desired behavior of the Kubernetes API Server", diff --git a/vendor/github.com/openshift/apiserver-library-go/go.mod b/vendor/github.com/openshift/apiserver-library-go/go.mod index e028e7072a9b..e6069266ceb7 100644 --- a/vendor/github.com/openshift/apiserver-library-go/go.mod +++ b/vendor/github.com/openshift/apiserver-library-go/go.mod @@ -4,41 +4,41 @@ go 1.13 require ( github.com/hashicorp/golang-lru v0.5.1 - github.com/openshift/api v0.0.0-20200327145400-6efe1ee417e1 + github.com/openshift/api v0.0.0-20200422085536-f24cbf292bdd github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160 - github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0 - github.com/openshift/library-go v0.0.0-20200327125526-163b2f0d6264 + github.com/openshift/client-go v0.0.0-20200422192633-6f6c07fc2a70 + github.com/openshift/library-go v0.0.0-20200422192915-92dc39f49cb8 go.uber.org/atomic v1.3.3-0.20181018215023-8dc6146f7569 // indirect go.uber.org/multierr v1.1.1-0.20180122172545-ddea229ff1df // indirect - k8s.io/api v0.18.0 - k8s.io/apimachinery v0.18.0 - k8s.io/apiserver v0.18.0 - k8s.io/client-go v0.18.0 - k8s.io/code-generator v0.18.0 + k8s.io/api v0.18.2 + k8s.io/apimachinery v0.18.2 + k8s.io/apiserver v0.18.2 + k8s.io/client-go v0.18.2 + k8s.io/code-generator v0.18.2 k8s.io/klog v1.0.0 - k8s.io/kubernetes v1.18.0 + k8s.io/kubernetes v1.18.2 ) replace ( - k8s.io/api => k8s.io/api v0.18.0 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.0 - k8s.io/apimachinery => k8s.io/apimachinery v0.18.0 - k8s.io/apiserver => k8s.io/apiserver v0.18.0 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.0 - k8s.io/client-go => k8s.io/client-go v0.18.0 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.0 - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.0 - k8s.io/code-generator => k8s.io/code-generator v0.18.0 - k8s.io/component-base => k8s.io/component-base v0.18.0 - k8s.io/cri-api => k8s.io/cri-api v0.18.0 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.0 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.0 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.0 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.0 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.0 - k8s.io/kubectl => k8s.io/kubectl v0.18.0 - k8s.io/kubelet => k8s.io/kubelet v0.18.0 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.0 - k8s.io/metrics => k8s.io/metrics v0.18.0 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.0 + k8s.io/api => k8s.io/api v0.18.2 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.2 + k8s.io/apimachinery => k8s.io/apimachinery v0.18.2 + k8s.io/apiserver => k8s.io/apiserver v0.18.2 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.2 + k8s.io/client-go => k8s.io/client-go v0.18.2 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.2 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.2 + k8s.io/code-generator => k8s.io/code-generator v0.18.2 + k8s.io/component-base => k8s.io/component-base v0.18.2 + k8s.io/cri-api => k8s.io/cri-api v0.18.2 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.2 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.2 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.2 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.2 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.2 + k8s.io/kubectl => k8s.io/kubectl v0.18.2 + k8s.io/kubelet => k8s.io/kubelet v0.18.2 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.2 + k8s.io/metrics => k8s.io/metrics v0.18.2 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.2 ) diff --git a/vendor/github.com/openshift/apiserver-library-go/go.sum b/vendor/github.com/openshift/apiserver-library-go/go.sum index 6688b8ba6e58..0c0f1e3377b5 100644 --- a/vendor/github.com/openshift/apiserver-library-go/go.sum +++ b/vendor/github.com/openshift/apiserver-library-go/go.sum @@ -4,6 +4,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= @@ -19,6 +20,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= +github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= @@ -44,6 +46,7 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM= github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -80,6 +83,7 @@ github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2 github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= github.com/containerd/console v0.0.0-20170925154832-84eeaae905fa/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/containerd v1.0.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= @@ -109,17 +113,23 @@ github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/distribution v0.0.0-20180920194744-16128bbac47f h1:hYf+mPizfvpH6VgIxdntnOmQHd1F1mQUc1oG+j3Ol2g= github.com/docker/distribution v0.0.0-20180920194744-16128bbac47f/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= +github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0 h1:w3NnFcKR5241cfmQU5ZZAsf0xcpId6mWOupTvJlUX2U= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF+n1M6o= github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +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/libnetwork v0.0.0-20190731215715-7f13a5c99f4b h1:rACxqwRsHD075Vb7qTimAgMSKWoM5zER0Dhws/SgCVo= github.com/docker/libnetwork v0.0.0-20190731215715-7f13a5c99f4b/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= github.com/docker/libnetwork v0.8.0-dev.2.0.20190925143933-c8a5fca4a652/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -141,6 +151,7 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsouza/go-dockerclient v0.0.0-20171004212419-da3951ba2e9e h1:B94x7idrPK5yFSMWliAvakUQlTDLgO7iJyHtpbYxGGM= github.com/fsouza/go-dockerclient v0.0.0-20171004212419-da3951ba2e9e/go.mod h1:KpcjM623fQYE9MZiTGzKhjfxXAV9wbyX2C1cyRHfhl0= github.com/getsentry/raven-go v0.0.0-20190513200303-c977f96e1095/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -161,9 +172,11 @@ github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70t github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= @@ -181,9 +194,11 @@ github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/loads v0.19.4 h1:5I4CCSqoWzT+82bBkNIvmLc0UOsoKKQ4Fz+3VxOB7SY= github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4 h1:csnOgcgAiuGoM/Po7PEpKDoNulCcF3FGbSnbHfxgjMI= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= @@ -194,6 +209,7 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8 github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.3 h1:eRfyY5SkaNJCAwmmMcADjY31ow9+N7MCLW7oRkbsINA= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= @@ -203,8 +219,10 @@ github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tF github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.5 h1:QhCBKRYqZR+SKo4gl1lPhPahope8/RLt6EVgY8X80w0= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= @@ -325,6 +343,7 @@ github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8= @@ -401,6 +420,7 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -409,6 +429,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mozilla/tls-observatory v0.0.0-20180409132520-8791a200eb40/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= @@ -417,6 +438,7 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mvdan/xurls v1.1.0/go.mod h1:tQlNn3BED8bE/15hnSL2HLkDeLWpNPAwtw7wkEq44oU= 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 h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= @@ -436,21 +458,24 @@ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +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/runc v0.0.0-20191031171055-b133feaeeb2e h1:NKMVwQeEqNOp8DVM4J1HjpZHRcQO7MAVfZwFxs+Bqec= github.com/opencontainers/runc v0.0.0-20191031171055-b133feaeeb2e/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs= github.com/openshift/api v0.0.0-20200326152221-912866ddb162/go.mod h1:RKMJ5CBnljLfnej+BJ/xnOWc3kZDvJUaIAEq2oKSPtE= github.com/openshift/api v0.0.0-20200326160804-ecb9283fe820/go.mod h1:RKMJ5CBnljLfnej+BJ/xnOWc3kZDvJUaIAEq2oKSPtE= -github.com/openshift/api v0.0.0-20200327145400-6efe1ee417e1 h1:3K/nqFY7qkqBuuSaiOUDUucOFTQ5Su3u/vWEgEDGPks= -github.com/openshift/api v0.0.0-20200327145400-6efe1ee417e1/go.mod h1:RKMJ5CBnljLfnej+BJ/xnOWc3kZDvJUaIAEq2oKSPtE= +github.com/openshift/api v0.0.0-20200422085536-f24cbf292bdd h1:MjlSkQrMZAygwnUO3Jr52DRvPpqgl4seKlfTO9NZwXc= +github.com/openshift/api v0.0.0-20200422085536-f24cbf292bdd/go.mod h1:KUGG8wLCDSpsnb45UyzQNy+10cgc1Y/xAOAKd6oBucY= github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160 h1:V4E6yt4XWiBEPKnJbs/E8pgUq9AjZqzQfsL3eeT84Qs= github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160/go.mod h1:1CkcsT3aVebzRBzVTSbiKSkJMsC/CASqxesfqEMfJEc= -github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0 h1:kMiuiZXH1GdfbiMwsuAQOqGaMxlo9NCUk0wT4XAdfNM= github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0/go.mod h1:uUQ4LClRO+fg5MF/P6QxjMCb1C9f7Oh4RKepftDnEJE= -github.com/openshift/library-go v0.0.0-20200327125526-163b2f0d6264 h1:VcZjTupwjxB9ANlKxerMNdfjqlTBWrVxgrjKi7VBwOY= -github.com/openshift/library-go v0.0.0-20200327125526-163b2f0d6264/go.mod h1:CfydoH0B+RYs22uQZQ36A1mz5m5zhucpMGh8t5s71v4= +github.com/openshift/client-go v0.0.0-20200422192633-6f6c07fc2a70 h1:LvJxSt/lnLTBbKJC5DfWM9ZvT9Jk0nQa+xPozSJtkqc= +github.com/openshift/client-go v0.0.0-20200422192633-6f6c07fc2a70/go.mod h1:HeCrq1LSOBgHAUpINH4IgBLkt2U/NBwE5sq4JJgcl2Y= +github.com/openshift/library-go v0.0.0-20200422192915-92dc39f49cb8 h1:tGnXjJ7tzfIQTj202vyQm5DRL3lGhc5qsuNy65lOSIM= +github.com/openshift/library-go v0.0.0-20200422192915-92dc39f49cb8/go.mod h1:McAsGfx4pk3XOvCLBIPwocd2PaN/A4LYXKjbap+01rw= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -516,6 +541,7 @@ github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgK github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -552,8 +578,10 @@ github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk github.com/valyala/quicktemplate v1.1.1/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= +github.com/vishvananda/netlink v1.0.0 h1:bqNY2lgheFIu1meHUFSH3d7vG93AFyqg3oGbJCOJgSM= github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= @@ -566,6 +594,7 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 h1:VcrIfasaLFkyjk6KNlXQSzO+B0 go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -758,6 +787,7 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA= @@ -772,6 +802,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/gotestsum v0.3.5/go.mod h1:Mnf3e5FUzXbkCfynWBGOwLssY7gTQgCHObK9tMpAriY= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= @@ -780,24 +811,24 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= -k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= -k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= -k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= -k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= -k8s.io/apiserver v0.18.0 h1:ELAWpGWC6XdbRLi5lwAbEbvksD7hkXxPdxaJsdpist4= -k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= -k8s.io/cli-runtime v0.18.0/go.mod h1:1eXfmBsIJosjn9LjEBUd2WVPoPAY9XGTqTFcPMIBsUQ= -k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4= -k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= -k8s.io/cloud-provider v0.18.0/go.mod h1:ZBq1FhoJ+XoQ8JYBYoyx81LS3JV0RAW/UmHf/6w9E6k= -k8s.io/cluster-bootstrap v0.18.0/go.mod h1:xSe+bOZ3asS/ciT91ESQYGhjOql43aBETfvbCzNvad8= -k8s.io/code-generator v0.18.0 h1:0xIRWzym+qMgVpGmLESDeMfz/orwgxwxFFAo1xfGNtQ= -k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= -k8s.io/component-base v0.18.0 h1:I+lP0fNfsEdTDpHaL61bCAqTZLoiWjEEP304Mo5ZQgE= -k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c= -k8s.io/cri-api v0.18.0/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s= -k8s.io/csi-translation-lib v0.18.0/go.mod h1:iF8TE4ACSaPqN1qxmiIjvcU1A8VgkOrpcFGD7Z0hVu0= +k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= +k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= +k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= +k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= +k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/apiserver v0.18.2 h1:fwKxdTWwwYhxvtjo0UUfX+/fsitsNtfErPNegH2x9ic= +k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= +k8s.io/cli-runtime v0.18.2/go.mod h1:yfFR2sQQzDsV0VEKGZtrJwEy4hLZ2oj4ZIfodgxAHWQ= +k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= +k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= +k8s.io/cloud-provider v0.18.2/go.mod h1:t1HjnQN2l5wK/fORo/yyu0Q+bZTYuReHYCIpi/qqfms= +k8s.io/cluster-bootstrap v0.18.2/go.mod h1:lHDOrHDzZi3eQE9bYMFpkwwUuLYiAiBuQuHaAnoGWTk= +k8s.io/code-generator v0.18.2 h1:C1Nn2JiMf244CvBDKVPX0W2mZFJkVBg54T8OV7/Imso= +k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/component-base v0.18.2 h1:SJweNZAGcUvsypLGNPNGeJ9UgPZQ6+bW+gEHe8uyh/Y= +k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= +k8s.io/cri-api v0.18.2/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s= +k8s.io/csi-translation-lib v0.18.2/go.mod h1:2lyXP0OP6MuzAEde802d4L/Rhzj4teNdNBKGVxVKV78= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= @@ -806,20 +837,20 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUc k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/kube-aggregator v0.18.0/go.mod h1:ateewQ5QbjMZF/dihEFXwaEwoA4v/mayRvzfmvb6eqI= -k8s.io/kube-controller-manager v0.18.0/go.mod h1:pIRGUrSo+skWzwr5pgWNbgiFWEGSotbamGQpR/gKd5U= +k8s.io/kube-aggregator v0.18.2/go.mod h1:ijq6FnNUoKinA6kKbkN6svdTacSoQVNtKqmQ1+XJEYQ= +k8s.io/kube-controller-manager v0.18.2/go.mod h1:v45wCqexTrOltgwj92V4ve7hm5f70GQzi4a47/RQ0HQ= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= -k8s.io/kube-proxy v0.18.0/go.mod h1:st3Gcg9wYAd1sn6UMeAs5AHN3R0NOItfB5P6qObKrr8= -k8s.io/kube-scheduler v0.18.0/go.mod h1:GFaNT5Z5/zPZsjXmkGihac2qsT+0u2KIHDgXdFfPHPc= -k8s.io/kubectl v0.18.0/go.mod h1:LOkWx9Z5DXMEg5KtOjHhRiC1fqJPLyCr3KtQgEolCkU= -k8s.io/kubelet v0.18.0/go.mod h1:1VULM2m7c/ePlIeNOVVK+kkprayDr1RPf1T8oaNaHuQ= -k8s.io/kubernetes v1.18.0 h1:rVe+edi5GwutPQJ4KIZq1Nk506nmnfyz/KOZVCLv7Yo= -k8s.io/kubernetes v1.18.0/go.mod h1:z8xjOOO1Ljz+TaHpOxVGC7cxtF32TesIamoQ+BZrVS0= -k8s.io/legacy-cloud-providers v0.18.0/go.mod h1:4Bc9CdZg8wl0mskyhnaXa8DdqLpTUfPEMkw3FZok+H8= -k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4= +k8s.io/kube-proxy v0.18.2/go.mod h1:VTgyDMdylYGgHVqLQo/Nt4yDWkh/LRsSnxRiG8GVgDo= +k8s.io/kube-scheduler v0.18.2/go.mod h1:dL+C0Hp/ahQOQK3BsgmV8btb3BtMZvz6ONUw/v1N8sk= +k8s.io/kubectl v0.18.2/go.mod h1:OdgFa3AlsPKRpFFYE7ICTwulXOcMGXHTc+UKhHKvrb4= +k8s.io/kubelet v0.18.2/go.mod h1:7x/nzlIWJLg7vOfmbQ4lgsYazEB0gOhjiYiHK1Gii4M= +k8s.io/kubernetes v1.18.2 h1:37sJPq6p+gx5hEHQSwCWXIiXDc9AajzV1A5UrswnDq0= +k8s.io/kubernetes v1.18.2/go.mod h1:z8xjOOO1Ljz+TaHpOxVGC7cxtF32TesIamoQ+BZrVS0= +k8s.io/legacy-cloud-providers v0.18.2/go.mod h1:zzFRqgDC6cP1SgPl7lMmo1fjILDZ+bsNtTjLnxAfgI0= +k8s.io/metrics v0.18.2/go.mod h1:qga8E7QfYNR9Q89cSCAjinC9pTZ7yv1XSVGUB0vJypg= k8s.io/repo-infra v0.0.1-alpha.1/go.mod h1:wO1t9WaB99V80ljbeENTnayuEEwNZt7gECYh/CEyOJ8= -k8s.io/sample-apiserver v0.18.0/go.mod h1:1RKw7QEixom4PIw/vjUvDgl2QQbuTXbeCUHLlNCzOjg= +k8s.io/sample-apiserver v0.18.2/go.mod h1:qYk6alcVIlWzmypsSmsWw5Kj4eUNr5jzJZZFJDUXwXE= k8s.io/system-validators v1.0.4/go.mod h1:HgSgTg4NAGNoYYjKsUyk52gdNi2PVDswQ9Iyn66R7NI= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= diff --git a/vendor/github.com/openshift/client-go/go.mod b/vendor/github.com/openshift/client-go/go.mod index e246c2390019..e3cd95ad87ae 100644 --- a/vendor/github.com/openshift/client-go/go.mod +++ b/vendor/github.com/openshift/client-go/go.mod @@ -5,8 +5,8 @@ go 1.13 require ( github.com/openshift/api v0.0.0-20200326152221-912866ddb162 github.com/spf13/pflag v1.0.5 - k8s.io/api v0.18.0 - k8s.io/apimachinery v0.18.0 - k8s.io/client-go v0.18.0 - k8s.io/code-generator v0.18.0 + k8s.io/api v0.18.2 + k8s.io/apimachinery v0.18.2 + k8s.io/client-go v0.18.2 + k8s.io/code-generator v0.18.2 ) diff --git a/vendor/github.com/openshift/client-go/go.sum b/vendor/github.com/openshift/client-go/go.sum index 42d1b58f2636..95118d5a17d9 100644 --- a/vendor/github.com/openshift/client-go/go.sum +++ b/vendor/github.com/openshift/client-go/go.sum @@ -225,12 +225,18 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= +k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= +k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= -k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4= -k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= +k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= +k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= +k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/code-generator v0.18.0 h1:0xIRWzym+qMgVpGmLESDeMfz/orwgxwxFFAo1xfGNtQ= k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/code-generator v0.18.2 h1:C1Nn2JiMf244CvBDKVPX0W2mZFJkVBg54T8OV7/Imso= +k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= diff --git a/vendor/github.com/openshift/library-go/go.mod b/vendor/github.com/openshift/library-go/go.mod index 4025512d110e..67ef51922dbc 100644 --- a/vendor/github.com/openshift/library-go/go.mod +++ b/vendor/github.com/openshift/library-go/go.mod @@ -3,7 +3,6 @@ module github.com/openshift/library-go go 1.13 require ( - bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c github.com/Microsoft/go-winio v0.4.11 // indirect github.com/blang/semver v3.5.0+incompatible github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2 // indirect @@ -34,6 +33,7 @@ require ( github.com/jteeuwen/go-bindata v3.0.8-0.20151023091102-a0ff2567cfb7+incompatible github.com/kubernetes-sigs/kube-storage-version-migrator v0.0.0-20191127225502-51849bc15f17 github.com/morikuni/aec v1.0.0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 github.com/opencontainers/go-digest v1.0.0-rc1 github.com/opencontainers/image-spec v1.0.1 // indirect github.com/opencontainers/runc v0.0.0-20191031171055-b133feaeeb2e // indirect @@ -55,14 +55,14 @@ require ( golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect gopkg.in/ldap.v2 v2.5.1 - k8s.io/api v0.18.0 - k8s.io/apiextensions-apiserver v0.18.0 - k8s.io/apimachinery v0.18.0 - k8s.io/apiserver v0.18.0 - k8s.io/client-go v0.18.0 - k8s.io/component-base v0.18.0 + k8s.io/api v0.18.2 + k8s.io/apiextensions-apiserver v0.18.2 + k8s.io/apimachinery v0.18.2 + k8s.io/apiserver v0.18.2 + k8s.io/client-go v0.18.2 + k8s.io/component-base v0.18.2 k8s.io/klog v1.0.0 - k8s.io/kube-aggregator v0.18.0 + k8s.io/kube-aggregator v0.18.2 k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 sigs.k8s.io/yaml v1.2.0 vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 diff --git a/vendor/github.com/openshift/library-go/go.sum b/vendor/github.com/openshift/library-go/go.sum index cff9ff2fa6fe..bcf5b835e65a 100644 --- a/vendor/github.com/openshift/library-go/go.sum +++ b/vendor/github.com/openshift/library-go/go.sum @@ -1,5 +1,3 @@ -bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c h1:t+Ra932MCC0eeyD/vigXqMbZTzgZjd4JOfBJWC6VSMI= -bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c/go.mod h1:1vhO7Mn/FZMgOgDVGLy5X1mE6rq1HbkBdkF/yj8zkcg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -573,28 +571,35 @@ k8s.io/api v0.18.0-beta.2 h1:SK0PKYvDWhLz32ayrfQ1OSmEgz3sH6RvCtXpaBrv2ao= k8s.io/api v0.18.0-beta.2/go.mod h1:2oeNnWEqcSmaM/ibSh3t7xcIqbkGXhzZdn4ezV9T4m0= k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= +k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= +k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/apiextensions-apiserver v0.18.0-beta.2 h1:BnuFwNZwtBxQ/r+4P9IKOu8huYW9pYJWezQ4WnoQcI8= k8s.io/apiextensions-apiserver v0.18.0-beta.2/go.mod h1:Hnrg5jx8/PbxRbUoqDGxtQkULjwx8FDW4WYJaKNK+fk= -k8s.io/apiextensions-apiserver v0.18.0 h1:HN4/P8vpGZFvB5SOMuPPH2Wt9Y/ryX+KRvIyAkchu1Q= -k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= +k8s.io/apiextensions-apiserver v0.18.2 h1:I4v3/jAuQC+89L3Z7dDgAiN4EOjN6sbm6iBqQwHTah8= +k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apimachinery v0.18.0-beta.2 h1:KR/mjplxzpYK/3tYez9iE4j9vMWKLSN3E2cZQqd/3KQ= k8s.io/apimachinery v0.18.0-beta.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= +k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apiserver v0.18.0-beta.2 h1:UsErgJmZXL8ZwfjTN/sknOxH97nwNSoqS6osu7iL7u0= k8s.io/apiserver v0.18.0-beta.2/go.mod h1:bnblMkMoCFnIfVnVftd0SXJPzyvrk3RtaqSbblphF/A= -k8s.io/apiserver v0.18.0 h1:ELAWpGWC6XdbRLi5lwAbEbvksD7hkXxPdxaJsdpist4= -k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= +k8s.io/apiserver v0.18.2 h1:fwKxdTWwwYhxvtjo0UUfX+/fsitsNtfErPNegH2x9ic= +k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/client-go v0.18.0-beta.2 h1:7LXqrIxTryiPQLsQjr/8DIcIC1qhI8eSqNaaM05o6Q8= k8s.io/client-go v0.18.0-beta.2/go.mod h1:UvuVxHjKWIcgy0iMvF+bwNDW7l0mskTNOaOW1Qv5BMA= k8s.io/client-go v0.18.0 h1:yqKw4cTUQraZK3fcVCMeSa+lqKwcjZ5wtcOIPnxQno4= k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= +k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= +k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/code-generator v0.18.0-beta.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/component-base v0.18.0-beta.2 h1:f2D8WjS20nJUL/Bi4cWDrWCSh1gTbnSatq/n0FqSX+c= k8s.io/component-base v0.18.0-beta.2/go.mod h1:HVk5FpRnyzQ/MjBr9//e/yEBjTVa2qjGXCTuUzcD7ks= -k8s.io/component-base v0.18.0 h1:I+lP0fNfsEdTDpHaL61bCAqTZLoiWjEEP304Mo5ZQgE= -k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c= +k8s.io/component-base v0.18.2 h1:SJweNZAGcUvsypLGNPNGeJ9UgPZQ6+bW+gEHe8uyh/Y= +k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= @@ -603,8 +608,8 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/kube-aggregator v0.18.0-beta.2 h1:2R1770iXAi+TfkUdJzFs5ryUfAn1KW0+jVWRGvIgINA= k8s.io/kube-aggregator v0.18.0-beta.2/go.mod h1:O3Td9mheraINbLHH4pzoFP2gRzG0Wk1COqzdSL4rBPk= -k8s.io/kube-aggregator v0.18.0 h1:J+wa9FDQ3SbgyA8wQBNg2m2FMSm+mMQfs2A58500hs0= -k8s.io/kube-aggregator v0.18.0/go.mod h1:ateewQ5QbjMZF/dihEFXwaEwoA4v/mayRvzfmvb6eqI= +k8s.io/kube-aggregator v0.18.2 h1:mgsze91nZC27HeJi8bLRyhLINQznEUy4SOTpbOhsZEM= +k8s.io/kube-aggregator v0.18.2/go.mod h1:ijq6FnNUoKinA6kKbkN6svdTacSoQVNtKqmQ1+XJEYQ= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/utils v0.0.0-20200229041039-0a110f9eb7ab h1:I3f2hcBrepGRXI1z4sukzAb8w1R4eqbsHrAsx06LGYM= diff --git a/vendor/github.com/openshift/library-go/pkg/apiserver/httprequest/httprequest.go b/vendor/github.com/openshift/library-go/pkg/apiserver/httprequest/httprequest.go index 91539fb6a6b2..470ed3419a2c 100644 --- a/vendor/github.com/openshift/library-go/pkg/apiserver/httprequest/httprequest.go +++ b/vendor/github.com/openshift/library-go/pkg/apiserver/httprequest/httprequest.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "bitbucket.org/ww/goautoneg" + "github.com/munnerz/goautoneg" ) // PrefersHTML returns true if the request was made by something that looks like a browser, or can receive HTML diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go index 1865b026b438..850b8ecc9da4 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go @@ -5,12 +5,16 @@ import ( "fmt" "io/ioutil" "os" + "strings" "sync" "time" + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" "k8s.io/klog" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/version" genericapiserver "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/healthz" "k8s.io/client-go/kubernetes" @@ -72,6 +76,8 @@ type ControllerBuilder struct { authorizationConfig *operatorv1alpha1.DelegatedAuthorization healthChecks []healthz.HealthChecker + versionInfo *version.Info + // nonZeroExitFn takes a function that exit the process with non-zero code. // This stub exists for unit test where we can check if the graceful termination work properly. // Default function will klog.Warning(args) and os.Exit(1). @@ -134,6 +140,12 @@ func (b *ControllerBuilder) WithLeaderElection(leaderElection configv1.LeaderEle return b } +// WithVersion accepts a getting that provide binary version information that is used to report build_info information to prometheus +func (b *ControllerBuilder) WithVersion(info version.Info) *ControllerBuilder { + b.versionInfo = &info + return b +} + // WithServer adds a server that provides metrics and healthz func (b *ControllerBuilder) WithServer(servingInfo configv1.HTTPServingInfo, authenticationConfig operatorv1alpha1.DelegatedAuthentication, authorizationConfig operatorv1alpha1.DelegatedAuthorization) *ControllerBuilder { b.servingInfo = servingInfo.DeepCopy() @@ -194,6 +206,23 @@ func (b *ControllerBuilder) Run(ctx context.Context, config *unstructured.Unstru } } + // report the binary version metrics to prometheus + if b.versionInfo != nil { + buildInfo := metrics.NewGaugeVec( + &metrics.GaugeOpts{ + Name: strings.Replace(namespace, "-", "_", -1) + "_build_info", + Help: "A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, " + + "and compiler from which " + b.componentName + " was built, and platform on which it is running.", + StabilityLevel: metrics.ALPHA, + }, + []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + ) + legacyregistry.MustRegister(buildInfo) + buildInfo.WithLabelValues(b.versionInfo.Major, b.versionInfo.Minor, b.versionInfo.GitVersion, b.versionInfo.GitCommit, b.versionInfo.GitTreeState, b.versionInfo.BuildDate, b.versionInfo.GoVersion, + b.versionInfo.Compiler, b.versionInfo.Platform).Set(1) + klog.Infof("%s version %s-%s", b.componentName, b.versionInfo.GitVersion, b.versionInfo.GitCommit) + } + kubeConfig := "" if b.kubeAPIServerConfigFile != nil { kubeConfig = *b.kubeAPIServerConfigFile diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go index 6b59e971855a..1e603efe16a7 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go @@ -266,6 +266,7 @@ func (c *ControllerCommandConfig) StartController(ctx context.Context) error { WithKubeConfigFile(c.basicFlags.KubeConfigFile, nil). WithComponentNamespace(c.basicFlags.Namespace). WithLeaderElection(config.LeaderElection, c.basicFlags.Namespace, c.componentName+"-lock"). + WithVersion(c.version). WithRestartOnChange(exitOnChangeReactorCh, startingFileContent, observedFiles...) if !c.DisableServing { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer_test.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer_test.go index 209a07539341..6cbfc690b36d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer_test.go @@ -55,6 +55,7 @@ func TestEnsureSigningCertKeyPair(t *testing.T) { name: "update no annotations", initialSecret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "signer"}, + Type: corev1.SecretTypeTLS, }, verifyActions: func(t *testing.T, client *kubefake.Clientset) { t.Helper() diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target_test.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target_test.go index 87ae13100d10..0096bb511ff8 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target_test.go @@ -174,6 +174,7 @@ func TestEnsureTargetCertKeyPair(t *testing.T) { caBundleSecret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "target-secret"}, Data: map[string][]byte{}, + Type: corev1.SecretTypeTLS, } return caBundleSecret }, @@ -356,6 +357,7 @@ func TestEnsureTargetSignerCertKeyPair(t *testing.T) { caBundleSecret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "target-secret"}, Data: map[string][]byte{}, + Type: corev1.SecretTypeTLS, } return caBundleSecret }, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/state_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/state_controller_test.go index f1cf9072efaa..9adf25f4b9c4 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/state_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/state_controller_test.go @@ -780,6 +780,7 @@ func validateSecretWithEncryptionConfig(actualSecret *corev1.Secret, expectedEnc Finalizers: []string{"encryption.apiserver.operator.openshift.io/deletion-protection"}, }, Data: actualSecret.Data, + Type: corev1.SecretTypeOpaque, } // those are filled by the server diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/encryptionconfig/secret.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/encryptionconfig/secret.go index 0a75d5375b55..e169ccd7453f 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/encryptionconfig/secret.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/encryptionconfig/secret.go @@ -70,5 +70,6 @@ func ToSecret(ns, name string, encryptionCfg *apiserverconfigv1.EncryptionConfig Data: map[string][]byte{ EncryptionConfSecretName: rawEncryptionCfg, }, + Type: corev1.SecretTypeOpaque, }, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/secrets/secrets.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/secrets/secrets.go index 7295cc32d418..6db0273e0d9a 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/secrets/secrets.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/secrets/secrets.go @@ -98,6 +98,7 @@ func FromKeyState(component string, ks state.KeyState) (*corev1.Secret, error) { Data: map[string][]byte{ EncryptionSecretKeyDataKey: bs, }, + Type: corev1.SecretTypeOpaque, } if !ks.Migrated.Timestamp.IsZero() { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/testing/helpers.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/testing/helpers.go index 950acc61151b..90e314990938 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/testing/helpers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/testing/helpers.go @@ -48,6 +48,7 @@ func CreateEncryptionKeySecretNoDataWithMode(targetNS string, grs []schema.Group Finalizers: []string{"encryption.apiserver.operator.openshift.io/deletion-protection"}, }, Data: map[string][]byte{}, + Type: corev1.SecretTypeOpaque, } if len(grs) > 0 { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go index 253b17ef1db7..537768818801 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go @@ -2,6 +2,9 @@ package resourceapply import ( "context" + "crypto/sha256" + "encoding/json" + "fmt" "k8s.io/klog" @@ -15,13 +18,103 @@ import ( "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) -// ApplyDeployment merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error -func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Recorder, required *appsv1.Deployment, expectedGeneration int64, +// The Apply methods in this file ensure that a resource is created or updated to match +// the form provided by the caller. +// +// If the resource does not yet exist, it will be created. +// +// If the resource exists, the metadata of the required resource will be merged with the +// existing resource and an update will be performed if the spec and metadata differ between +// the required and existing resources. To be reliable, the input of the required spec from +// the operator should be stable. It does not need to set all fields, since some fields are +// defaulted server-side. Detection of spec drift from intent by other actors is determined +// by generation, not by spec comparison. +// +// To ensure an update in response to state external to the resource spec, the caller should +// set an annotation representing that external state e.g. +// +// `myoperator.openshift.io/config-resource-version: ` +// +// An update will be performed if: +// +// - The required resource metadata differs from that of the existing resource. +// - The difference will be detected by comparing the name, namespace, labels and +// annotations of the 2 resources. +// +// - The generation expected by the operator differs from generation of the existing +// resource. +// - This is the likely result of an actor other than the operator updating a resource +// managed by the operator. +// +// - The spec of the required resource differs from the spec of the existing resource. +// - The difference will be detected via metadata comparison since the hash of the +// resource's spec will be set as an annotation prior to comparison. + +const specHashAnnotation = "operator.openshift.io/spec-hash" + +// SetSpecHashAnnotation computes the hash of the provided spec and sets an annotation of the +// hash on the provided ObjectMeta. This method is used internally by Apply methods, and +// is exposed to support testing with fake clients that need to know the mutated form of the +// resource resulting from an Apply call. +func SetSpecHashAnnotation(objMeta *metav1.ObjectMeta, spec interface{}) error { + jsonBytes, err := json.Marshal(spec) + if err != nil { + return err + } + specHash := fmt.Sprintf("%x", sha256.Sum256(jsonBytes)) + if objMeta.Annotations == nil { + objMeta.Annotations = map[string]string{} + } + objMeta.Annotations[specHashAnnotation] = specHash + return nil +} + +// ApplyDeployment ensures the form of the specified deployment is present in the API. If it +// does not exist, it will be created. If it does exist, the metadata of the required +// deployment will be merged with the existing deployment and an update performed if the +// deployment spec and metadata differ from the previously required spec and metadata. For +// further detail, check the top-level comment. +// +// NOTE: The previous implementation of this method was renamed to +// ApplyDeploymentWithForce. If are reading this in response to a compile error due to the +// change in signature, you have the following options: +// +// - Update the calling code to rely on the spec comparison provided by the new +// implementation. If the code in question was specifying the force parameter to ensure +// rollout in response to changes in resources external to the deployment, it will need to be +// revised to set that external state as an annotation e.g. +// +// myoperator.openshift.io/my-resource: +// +// - Update the call to use ApplyDeploymentWithForce. This is available as a temporary measure +// but the method is deprecated and will be removed in 4.6. +func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Recorder, + requiredOriginal *appsv1.Deployment, expectedGeneration int64) (*appsv1.Deployment, bool, error) { + + required := requiredOriginal.DeepCopy() + err := SetSpecHashAnnotation(&required.ObjectMeta, required.Spec) + if err != nil { + return nil, false, err + } + + return ApplyDeploymentWithForce(client, recorder, required, expectedGeneration, false) +} + +// ApplyDeploymentWithForce merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error. +// +// DEPRECATED - This method will be removed in 4.6 and callers will need to migrate to ApplyDeployment before then. +func ApplyDeploymentWithForce(client appsclientv1.DeploymentsGetter, recorder events.Recorder, requiredOriginal *appsv1.Deployment, expectedGeneration int64, forceRollout bool) (*appsv1.Deployment, bool, error) { + + required := requiredOriginal.DeepCopy() if required.Annotations == nil { required.Annotations = map[string]string{} } - required.Annotations["operator.openshift.io/pull-spec"] = required.Spec.Template.Spec.Containers[0].Image + if _, ok := required.Annotations[specHashAnnotation]; !ok { + // If the spec hash annotation is not present, the caller expects the + // pull-spec annotation to be applied. + required.Annotations["operator.openshift.io/pull-spec"] = required.Spec.Template.Spec.Containers[0].Image + } existing, err := client.Deployments(required.Namespace).Get(context.TODO(), required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.Deployments(required.Namespace).Create(context.TODO(), required, metav1.CreateOptions{}) @@ -66,12 +159,49 @@ func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Reco return actual, true, err } -// ApplyDaemonSet merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error -func ApplyDaemonSet(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, required *appsv1.DaemonSet, expectedGeneration int64, forceRollout bool) (*appsv1.DaemonSet, bool, error) { +// ApplyDaemonSet ensures the form of the specified daemonset is present in the API. If it +// does not exist, it will be created. If it does exist, the metadata of the required +// daemonset will be merged with the existing daemonset and an update performed if the +// daemonset spec and metadata differ from the previously required spec and metadata. For +// further detail, check the top-level comment. +// +// NOTE: The previous implementation of this method was renamed to ApplyDaemonSetWithForce. If +// are reading this in response to a compile error due to the change in signature, you have +// the following options: +// +// - Update the calling code to rely on the spec comparison provided by the new +// implementation. If the code in question was specifying the force parameter to ensure +// rollout in response to changes in resources external to the daemonset, it will need to be +// revised to set that external state as an annotation e.g. +// +// myoperator.openshift.io/my-resource: +// +// - Update the call to use ApplyDaemonSetWithForce. This is available as a temporary measure +// but the method is deprecated and will be removed in 4.6. +func ApplyDaemonSet(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, + requiredOriginal *appsv1.DaemonSet, expectedGeneration int64) (*appsv1.DaemonSet, bool, error) { + + required := requiredOriginal.DeepCopy() + err := SetSpecHashAnnotation(&required.ObjectMeta, required.Spec) + if err != nil { + return nil, false, err + } + + return ApplyDaemonSetWithForce(client, recorder, required, expectedGeneration, false) +} + +// ApplyDaemonSetWithForce merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error +// DEPRECATED - This method will be removed in 4.6 and callers will need to migrate to ApplyDaemonSet before then. +func ApplyDaemonSetWithForce(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, requiredOriginal *appsv1.DaemonSet, expectedGeneration int64, forceRollout bool) (*appsv1.DaemonSet, bool, error) { + required := requiredOriginal.DeepCopy() if required.Annotations == nil { required.Annotations = map[string]string{} } - required.Annotations["operator.openshift.io/pull-spec"] = required.Spec.Template.Spec.Containers[0].Image + if _, ok := required.Annotations[specHashAnnotation]; !ok { + // If the spec hash annotation is not present, the caller expects the + // pull-spec annotation to be applied. + required.Annotations["operator.openshift.io/pull-spec"] = required.Spec.Template.Spec.Containers[0].Image + } existing, err := client.DaemonSets(required.Namespace).Get(context.TODO(), required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.DaemonSets(required.Namespace).Create(context.TODO(), required, metav1.CreateOptions{}) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go index 3e4724e7999d..09fa9f1e60ff 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go @@ -273,6 +273,11 @@ func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, re existingCopy.Type = required.Type + // Server defaults some values and we need to do it as well or it will never equal. + if existingCopy.Type == "" { + existingCopy.Type = corev1.SecretTypeOpaque + } + if equality.Semantic.DeepEqual(existingCopy, existing) { return existing, false, nil } @@ -280,14 +285,23 @@ func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, re if klog.V(4) { klog.Infof("Secret %s/%s changes: %v", required.Namespace, required.Name, JSONPatchSecretNoError(existing, existingCopy)) } - actual, err := client.Secrets(required.Namespace).Update(context.TODO(), existingCopy, metav1.UpdateOptions{}) - reportUpdateEvent(recorder, existingCopy, err) - if err == nil { - return actual, true, err - } - if !strings.Contains(err.Error(), "field is immutable") { - return actual, true, err + var actual *corev1.Secret + /* + * Kubernetes validation silently hides failures to update secret type. + * https://github.com/kubernetes/kubernetes/blob/98e65951dccfd40d3b4f31949c2ab8df5912d93e/pkg/apis/core/validation/validation.go#L5048 + * We need to explicitly opt for delete+create in that case. + */ + if existingCopy.Type == existing.Type { + actual, err = client.Secrets(required.Namespace).Update(context.TODO(), existingCopy, metav1.UpdateOptions{}) + reportUpdateEvent(recorder, existingCopy, err) + + if err == nil { + return actual, true, err + } + if !strings.Contains(err.Error(), "field is immutable") { + return actual, true, err + } } // if the field was immutable on a secret, we're going to be stuck until we delete it. Try to delete and then create diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core_test.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core_test.go index df31c480a925..27cf1942075b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core_test.go @@ -333,7 +333,7 @@ func TestApplySecret(t *testing.T) { ObjectMeta: m, Type: corev1.SecretTypeTLS, }, - changed: false, + changed: true, expected: &corev1.Secret{ ObjectMeta: m, Type: corev1.SecretTypeTLS, @@ -378,7 +378,7 @@ func TestApplySecret(t *testing.T) { "bar": []byte("bbb"), }, }, - changed: false, + changed: true, expected: &corev1.Secret{ ObjectMeta: m, Type: corev1.SecretTypeTLS, @@ -446,6 +446,65 @@ func TestApplySecret(t *testing.T) { }, }, }, + { + name: "recreates the secret if its type changes", + existing: []runtime.Object{ + &corev1.Secret{ + ObjectMeta: m, + Type: "", + Data: map[string][]byte{ + "foo": []byte("bar"), + }, + }, + }, + required: &corev1.Secret{ + ObjectMeta: m, + Type: corev1.SecretTypeOpaque, + Data: map[string][]byte{ + "foo": []byte("bar"), + }, + }, + changed: true, + expected: &corev1.Secret{ + ObjectMeta: m, + Type: corev1.SecretTypeOpaque, + Data: map[string][]byte{ + "foo": []byte("bar"), + }, + }, + actions: []clienttesting.Action{ + clienttesting.GetActionImpl{ + Name: m.Name, + ActionImpl: clienttesting.ActionImpl{ + Namespace: m.Namespace, + Verb: "get", + Resource: r, + }, + }, + clienttesting.DeleteActionImpl{ + Name: m.Name, + ActionImpl: clienttesting.ActionImpl{ + Namespace: m.Namespace, + Verb: "delete", + Resource: r, + }, + }, + clienttesting.CreateActionImpl{ + ActionImpl: clienttesting.ActionImpl{ + Namespace: m.Namespace, + Verb: "create", + Resource: r, + }, + Object: &corev1.Secret{ + ObjectMeta: m, + Type: corev1.SecretTypeOpaque, + Data: map[string][]byte{ + "foo": []byte("bar"), + }, + }, + }, + }, + }, } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { @@ -453,13 +512,14 @@ func TestApplySecret(t *testing.T) { got, changed, err := ApplySecret(client.CoreV1(), events.NewInMemoryRecorder("test"), tc.required) if !reflect.DeepEqual(tc.err, err) { t.Errorf("expected error %v, got %v", tc.err, err) + return } if !equality.Semantic.DeepEqual(tc.expected, got) { t.Errorf("objects don't match %s", cmp.Diff(tc.expected, got)) } - if !reflect.DeepEqual(tc.err, err) { + if tc.changed != changed { t.Errorf("expected changed %t, got %t", tc.changed, changed) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go index 3c1b851a211f..eee0c6c9f322 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller_test.go @@ -30,9 +30,11 @@ func TestSyncSecret(t *testing.T) { kubeClient := fake.NewSimpleClientset( &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "config", Name: "foo"}, + Type: corev1.SecretTypeOpaque, }, &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "operator", Name: "to-remove"}, + Type: corev1.SecretTypeOpaque, }, ) @@ -79,9 +81,9 @@ func TestSyncSecret(t *testing.T) { destinationSecretBarChecked = true destinationSecretBarCheckedMutex.Unlock() case "empty-source": - destinationSecretBarCheckedMutex.Lock() + destinationSecretEmptySourceCheckedMutex.Lock() destinationSecretEmptySourceChecked = true - destinationSecretBarCheckedMutex.Unlock() + destinationSecretEmptySourceCheckedMutex.Unlock() } } return false, nil, nil diff --git a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go index 055a6c68e836..48d3a92ba5d9 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/staticpodstate/staticpodstate_controller.go @@ -4,8 +4,10 @@ import ( "context" "fmt" "strings" + "time" operatorv1 "github.com/openshift/api/operator/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/informers" @@ -19,10 +21,6 @@ import ( "github.com/openshift/library-go/pkg/operator/v1helpers" ) -var ( - staticPodStateControllerWorkQueueKey = "key" -) - // StaticPodStateController is a controller that watches static pods and will produce a failing status if the //// static pods start crashing for some reason. type StaticPodStateController struct { @@ -58,7 +56,17 @@ func NewStaticPodStateController( podsGetter: podsGetter, versionRecorder: versionRecorder, } - return factory.New().WithInformers(operatorClient.Informer(), kubeInformersForTargetNamespace.Core().V1().Pods().Informer()).WithSync(c.sync).ToController("StaticPodStateController", eventRecorder) + return factory.New().WithInformers( + operatorClient.Informer(), + kubeInformersForTargetNamespace.Core().V1().Pods().Informer(), + ).WithSync(c.sync).ResyncEvery(30*time.Second).ToController("StaticPodStateController", eventRecorder) +} + +func describeWaitingContainerState(waiting *v1.ContainerStateWaiting) string { + if waiting == nil { + return "unknown reason" + } + return fmt.Sprintf("%s: %s", waiting.Reason, waiting.Message) } func (c *StaticPodStateController) sync(ctx context.Context, syncCtx factory.SyncContext) error { @@ -88,15 +96,18 @@ func (c *StaticPodStateController) sync(ctx context.Context, syncCtx factory.Syn // When container is not ready, we can't determine whether the operator is failing or not and every container will become not // ready when created, so do not blip the failing state for it. // We will still reflect the container not ready state in error conditions, but we don't set the operator as failed. - errs = append(errs, fmt.Errorf("nodes/%s pods/%s container=%q is not ready", node.NodeName, pod.Name, containerStatus.Name)) + errs = append(errs, fmt.Errorf("pod/%s container %q is not ready: %s", pod.Name, containerStatus.Name, describeWaitingContainerState(containerStatus.State.Waiting))) } + // if container status is waiting, but not initializing pod, increase the failing error counter + // this usually means the container is stucked on initializing network if containerStatus.State.Waiting != nil && containerStatus.State.Waiting.Reason != "PodInitializing" { - errs = append(errs, fmt.Errorf("nodes/%s pods/%s container=%q is waiting: %q - %q", node.NodeName, pod.Name, containerStatus.Name, containerStatus.State.Waiting.Reason, containerStatus.State.Waiting.Message)) + errs = append(errs, fmt.Errorf("pod/%s container %q is waiting: %s", pod.Name, containerStatus.Name, describeWaitingContainerState(containerStatus.State.Waiting))) failingErrorCount++ } if containerStatus.State.Terminated != nil { // Containers can be terminated gracefully to trigger certificate reload, do not report these as failures. - errs = append(errs, fmt.Errorf("nodes/%s pods/%s container=%q is terminated: %q - %q", node.NodeName, pod.Name, containerStatus.Name, containerStatus.State.Terminated.Reason, containerStatus.State.Terminated.Message)) + errs = append(errs, fmt.Errorf("pod/%s container %q is terminated: %s: %s", pod.Name, containerStatus.Name, containerStatus.State.Terminated.Reason, + containerStatus.State.Terminated.Message)) // Only in case when the termination was caused by error. if containerStatus.State.Terminated.ExitCode != 0 { failingErrorCount++ diff --git a/vendor/github.com/openshift/library-go/test/library/metrics/query.go b/vendor/github.com/openshift/library-go/test/library/metrics/query.go index ad9ac4e0b4ea..de9f34625152 100644 --- a/vendor/github.com/openshift/library-go/test/library/metrics/query.go +++ b/vendor/github.com/openshift/library-go/test/library/metrics/query.go @@ -60,7 +60,7 @@ func NewPrometheusClient(ctx context.Context, kclient *kubernetes.Clientset, rc func createClient(ctx context.Context, kclient *kubernetes.Clientset, host, bearerToken string) (prometheusv1.API, error) { // retrieve router CA - routerCAConfigMap, err := kclient.CoreV1().ConfigMaps("openshift-config-managed").Get(ctx, "router-ca", metav1.GetOptions{}) + routerCAConfigMap, err := kclient.CoreV1().ConfigMaps("openshift-config-managed").Get(ctx, "default-ingress-cert", metav1.GetOptions{}) if err != nil { return nil, err } diff --git a/vendor/github.com/pkg/profile/.travis.yml b/vendor/github.com/pkg/profile/.travis.yml index fd72871e04e6..1c9e6bb6bc6e 100644 --- a/vendor/github.com/pkg/profile/.travis.yml +++ b/vendor/github.com/pkg/profile/.travis.yml @@ -1,8 +1,8 @@ language: go go_import_path: github.com/pkg/profile go: + - 1.10.x - 1.12.x - - 1.13.x - tip script: diff --git a/vendor/github.com/pkg/profile/go.mod b/vendor/github.com/pkg/profile/go.mod deleted file mode 100644 index 2d82f3d846fc..000000000000 --- a/vendor/github.com/pkg/profile/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/pkg/profile - -go 1.12 diff --git a/vendor/github.com/pkg/profile/mutex.go b/vendor/github.com/pkg/profile/mutex.go new file mode 100644 index 000000000000..e69c5b44d886 --- /dev/null +++ b/vendor/github.com/pkg/profile/mutex.go @@ -0,0 +1,13 @@ +// +build go1.8 + +package profile + +import "runtime" + +func enableMutexProfile() { + runtime.SetMutexProfileFraction(1) +} + +func disableMutexProfile() { + runtime.SetMutexProfileFraction(0) +} diff --git a/vendor/github.com/pkg/profile/mutex17.go b/vendor/github.com/pkg/profile/mutex17.go new file mode 100644 index 000000000000..b004c21d5683 --- /dev/null +++ b/vendor/github.com/pkg/profile/mutex17.go @@ -0,0 +1,9 @@ +// +build !go1.8 + +package profile + +// mock mutex support for Go 1.7 and earlier. + +func enableMutexProfile() {} + +func disableMutexProfile() {} diff --git a/vendor/github.com/pkg/profile/profile.go b/vendor/github.com/pkg/profile/profile.go index b9fdfcfd88f2..20e285427ed1 100644 --- a/vendor/github.com/pkg/profile/profile.go +++ b/vendor/github.com/pkg/profile/profile.go @@ -10,7 +10,6 @@ import ( "path/filepath" "runtime" "runtime/pprof" - "runtime/trace" "sync/atomic" ) @@ -21,7 +20,6 @@ const ( blockMode traceMode threadCreateMode - goroutineMode ) // Profile represents an active profiling session. @@ -100,10 +98,6 @@ func TraceProfile(p *Profile) { p.mode = traceMode } // It disables any previous profiling settings. func ThreadcreationProfile(p *Profile) { p.mode = threadCreateMode } -// GoroutineProfile enables goroutine profiling. -// It disables any previous profiling settings. -func GoroutineProfile(p *Profile) { p.mode = goroutineMode } - // ProfilePath controls the base path where various profiling // files are written. If blank, the base path will be generated // by ioutil.TempDir. @@ -195,14 +189,14 @@ func Start(options ...func(*Profile)) interface { if err != nil { log.Fatalf("profile: could not create mutex profile %q: %v", fn, err) } - runtime.SetMutexProfileFraction(1) + enableMutexProfile() logf("profile: mutex profiling enabled, %s", fn) prof.closer = func() { if mp := pprof.Lookup("mutex"); mp != nil { mp.WriteTo(f, 0) } f.Close() - runtime.SetMutexProfileFraction(0) + disableMutexProfile() logf("profile: mutex profiling disabled, %s", fn) } @@ -242,29 +236,14 @@ func Start(options ...func(*Profile)) interface { if err != nil { log.Fatalf("profile: could not create trace output file %q: %v", fn, err) } - if err := trace.Start(f); err != nil { + if err := startTrace(f); err != nil { log.Fatalf("profile: could not start trace: %v", err) } logf("profile: trace enabled, %s", fn) prof.closer = func() { - trace.Stop() + stopTrace() logf("profile: trace disabled, %s", fn) } - - case goroutineMode: - fn := filepath.Join(path, "goroutine.pprof") - f, err := os.Create(fn) - if err != nil { - log.Fatalf("profile: could not create goroutine profile %q: %v", fn, err) - } - logf("profile: goroutine profiling enabled, %s", fn) - prof.closer = func() { - if mp := pprof.Lookup("goroutine"); mp != nil { - mp.WriteTo(f, 0) - } - f.Close() - logf("profile: goroutine profiling disabled, %s", fn) - } } if !prof.noShutdownHook { diff --git a/vendor/github.com/pkg/profile/trace.go b/vendor/github.com/pkg/profile/trace.go new file mode 100644 index 000000000000..b349ed8b2519 --- /dev/null +++ b/vendor/github.com/pkg/profile/trace.go @@ -0,0 +1,8 @@ +// +build go1.7 + +package profile + +import "runtime/trace" + +var startTrace = trace.Start +var stopTrace = trace.Stop diff --git a/vendor/github.com/pkg/profile/trace16.go b/vendor/github.com/pkg/profile/trace16.go new file mode 100644 index 000000000000..6aa6566ef6d6 --- /dev/null +++ b/vendor/github.com/pkg/profile/trace16.go @@ -0,0 +1,10 @@ +// +build !go1.7 + +package profile + +import "io" + +// mock trace support for Go 1.6 and earlier. + +func startTrace(w io.Writer) error { return nil } +func stopTrace() {} diff --git a/vendor/gopkg.in/asn1-ber.v1/.travis.yml b/vendor/gopkg.in/asn1-ber.v1/.travis.yml index 4ad2067b2189..ecf413251b94 100644 --- a/vendor/gopkg.in/asn1-ber.v1/.travis.yml +++ b/vendor/gopkg.in/asn1-ber.v1/.travis.yml @@ -18,14 +18,12 @@ matrix: - go: 1.9.x - go: 1.10.x - go: 1.11.x - - go: 1.12.x - - go: 1.13.x env: GOOS=linux GOARCH=amd64 - - go: 1.13.x + - go: 1.11.x env: GOOS=linux GOARCH=386 - - go: 1.13.x + - go: 1.11.x env: GOOS=windows GOARCH=amd64 - - go: 1.13.x + - go: 1.11.x env: GOOS=windows GOARCH=386 - go: tip go_import_path: gopkg.in/asn-ber.v1 diff --git a/vendor/gopkg.in/asn1-ber.v1/ber.go b/vendor/gopkg.in/asn1-ber.v1/ber.go index 1e186cb8fc5a..6153f460688c 100644 --- a/vendor/gopkg.in/asn1-ber.v1/ber.go +++ b/vendor/gopkg.in/asn1-ber.v1/ber.go @@ -160,10 +160,6 @@ func PrintBytes(out io.Writer, buf []byte, indent string) { } } -func WritePacket(out io.Writer, p *Packet) { - printPacket(out, p, 0, false) -} - func PrintPacket(p *Packet) { printPacket(os.Stdout, p, 0, false) } @@ -472,22 +468,6 @@ func NewBoolean(ClassType Class, TagType Type, Tag Tag, Value bool, Description return p } -// NewLDAPBoolean returns a RFC 4511-compliant Boolean packet -func NewLDAPBoolean(Value bool, Description string) *Packet { - intValue := int64(0) - - if Value { - intValue = 255 - } - - p := Encode(ClassUniversal, TypePrimitive, TagBoolean, nil, Description) - - p.Value = Value - p.Data.Write(encodeInteger(intValue)) - - return p -} - func NewInteger(ClassType Class, TagType Type, Tag Tag, Value interface{}, Description string) *Packet { p := Encode(ClassType, TagType, Tag, nil, Description) diff --git a/vendor/gopkg.in/asn1-ber.v1/ber_test.go b/vendor/gopkg.in/asn1-ber.v1/ber_test.go index 650fe24a8062..a5cc53d64d79 100644 --- a/vendor/gopkg.in/asn1-ber.v1/ber_test.go +++ b/vendor/gopkg.in/asn1-ber.v1/ber_test.go @@ -42,27 +42,6 @@ func TestBoolean(t *testing.T) { } -func TestLDAPBoolean(t *testing.T) { - var value bool = true - - packet := NewLDAPBoolean(value, "first Packet, True") - - newBoolean, ok := packet.Value.(bool) - if !ok || newBoolean != value { - t.Error("error during creating packet") - } - - encodedPacket := packet.Bytes() - - newPacket := DecodePacket(encodedPacket) - - newBoolean, ok = newPacket.Value.(bool) - if !ok || newBoolean != value { - t.Error("error during decoding packet") - } - -} - func TestInteger(t *testing.T) { var value int64 = 10 diff --git a/vendor/gopkg.in/asn1-ber.v1/go.mod b/vendor/gopkg.in/asn1-ber.v1/go.mod deleted file mode 100644 index ee0b4be2c2f5..000000000000 --- a/vendor/gopkg.in/asn1-ber.v1/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/go-asn1-ber/asn1-ber - -go 1.13 diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/validation/types.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/validation/types.go index e66342a7f18f..6a9f68c0dbd2 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/validation/types.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/validation/types.go @@ -210,7 +210,7 @@ func (item *primitiveItem) VisitPrimitive(schema *proto.Primitive) { } case proto.Number: switch item.Kind { - case proto.Integer, proto.Number: + case proto.Number: return } case proto.String: From 4ab4d05061141d810604772a96ee8e15cd58045b Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 23 Apr 2020 19:25:10 -0400 Subject: [PATCH 2/2] vendor: Updated go.mod --- glide.lock | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/glide.lock b/glide.lock index 583e5d944011..5f8be2de8c05 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: a4ad97a7f4c4fb2fdbde6b06317d2e5d45c00aec810d42a12d3d0b2bb9657c1d -updated: 2020-04-08T14:09:46.502924+02:00 +updated: 2020-04-23T17:16:44.774089984-04:00 imports: - name: bitbucket.org/ww/goautoneg version: a7dc8b61c822528f973a5e4e7b272055c6fdb43e @@ -98,7 +98,7 @@ imports: - name: github.com/blang/semver version: b38d23b8782a487059e8fc8773e9a5b228a77cb6 - name: github.com/certifi/gocertifi - version: c7c1fbc02894e7114f06f6a4d9ab31eee2225bdb + version: ee1a9a0726d2ae45f54118cac878c990d4016ded - name: github.com/chai2010/gettext-go version: c6fed771bfd517099caf0f7a961671fa8ed08723 subpackages: @@ -137,7 +137,7 @@ imports: - errdefs - namespaces - name: github.com/containerd/continuity - version: 0f16d7a0959cac64d7a54ce015e50cf4839d1970 + version: 75bee3e2ccb6402e3a986ab8bd3b17003fc0fdec subpackages: - fs - pathdriver @@ -213,6 +213,7 @@ imports: - client - daemon/logger/jsonfilelog/jsonlog - errdefs + - opts - pkg/archive - pkg/fileutils - pkg/homedir @@ -240,6 +241,7 @@ imports: - name: github.com/docker/libnetwork version: c8a5fca4a6529415d24c9066fd833b87012bcd79 subpackages: + - ipamutils - ipvs - name: github.com/docker/libtrust version: aabc10ec26b754e797f9028f4589c5b7bd90dc20 @@ -277,9 +279,9 @@ imports: - name: github.com/fsnotify/fsnotify version: c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9 - name: github.com/fsouza/go-dockerclient - version: 8f346910cc5ab4f6e8028f61ec025465a8624bfa + version: da3951ba2e9e02bc0e7642150b3e265aed7e1df3 - name: github.com/getsentry/raven-go - version: 5c24d5110e0e198d9ae16f1f3465366085001d92 + version: c977f96e109525a5d8fa10a19165341f601f38b0 - name: github.com/ghodss/yaml version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 - name: github.com/go-openapi/analysis @@ -355,7 +357,7 @@ imports: - name: github.com/gonum/floats version: c233463c7e827fd71a8cdb62dfda0e98f7c39ad5 - name: github.com/gonum/graph - version: 678096d81a4bff34d364a7ee4ecf11cc198f8ae2 + version: 50b27dea7ebbfb052dfaf91681afc6fde28d8796 subpackages: - encoding/dot - formats/dot @@ -671,7 +673,7 @@ imports: - name: github.com/NYTimes/gziphandler version: 56545f4a5d46df9a6648819d1664c3a03a13ffdb - name: github.com/onsi/ginkgo - version: 67da0dd32db383f566d9d2b6559bf1d0ef03b5cb + version: 1aab3d369085457df3932c06a0bcdbc754eeb71f repo: https://github.com/openshift/onsi-ginkgo.git subpackages: - config @@ -749,7 +751,7 @@ imports: - go-selinux - go-selinux/label - name: github.com/openshift/api - version: 585af27e34fd9db26ec411ba276fe2a378ef69d7 + version: f24cbf292bdd6e6de1eec495ef88b00689d50c79 subpackages: - annotations - apps @@ -801,7 +803,7 @@ imports: - user - user/v1 - name: github.com/openshift/apiserver-library-go - version: 263ee09c7716fae62cf956eb6155ed7c1bc0ad2b + version: 2114e7ebb6a68d4c2113f4205ef0cbfe0530511c subpackages: - pkg/admission/imagepolicy - pkg/admission/imagepolicy/apis/imagepolicy/v1 @@ -821,7 +823,7 @@ imports: - pkg/securitycontextconstraints/util - pkg/securitycontextconstraints/util/sort - name: github.com/openshift/client-go - version: 2a6cd50aedd02a8b1573c0de49169a43061cf587 + version: 6f6c07fc2a70e0b3fab8bfbe1b933907eedbc4de subpackages: - apps/clientset/versioned - apps/clientset/versioned/scheme @@ -925,7 +927,7 @@ imports: - user/informers/externalversions/user/v1 - user/listers/user/v1 - name: github.com/openshift/library-go - version: 05357b77e21e1ec3f9ae06f6344e237d0e72fc40 + version: b0e5b39cd9e72b03dfe114db19cf6861cf4375bf subpackages: - pkg/apiserver/admission/admissionrestconfig - pkg/apiserver/admission/admissiontimeout @@ -977,7 +979,7 @@ imports: - name: github.com/pkg/errors version: 645ef00459ed84a119197bfb8d8205042c6df63d - name: github.com/pkg/profile - version: acd64d450fd45fb2afa41f833f3788c8a7797219 + version: f6fe06335df110bcf1ed6d4e852b760bfc15beee - name: github.com/pmezard/go-difflib version: 792786c7400a136282c1664665ae0a8db921c6c2 subpackages: @@ -1460,6 +1462,8 @@ imports: - internal/resolver/passthrough - internal/syscall - internal/transport + - interop + - interop/grpc_testing - keepalive - metadata - naming @@ -1472,7 +1476,7 @@ imports: - status - tap - name: gopkg.in/asn1-ber.v1 - version: effdc98edfb5dde0d9fd8dfba266f6483e6ce9f0 + version: f715ec2f112d1e4195b827ad68cf44017a3ef2b1 - name: gopkg.in/fsnotify.v1 version: c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9 - name: gopkg.in/gcfg.v1 @@ -2312,7 +2316,7 @@ imports: - pkg/apis/deviceplugin/v1beta1 - pkg/apis/pluginregistration/v1 - name: k8s.io/kubernetes - version: 754da5451727326671fbee043b64452ab0570572 + version: 51b6cdd383749178d3a8889875d61692f49fcc7c repo: https://github.com/openshift/kubernetes.git subpackages: - cmd/cloud-controller-manager/app