diff --git a/internal/tools/crawler/github/split_search_ranges.go b/internal/tools/crawler/github/split_search_ranges.go index bde643d5c..e62ea655a 100644 --- a/internal/tools/crawler/github/split_search_ranges.go +++ b/internal/tools/crawler/github/split_search_ranges.go @@ -303,7 +303,7 @@ func FindRangesForRepoSearch(cache cachedSearch) ([]string, error) { } if nextAccessible < filesAccessible { return nil, fmt.Errorf( - "Number of results dropped from %d to %d within range search", + "number of results dropped from %d to %d within range search", filesAccessible, nextAccessible) } diff --git a/kustomize/go.mod b/kustomize/go.mod index b68675be1..9cc946603 100644 --- a/kustomize/go.mod +++ b/kustomize/go.mod @@ -6,6 +6,12 @@ require ( github.com/pkg/errors v0.8.1 github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 + gopkg.in/inf.v0 v0.9.1 // indirect sigs.k8s.io/kustomize/v3 v3.2.0 sigs.k8s.io/yaml v1.1.0 ) + +// Temporarily drop this replacement, and select a specific +// version of sig.k8s.io/kustomize (the API module) before +// tagging and releasing this module (the kustomize CLI). +replace sigs.k8s.io/kustomize/v3 v3.2.0 => ../../kustomize diff --git a/kustomize/go.sum b/kustomize/go.sum index ab0d164c3..033e5de26 100644 --- a/kustomize/go.sum +++ b/kustomize/go.sum @@ -1,29 +1,51 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.9.6+incompatible h1:tfrHha8zJ01ywiOEC1miGY8st1/igzWB8OmvPgoYX7w= -github.com/emicklei/go-restful v2.9.6+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 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/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-critic/go-critic v0.3.5-0.20190904082202-d79a9f0c64db/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.19.2 h1:A9+F4Dc/MCNB5jibxf6rRvOvR/iFgQdyNx9eIhnGqq0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -36,74 +58,161 @@ github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcs github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.19.2 h1:jvO6bCMBEilGwMfHhrd61zIID4oIFdwb76V17SM88dE= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +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= +github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= +github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= +github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= +github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= +github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= +github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 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.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7 h1:VoRHccBV7zFWlO/I85D1ke/x5Ak9Y7gKm9gkf7LHNhI= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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/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/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= +github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= +github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= +github.com/golangci/golangci-lint v1.19.1/go.mod h1:2CEc4Fxx3vxDv7g8DyXkHCBF73AOzAymcJAprs2vCps= +github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= +github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367 h1:ScAXWS+TR6MZKex+7Z8rneuSJH+FSDqd6ocQyl+ZHo4= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9 h1:Dk8DO58y0wXeNG49dRqzf4HrZAK9lFfTgS/FNtB6NlM= github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= -github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 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/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3 h1:/UewZcckqhvnnS0C6r3Sher2hSEbVmM6Ogpcjen08+Y= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63 h1:nTT4s92Dgz2HlrB2NaMgvlfqHH39OgMhA7z3PK7PGD4= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 h1:IaSjLMT6WvkoZZjspGxy3rdaTEmWLoRm49WbtVUi9sA= -github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da h1:ZQGIPjr1iTtUPXZFk8WShqb5G+Qg65VHFLtSvmHh+Mw= github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -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/monopole/mdrip v0.2.48/go.mod h1:rzORfdNQ63T/tS95GOFHB+I3OrT+Bjlk8krOc/QiL/8= +github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c h1:Hww8mOyEKTeON4bZn7FrlLismspbPc1teNRUVH7wLQ8= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.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 v0.0.0-20170829124025-dcabb60a477c h1:eSfnfIuwhxZyULg1NNuZycJcYkjYVGYe7FczwQReM6U= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +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/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/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 v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/securego/gosec v0.0.0-20190912120752-140048b2a218/go.mod h1:q6oYAujd2qyeU4cJqIri4LBIgdHXGvxWHZ1E29HNFRE= +github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= 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.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -112,57 +221,125 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= 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/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.3/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= +github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/net v0.0.0-20170114055629-f2499483f923/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-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/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-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190909003024-a7b16738d86b h1:XfVGCX+0T4WOStkaOsJRllbsiImhB2jgVBGc9L0lPGc= +golang.org/x/net v0.0.0-20190909003024-a7b16738d86b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +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-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-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +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-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/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-20190222072716-a9d3bda3a223/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-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190621203818-d432491b9138 h1:t8BZD9RDjkm9/h7yYN6kE8oaeov5r9aztkB7zKA5Tkg= -golang.org/x/sys v0.0.0-20190621203818-d432491b9138/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5 h1:SW/0nsKCUaozCUtZTakri5laocGx/5bkDSSLrFUsa5s= +golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/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-20181011042414-1f849cf54d09/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-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/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-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911230505-6bfd74cf029c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= 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.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= 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= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= k8s.io/api v0.0.0-20190313235455-40a48860b5ab h1:DG9A67baNpoeweOy2spF1OWHhnVY5KR7/Ek/+U1lVZc= k8s.io/api v0.0.0-20190313235455-40a48860b5ab/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= k8s.io/apimachinery v0.0.0-20190313205120-d7deff9243b1 h1:IS7K02iBkQXpCeieSiyJjGoLSdVOv2DbPaWHJ+ZtgKg= @@ -172,12 +349,13 @@ k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyod k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92 h1:PgoMI/L1Nu5Vmvgm+vGheLuxKST8h6FMOqggyAFtHPc= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.3 h1:niceAagH1tzskmaie/icWd7ci1wbG7Bf2c6YGcQv+3c= -k8s.io/klog v0.3.3/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 h1:5sW+fEHvlJI3Ngolx30CmubFulwH28DhKjGf70Xmtco= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4= -sigs.k8s.io/kustomize/v3 v3.2.0 h1:EKcEubO29vCbigcMoNynfyZH+ANWkML2UHWibt1Do7o= -sigs.k8s.io/kustomize/v3 v3.2.0/go.mod h1:ztX4zYc/QIww3gSripwF7TBOarBTm5BvyAMem0kCzOE= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= +mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= +sigs.k8s.io/kustomize/pluginator v1.0.0/go.mod h1:i8HdU5FdH1zDjCKiFf5CNl7slsc0QffyKsY2OuPynJ0= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/kustomize/internal/commands/build/build.go b/kustomize/internal/commands/build/build.go index 1fd5d75b6..c3a165226 100644 --- a/kustomize/internal/commands/build/build.go +++ b/kustomize/internal/commands/build/build.go @@ -68,7 +68,7 @@ func NewCmdBuild( cmd := &cobra.Command{ Use: "build {path}", - Short: "Print configuration per contents of " + pgmconfig.KustomizationFileNames[0], + Short: "Print configuration per contents of " + pgmconfig.KustomizationFileName0, Example: examples, SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { @@ -96,7 +96,7 @@ func NewCmdBuild( func (o *Options) Validate(args []string) (err error) { if len(args) > 1 { return errors.New( - "specify one path to " + pgmconfig.KustomizationFileNames[0]) + "specify one path to " + pgmconfig.KustomizationFileName0) } if len(args) == 0 { o.kustomizationPath = loader.CWD diff --git a/kustomize/internal/commands/build/build_test.go b/kustomize/internal/commands/build/build_test.go index 3fb9deb3c..47c17bca4 100644 --- a/kustomize/internal/commands/build/build_test.go +++ b/kustomize/internal/commands/build/build_test.go @@ -26,7 +26,7 @@ func TestBuildValidate(t *testing.T) { {"file", []string{"beans"}, "beans", ""}, {"path", []string{"a/b/c"}, "a/b/c", ""}, {"path", []string{"too", "many"}, - "", "specify one path to " + pgmconfig.KustomizationFileNames[0]}, + "", "specify one path to " + pgmconfig.KustomizationFileName0}, } for _, mycase := range cases { opts := Options{} diff --git a/kustomize/internal/commands/commands.go b/kustomize/internal/commands/commands.go index 3dcf6f586..907972e8a 100644 --- a/kustomize/internal/commands/commands.go +++ b/kustomize/internal/commands/commands.go @@ -25,7 +25,7 @@ import ( // NewDefaultCommand returns the default (aka root) command for kustomize command. func NewDefaultCommand() *cobra.Command { - fSys := fs.MakeRealFS() + fSys := fs.MakeFsOnDisk() stdOut := os.Stdout c := &cobra.Command{ diff --git a/kustomize/internal/commands/config/config_test.go b/kustomize/internal/commands/config/config_test.go index e54691970..fc96ddf04 100644 --- a/kustomize/internal/commands/config/config_test.go +++ b/kustomize/internal/commands/config/config_test.go @@ -29,9 +29,9 @@ func TestValidate(t *testing.T) { } func TestComplete(t *testing.T) { - fsys := fs.MakeFakeFS() - fsys.Mkdir("/some/dir") - fsys.WriteFile("/some/file", []byte(`some file`)) + fSys := fs.MakeFsInMemory() + fSys.Mkdir("/some/dir") + fSys.WriteFile("/some/file", []byte(`some file`)) type testcase struct { dir string @@ -54,7 +54,7 @@ func TestComplete(t *testing.T) { for _, tcase := range testcases { o := saveOptions{saveDirectory: tcase.dir} - actual := o.Complete(fsys) + actual := o.Complete(fSys) if !reflect.DeepEqual(actual, tcase.expect) { t.Fatalf("Expected %v\n but bot %v\n", tcase.expect, actual) } @@ -62,13 +62,13 @@ func TestComplete(t *testing.T) { } func TestRunSave(t *testing.T) { - fsys := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() o := saveOptions{saveDirectory: "/some/dir"} - err := o.RunSave(fsys) + err := o.RunSave(fSys) if err != nil { t.Fatalf("Unexpected error %v", err) } - if !fsys.Exists("/some/dir/nameprefix.yaml") { + if !fSys.Exists("/some/dir/nameprefix.yaml") { t.Fatal("default configurations are not successfully save.") } } diff --git a/kustomize/internal/commands/create/create.go b/kustomize/internal/commands/create/create.go index 469c7c186..6fef7867f 100644 --- a/kustomize/internal/commands/create/create.go +++ b/kustomize/internal/commands/create/create.go @@ -162,7 +162,7 @@ func detectResources(fSys fs.FileSystem, uf ifc.KunstructuredFactory, base strin } // If a sub-directory contains an existing kustomization file add the // directory as a resource and do not decend into it. - for _, kfilename := range pgmconfig.KustomizationFileNames { + for _, kfilename := range pgmconfig.KustomizationFileNames() { if fSys.Exists(filepath.Join(path, kfilename)) { paths = append(paths, path) return filepath.SkipDir diff --git a/kustomize/internal/commands/create/create_test.go b/kustomize/internal/commands/create/create_test.go index 60e27965a..c4451de9f 100644 --- a/kustomize/internal/commands/create/create_test.go +++ b/kustomize/internal/commands/create/create_test.go @@ -15,8 +15,8 @@ import ( var factory = kunstruct.NewKunstructuredFactoryImpl() -func readKustomizationFS(t *testing.T, fakeFS fs.FileSystem) *types.Kustomization { - kf, err := kustfile.NewKustomizationFile(fakeFS) +func readKustomizationFS(t *testing.T, fSys fs.FileSystem) *types.Kustomization { + kf, err := kustfile.NewKustomizationFile(fSys) if err != nil { t.Errorf("unexpected new error %v", err) } @@ -27,25 +27,25 @@ func readKustomizationFS(t *testing.T, fakeFS fs.FileSystem) *types.Kustomizatio return m } func TestCreateNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() - cmd := NewCmdCreate(fakeFS, factory) + fSys := fs.MakeFsInMemory() + cmd := NewCmdCreate(fSys, factory) err := cmd.RunE(cmd, []string{}) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - readKustomizationFS(t, fakeFS) + readKustomizationFS(t, fSys) } func TestCreateWithResources(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile("foo.yaml", []byte("")) - fakeFS.WriteFile("bar.yaml", []byte("")) + fSys := fs.MakeFsInMemory() + fSys.WriteFile("foo.yaml", []byte("")) + fSys.WriteFile("bar.yaml", []byte("")) opts := createFlags{resources: "foo.yaml,bar.yaml"} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) expected := []string{"foo.yaml", "bar.yaml"} if !reflect.DeepEqual(m.Resources, expected) { t.Fatalf("expected %+v but got %+v", expected, m.Resources) @@ -53,14 +53,14 @@ func TestCreateWithResources(t *testing.T) { } func TestCreateWithNamespace(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() want := "foo" opts := createFlags{namespace: want} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) got := m.Namespace if got != want { t.Errorf("want: %s, got: %s", want, got) @@ -68,13 +68,13 @@ func TestCreateWithNamespace(t *testing.T) { } func TestCreateWithLabels(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() opts := createFlags{labels: "foo:bar"} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) expected := map[string]string{"foo": "bar"} if !reflect.DeepEqual(m.CommonLabels, expected) { t.Fatalf("expected %+v but got %+v", expected, m.CommonLabels) @@ -82,13 +82,13 @@ func TestCreateWithLabels(t *testing.T) { } func TestCreateWithAnnotations(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() opts := createFlags{annotations: "foo:bar"} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) expected := map[string]string{"foo": "bar"} if !reflect.DeepEqual(m.CommonAnnotations, expected) { t.Fatalf("expected %+v but got %+v", expected, m.CommonAnnotations) @@ -96,14 +96,14 @@ func TestCreateWithAnnotations(t *testing.T) { } func TestCreateWithNamePrefix(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() want := "foo-" opts := createFlags{prefix: want} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) got := m.NamePrefix if got != want { t.Errorf("want: %s, got: %s", want, got) @@ -111,68 +111,68 @@ func TestCreateWithNamePrefix(t *testing.T) { } func TestCreateWithNameSuffix(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() opts := createFlags{suffix: "-foo"} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) if m.NameSuffix != "-foo" { t.Errorf("want: -foo, got: %s", m.NameSuffix) } } -func writeDetectContent(fakeFS fs.FileSystem) { - fakeFS.WriteFile("/test.yaml", []byte(` +func writeDetectContent(fSys fs.FileSystem) { + fSys.WriteFile("/test.yaml", []byte(` apiVersion: v1 kind: Service metadata: name: test`)) - fakeFS.WriteFile("/README.md", []byte(` + fSys.WriteFile("/README.md", []byte(` # Not a k8s resource This file is not a valid kubernetes object.`)) - fakeFS.WriteFile("/non-k8s.yaml", []byte(` + fSys.WriteFile("/non-k8s.yaml", []byte(` # Not a k8s resource other: yaml foo: - bar - baz`)) - fakeFS.Mkdir("/sub") - fakeFS.WriteFile("/sub/test.yaml", []byte(` + fSys.Mkdir("/sub") + fSys.WriteFile("/sub/test.yaml", []byte(` apiVersion: v1 kind: Service metadata: name: test2`)) - fakeFS.WriteFile("/sub/README.md", []byte(` + fSys.WriteFile("/sub/README.md", []byte(` # Not a k8s resource This file in a subdirectory is not a valid kubernetes object.`)) - fakeFS.WriteFile("/sub/non-k8s.yaml", []byte(` + fSys.WriteFile("/sub/non-k8s.yaml", []byte(` # Not a k8s resource other: yaml foo: - bar - baz`)) - fakeFS.Mkdir("/overlay") - fakeFS.WriteFile("/overlay/test.yaml", []byte(` + fSys.Mkdir("/overlay") + fSys.WriteFile("/overlay/test.yaml", []byte(` apiVersion: v1 kind: Service metadata: name: test3`)) - fakeFS.WriteFile("/overlay/kustomization.yaml", []byte(` + fSys.WriteFile("/overlay/kustomization.yaml", []byte(` resources: - test.yaml`)) } func TestCreateWithDetect(t *testing.T) { - fakeFS := fs.MakeFakeFS() - writeDetectContent(fakeFS) + fSys := fs.MakeFsInMemory() + writeDetectContent(fSys) opts := createFlags{path: "/", detectResources: true} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Fatalf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) expected := []string{"/test.yaml"} if !reflect.DeepEqual(m.Resources, expected) { t.Fatalf("expected %+v but got %+v", expected, m.Resources) @@ -180,14 +180,14 @@ func TestCreateWithDetect(t *testing.T) { } func TestCreateWithDetectRecursive(t *testing.T) { - fakeFS := fs.MakeFakeFS() - writeDetectContent(fakeFS) + fSys := fs.MakeFsInMemory() + writeDetectContent(fSys) opts := createFlags{path: "/", detectResources: true, detectRecursive: true} - err := runCreate(opts, fakeFS, factory) + err := runCreate(opts, fSys, factory) if err != nil { t.Fatalf("unexpected cmd error: %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) expected := []string{"/overlay", "/sub/test.yaml", "/test.yaml"} if !reflect.DeepEqual(m.Resources, expected) { t.Fatalf("expected %+v but got %+v", expected, m.Resources) diff --git a/kustomize/internal/commands/edit/add/addbase_test.go b/kustomize/internal/commands/edit/add/addbase_test.go index 01a80d190..ca5ee54ae 100644 --- a/kustomize/internal/commands/edit/add/addbase_test.go +++ b/kustomize/internal/commands/edit/add/addbase_test.go @@ -8,6 +8,7 @@ import ( "testing" "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -16,20 +17,20 @@ const ( ) func TestAddBaseHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() bases := strings.Split(baseDirectoryPaths, ",") for _, base := range bases { - fakeFS.Mkdir(base) + fSys.Mkdir(base) } - fakeFS.WriteTestKustomization() + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddBase(fakeFS) + cmd := newCmdAddBase(fSys) args := []string{baseDirectoryPaths} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -42,15 +43,15 @@ func TestAddBaseHappyPath(t *testing.T) { } func TestAddBaseAlreadyThere(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() // Create fake directories bases := strings.Split(baseDirectoryPaths, ",") for _, base := range bases { - fakeFS.Mkdir(base) + fSys.Mkdir(base) } - fakeFS.WriteTestKustomization() + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddBase(fakeFS) + cmd := newCmdAddBase(fSys) args := []string{baseDirectoryPaths} err := cmd.RunE(cmd, args) if err != nil { @@ -69,13 +70,12 @@ func TestAddBaseAlreadyThere(t *testing.T) { t.Errorf("unexpected error %v", err) } } - } func TestAddBaseNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdAddBase(fakeFS) + cmd := newCmdAddBase(fSys) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) diff --git a/kustomize/internal/commands/edit/add/addmetadata.go b/kustomize/internal/commands/edit/add/addmetadata.go index 4e44cd911..97d956b28 100644 --- a/kustomize/internal/commands/edit/add/addmetadata.go +++ b/kustomize/internal/commands/edit/add/addmetadata.go @@ -47,7 +47,7 @@ func newCmdAddAnnotation(fSys fs.FileSystem, v func(map[string]string) error) *c o.mapValidator = v cmd := &cobra.Command{ Use: "annotation", - Short: "Adds one or more commonAnnotations to " + pgmconfig.KustomizationFileNames[0], + Short: "Adds one or more commonAnnotations to " + pgmconfig.KustomizationFileName0, Example: ` add annotation {annotationKey1:annotationValue1},{annotationKey2:annotationValue2}`, RunE: func(cmd *cobra.Command, args []string) error { @@ -67,7 +67,7 @@ func newCmdAddLabel(fSys fs.FileSystem, v func(map[string]string) error) *cobra. o.mapValidator = v cmd := &cobra.Command{ Use: "label", - Short: "Adds one or more commonLabels to " + pgmconfig.KustomizationFileNames[0], + Short: "Adds one or more commonLabels to " + pgmconfig.KustomizationFileName0, Example: ` add label {labelKey1:labelValue1},{labelKey2:labelValue2}`, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/kustomize/internal/commands/edit/add/addmetadata_test.go b/kustomize/internal/commands/edit/add/addmetadata_test.go index 3ccb82da3..dbba2beab 100644 --- a/kustomize/internal/commands/edit/add/addmetadata_test.go +++ b/kustomize/internal/commands/edit/add/addmetadata_test.go @@ -7,15 +7,16 @@ import ( "testing" "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" "sigs.k8s.io/kustomize/v3/pkg/types" "sigs.k8s.io/kustomize/v3/pkg/validators" ) func makeKustomization(t *testing.T) *types.Kustomization { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() - kf, err := kustfile.NewKustomizationFile(fakeFS) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) + kf, err := kustfile.NewKustomizationFile(fSys) if err != nil { t.Errorf("unexpected new error %v", err) } @@ -49,9 +50,9 @@ func TestRunAddAnnotation(t *testing.T) { } func TestAddAnnotationNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) err := cmd.Execute() v.VerifyNoCall() if err == nil { @@ -63,9 +64,9 @@ func TestAddAnnotationNoArgs(t *testing.T) { } func TestAddAnnotationInvalidFormat(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeSadMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"whatever:whatever"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -78,10 +79,10 @@ func TestAddAnnotationInvalidFormat(t *testing.T) { } func TestAddAnnotationManyArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"k1:v1,k2:v2,k3:v3,k4:v5"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -91,10 +92,10 @@ func TestAddAnnotationManyArgs(t *testing.T) { } func TestAddAnnotationValueQuoted(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"k1:\"v1\""} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -104,10 +105,10 @@ func TestAddAnnotationValueQuoted(t *testing.T) { } func TestAddAnnotationValueWithColon(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"k1:\"v1:v2\""} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -117,9 +118,9 @@ func TestAddAnnotationValueWithColon(t *testing.T) { } func TestAddAnnotationNoKey(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{":nokey"} err := cmd.RunE(cmd, args) v.VerifyNoCall() @@ -132,10 +133,10 @@ func TestAddAnnotationNoKey(t *testing.T) { } func TestAddAnnotationTooManyColons(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"key:v1:v2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -145,10 +146,10 @@ func TestAddAnnotationTooManyColons(t *testing.T) { } func TestAddAnnotationNoValue(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"no:,value"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -158,10 +159,10 @@ func TestAddAnnotationNoValue(t *testing.T) { } func TestAddAnnotationMultipleArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"this:annotation", "has:spaces"} err := cmd.RunE(cmd, args) v.VerifyNoCall() @@ -174,10 +175,10 @@ func TestAddAnnotationMultipleArgs(t *testing.T) { } func TestAddAnnotationForce(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddAnnotation(fakeFS, v.Validator) + cmd := newCmdAddAnnotation(fSys, v.Validator) args := []string{"key:foo"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -187,7 +188,7 @@ func TestAddAnnotationForce(t *testing.T) { // trying to add the same annotation again should not work args = []string{"key:bar"} v = validators.MakeHappyMapValidator(t) - cmd = newCmdAddAnnotation(fakeFS, v.Validator) + cmd = newCmdAddAnnotation(fSys, v.Validator) err = cmd.RunE(cmd, args) v.VerifyCall() if err == nil { @@ -198,7 +199,7 @@ func TestAddAnnotationForce(t *testing.T) { } // but trying to add it with --force should v = validators.MakeHappyMapValidator(t) - cmd = newCmdAddAnnotation(fakeFS, v.Validator) + cmd = newCmdAddAnnotation(fSys, v.Validator) cmd.Flag("force").Value.Set("true") err = cmd.RunE(cmd, args) v.VerifyCall() @@ -230,9 +231,9 @@ func TestRunAddLabel(t *testing.T) { } func TestAddLabelNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) err := cmd.Execute() v.VerifyNoCall() if err == nil { @@ -244,9 +245,9 @@ func TestAddLabelNoArgs(t *testing.T) { } func TestAddLabelInvalidFormat(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeSadMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{"exclamation!:point"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -259,9 +260,9 @@ func TestAddLabelInvalidFormat(t *testing.T) { } func TestAddLabelNoKey(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{":nokey"} err := cmd.RunE(cmd, args) v.VerifyNoCall() @@ -274,10 +275,10 @@ func TestAddLabelNoKey(t *testing.T) { } func TestAddLabelTooManyColons(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{"key:v1:v2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -287,10 +288,10 @@ func TestAddLabelTooManyColons(t *testing.T) { } func TestAddLabelNoValue(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{"no,value:"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -300,10 +301,10 @@ func TestAddLabelNoValue(t *testing.T) { } func TestAddLabelMultipleArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{"this:input", "has:spaces"} err := cmd.RunE(cmd, args) v.VerifyNoCall() @@ -316,10 +317,10 @@ func TestAddLabelMultipleArgs(t *testing.T) { } func TestAddLabelForce(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) v := validators.MakeHappyMapValidator(t) - cmd := newCmdAddLabel(fakeFS, v.Validator) + cmd := newCmdAddLabel(fSys, v.Validator) args := []string{"key:foo"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -329,7 +330,7 @@ func TestAddLabelForce(t *testing.T) { // trying to add the same label again should not work args = []string{"key:bar"} v = validators.MakeHappyMapValidator(t) - cmd = newCmdAddLabel(fakeFS, v.Validator) + cmd = newCmdAddLabel(fSys, v.Validator) err = cmd.RunE(cmd, args) v.VerifyCall() if err == nil { @@ -340,7 +341,7 @@ func TestAddLabelForce(t *testing.T) { } // but trying to add it with --force should v = validators.MakeHappyMapValidator(t) - cmd = newCmdAddLabel(fakeFS, v.Validator) + cmd = newCmdAddLabel(fSys, v.Validator) cmd.Flag("force").Value.Set("true") err = cmd.RunE(cmd, args) v.VerifyCall() diff --git a/kustomize/internal/commands/edit/add/addpatch_test.go b/kustomize/internal/commands/edit/add/addpatch_test.go index 98450214e..5ba76920d 100644 --- a/kustomize/internal/commands/edit/add/addpatch_test.go +++ b/kustomize/internal/commands/edit/add/addpatch_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -19,18 +20,18 @@ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ) func TestAddPatchHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile(patchFileName, []byte(patchFileContent)) - fakeFS.WriteFile(patchFileName+"another", []byte(patchFileContent)) - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + fSys.WriteFile(patchFileName, []byte(patchFileContent)) + fSys.WriteFile(patchFileName+"another", []byte(patchFileContent)) + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddPatch(fakeFS) + cmd := newCmdAddPatch(fSys) args := []string{patchFileName + "*"} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -43,11 +44,11 @@ func TestAddPatchHappyPath(t *testing.T) { } func TestAddPatchAlreadyThere(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile(patchFileName, []byte(patchFileContent)) - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + fSys.WriteFile(patchFileName, []byte(patchFileContent)) + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddPatch(fakeFS) + cmd := newCmdAddPatch(fSys) args := []string{patchFileName} err := cmd.RunE(cmd, args) if err != nil { @@ -62,9 +63,9 @@ func TestAddPatchAlreadyThere(t *testing.T) { } func TestAddPatchNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdAddPatch(fakeFS) + cmd := newCmdAddPatch(fSys) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) diff --git a/kustomize/internal/commands/edit/add/addresource_test.go b/kustomize/internal/commands/edit/add/addresource_test.go index 026f45737..6a7a5ea25 100644 --- a/kustomize/internal/commands/edit/add/addresource_test.go +++ b/kustomize/internal/commands/edit/add/addresource_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -19,18 +20,18 @@ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ) func TestAddResourceHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile(resourceFileName, []byte(resourceFileContent)) - fakeFS.WriteFile(resourceFileName+"another", []byte(resourceFileContent)) - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + fSys.WriteFile(resourceFileName, []byte(resourceFileContent)) + fSys.WriteFile(resourceFileName+"another", []byte(resourceFileContent)) + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddResource(fakeFS) + cmd := newCmdAddResource(fSys) args := []string{resourceFileName + "*"} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -43,11 +44,11 @@ func TestAddResourceHappyPath(t *testing.T) { } func TestAddResourceAlreadyThere(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile(resourceFileName, []byte(resourceFileContent)) - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + fSys.WriteFile(resourceFileName, []byte(resourceFileContent)) + testutils.WriteTestKustomization(fSys) - cmd := newCmdAddResource(fakeFS) + cmd := newCmdAddResource(fSys) args := []string{resourceFileName} err := cmd.RunE(cmd, args) if err != nil { @@ -62,9 +63,9 @@ func TestAddResourceAlreadyThere(t *testing.T) { } func TestAddResourceNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdAddResource(fakeFS) + cmd := newCmdAddResource(fSys) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) diff --git a/kustomize/internal/commands/edit/add/configmap_test.go b/kustomize/internal/commands/edit/add/configmap_test.go index 6d5f7b638..05d02b1be 100644 --- a/kustomize/internal/commands/edit/add/configmap_test.go +++ b/kustomize/internal/commands/edit/add/configmap_test.go @@ -13,7 +13,7 @@ import ( ) func TestNewAddConfigMapIsNotNil(t *testing.T) { - fSys := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() ldr := loader.NewFileLoaderAtCwd(validators.MakeFakeValidator(), fSys) if newCmdAddConfigMap(fSys, ldr, nil) == nil { t.Fatal("newCmdAddConfigMap shouldn't be nil") diff --git a/kustomize/internal/commands/edit/add/flagsandargs_test.go b/kustomize/internal/commands/edit/add/flagsandargs_test.go index f3da49a76..9be79b766 100644 --- a/kustomize/internal/commands/edit/add/flagsandargs_test.go +++ b/kustomize/internal/commands/edit/add/flagsandargs_test.go @@ -73,14 +73,14 @@ func TestDataConfigValidation_Flags(t *testing.T) { } func TestExpandFileSource(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.Create("dir/fa1") - fakeFS.Create("dir/fa2") - fakeFS.Create("dir/readme") + fSys := fs.MakeFsInMemory() + fSys.Create("dir/fa1") + fSys.Create("dir/fa2") + fSys.Create("dir/readme") fa := flagsAndArgs{ FileSources: []string{"dir/fa*"}, } - fa.ExpandFileSource(fakeFS) + fa.ExpandFileSource(fSys) expected := []string{ "dir/fa1", "dir/fa2", @@ -91,15 +91,15 @@ func TestExpandFileSource(t *testing.T) { } func TestExpandFileSourceWithKey(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.Create("dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc") - fakeFS.Create("dir/foobar") - fakeFS.Create("dir/simplebar") - fakeFS.Create("dir/readme") + fSys := fs.MakeFsInMemory() + fSys.Create("dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc") + fSys.Create("dir/foobar") + fSys.Create("dir/simplebar") + fSys.Create("dir/readme") fa := flagsAndArgs{ FileSources: []string{"foo-key=dir/fa*", "bar-key=dir/foobar", "dir/simplebar"}, } - fa.ExpandFileSource(fakeFS) + fa.ExpandFileSource(fSys) expected := []string{ "foo-key=dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc", "bar-key=dir/foobar", @@ -111,14 +111,14 @@ func TestExpandFileSourceWithKey(t *testing.T) { } func TestExpandFileSourceWithKeyAndError(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.Create("dir/fa1") - fakeFS.Create("dir/fa2") - fakeFS.Create("dir/readme") + fSys := fs.MakeFsInMemory() + fSys.Create("dir/fa1") + fSys.Create("dir/fa2") + fSys.Create("dir/readme") fa := flagsAndArgs{ FileSources: []string{"foo-key=dir/fa*"}, } - err := fa.ExpandFileSource(fakeFS) + err := fa.ExpandFileSource(fSys) if err == nil { t.Fatalf("FileSources should not be correctly expanded: %v", fa.FileSources) } diff --git a/kustomize/internal/commands/edit/add/secret_test.go b/kustomize/internal/commands/edit/add/secret_test.go index a04fe5095..ce5c6ac1e 100644 --- a/kustomize/internal/commands/edit/add/secret_test.go +++ b/kustomize/internal/commands/edit/add/secret_test.go @@ -13,7 +13,7 @@ import ( ) func TestNewCmdAddSecretIsNotNil(t *testing.T) { - fSys := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() ldr := loader.NewFileLoaderAtCwd(validators.MakeFakeValidator(), fSys) if newCmdAddSecret(fSys, ldr, nil) == nil { t.Fatal("newCmdAddSecret shouldn't be nil") diff --git a/kustomize/internal/commands/edit/fix/fix_test.go b/kustomize/internal/commands/edit/fix/fix_test.go index 17e2f06e0..8e4fc92ab 100644 --- a/kustomize/internal/commands/edit/fix/fix_test.go +++ b/kustomize/internal/commands/edit/fix/fix_test.go @@ -7,19 +7,20 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) func TestFix(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte(`nameprefix: some-prefix-`)) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, []byte(`nameprefix: some-prefix-`)) - cmd := NewCmdFix(fakeFS) + cmd := NewCmdFix(fSys) err := cmd.RunE(cmd, nil) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } diff --git a/kustomize/internal/commands/edit/remove/removemetadata.go b/kustomize/internal/commands/edit/remove/removemetadata.go index c3c9ce54b..afd6e84bc 100644 --- a/kustomize/internal/commands/edit/remove/removemetadata.go +++ b/kustomize/internal/commands/edit/remove/removemetadata.go @@ -47,7 +47,7 @@ func newCmdRemoveAnnotation(fSys fs.FileSystem, v func([]string) error) *cobra.C o.arrayValidator = v cmd := &cobra.Command{ Use: "annotation", - Short: "Removes one or more commonAnnotations from " + pgmconfig.KustomizationFileNames[0], + Short: "Removes one or more commonAnnotations from " + pgmconfig.KustomizationFileName0, Example: ` remove annotation {annotationKey1},{annotationKey2}`, RunE: func(cmd *cobra.Command, args []string) error { @@ -67,7 +67,7 @@ func newCmdRemoveLabel(fSys fs.FileSystem, v func([]string) error) *cobra.Comman o.arrayValidator = v cmd := &cobra.Command{ Use: "label", - Short: "Removes one or more commonLabels from " + pgmconfig.KustomizationFileNames[0], + Short: "Removes one or more commonLabels from " + pgmconfig.KustomizationFileName0, Example: ` remove label {labelKey1},{labelKey2}`, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/kustomize/internal/commands/edit/remove/removemetadata_test.go b/kustomize/internal/commands/edit/remove/removemetadata_test.go index 51521aaa2..0af194dea 100644 --- a/kustomize/internal/commands/edit/remove/removemetadata_test.go +++ b/kustomize/internal/commands/edit/remove/removemetadata_test.go @@ -5,27 +5,29 @@ package remove import ( "fmt" + "strings" + "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" "sigs.k8s.io/kustomize/v3/pkg/types" "sigs.k8s.io/kustomize/v3/pkg/validators" - "strings" - "testing" ) func makeKustomizationFS() fs.FileSystem { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() commonLabels := []string{"label1: val1", "label2: val2"} commonAnnotations := []string{"annotation1: val1", "annotation2: val2"} - fakeFS.WriteTestKustomizationWith([]byte( + testutils.WriteTestKustomizationWith(fSys, []byte( fmt.Sprintf("commonLabels:\n %s\ncommonAnnotations:\n %s", strings.Join(commonLabels, "\n "), strings.Join(commonAnnotations, "\n ")))) - return fakeFS + return fSys } -func readKustomizationFS(t *testing.T, fakeFS fs.FileSystem) *types.Kustomization { - kf, err := kustfile.NewKustomizationFile(fakeFS) +func readKustomizationFS(t *testing.T, fSys fs.FileSystem) *types.Kustomization { + kf, err := kustfile.NewKustomizationFile(fSys) if err != nil { t.Errorf("unexpected new error %v", err) } @@ -37,8 +39,8 @@ func readKustomizationFS(t *testing.T, fakeFS fs.FileSystem) *types.Kustomizatio } func makeKustomization(t *testing.T) *types.Kustomization { - fakeFS := makeKustomizationFS() - return readKustomizationFS(t, fakeFS) + fSys := makeKustomizationFS() + return readKustomizationFS(t, fSys) } func TestRemoveAnnotation(t *testing.T) { @@ -69,10 +71,10 @@ func TestRemoveAnnotation(t *testing.T) { } func TestRemoveAnnotationIgnore(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) cmd.Flag("ignore-non-existence").Value.Set("true") args := []string{"annotation3"} err := cmd.RunE(cmd, args) @@ -84,11 +86,11 @@ func TestRemoveAnnotationIgnore(t *testing.T) { } func TestRemoveAnnotationNoDefinition(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte("")) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, []byte("")) v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) args := []string{"annotation1,annotation2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -102,11 +104,11 @@ func TestRemoveAnnotationNoDefinition(t *testing.T) { } func TestRemoveAnnotationNoDefinitionIgnore(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte("")) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, []byte("")) v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) cmd.Flag("ignore-non-existence").Value.Set("true") args := []string{"annotation1,annotation2"} err := cmd.RunE(cmd, args) @@ -118,10 +120,10 @@ func TestRemoveAnnotationNoDefinitionIgnore(t *testing.T) { } func TestRemoveAnnotationNoArgs(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) err := cmd.Execute() v.VerifyNoCall() @@ -134,10 +136,10 @@ func TestRemoveAnnotationNoArgs(t *testing.T) { } func TestRemoveAnnotationInvalidFormat(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeSadMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) args := []string{"nospecialchars%^=@"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -151,10 +153,10 @@ func TestRemoveAnnotationInvalidFormat(t *testing.T) { } func TestRemoveAnnotationMultipleArgs(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) args := []string{"annotation1,annotation2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -163,7 +165,7 @@ func TestRemoveAnnotationMultipleArgs(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) splitArgs := strings.Split(args[0], ",") for _, k := range splitArgs { if _, exist := m.CommonAnnotations[k]; exist { @@ -173,10 +175,10 @@ func TestRemoveAnnotationMultipleArgs(t *testing.T) { } func TestRemoveAnnotationMultipleArgsInvalidFormat(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeSadMapValidator(t) - cmd := newCmdRemoveAnnotation(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveAnnotation(fSys, v.ValidatorArray) args := []string{"annotation1", "annotation2"} err := cmd.RunE(cmd, args) v.VerifyNoCall() @@ -217,10 +219,10 @@ func TestRemoveLabel(t *testing.T) { } func TestRemoveLabelIgnore(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) cmd.Flag("ignore-non-existence").Value.Set("true") args := []string{"label3"} err := cmd.RunE(cmd, args) @@ -232,11 +234,11 @@ func TestRemoveLabelIgnore(t *testing.T) { } func TestRemoveLabelNoDefinition(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte("")) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, []byte("")) v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) args := []string{"label1,label2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -250,11 +252,11 @@ func TestRemoveLabelNoDefinition(t *testing.T) { } func TestRemoveLabelNoDefinitionIgnore(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte("")) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, []byte("")) v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) cmd.Flag("ignore-non-existence").Value.Set("true") args := []string{"label1,label2"} err := cmd.RunE(cmd, args) @@ -266,10 +268,10 @@ func TestRemoveLabelNoDefinitionIgnore(t *testing.T) { } func TestRemoveLabelNoArgs(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) err := cmd.Execute() v.VerifyNoCall() @@ -282,10 +284,10 @@ func TestRemoveLabelNoArgs(t *testing.T) { } func TestRemoveLabelInvalidFormat(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeSadMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) args := []string{"exclamation!"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -299,10 +301,10 @@ func TestRemoveLabelInvalidFormat(t *testing.T) { } func TestRemoveLabelMultipleArgs(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeHappyMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) args := []string{"label1,label2"} err := cmd.RunE(cmd, args) v.VerifyCall() @@ -311,7 +313,7 @@ func TestRemoveLabelMultipleArgs(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) splitArgs := strings.Split(args[0], ",") for _, k := range splitArgs { if _, exist := m.CommonLabels[k]; exist { @@ -321,10 +323,10 @@ func TestRemoveLabelMultipleArgs(t *testing.T) { } func TestRemoveLabelMultipleArgsInvalidFormat(t *testing.T) { - fakeFS := makeKustomizationFS() + fSys := makeKustomizationFS() v := validators.MakeSadMapValidator(t) - cmd := newCmdRemoveLabel(fakeFS, v.ValidatorArray) + cmd := newCmdRemoveLabel(fSys, v.ValidatorArray) args := []string{"label1", "label2"} err := cmd.RunE(cmd, args) v.VerifyNoCall() diff --git a/kustomize/internal/commands/edit/remove/removepatch.go b/kustomize/internal/commands/edit/remove/removepatch.go index 6b15964bc..f211e6770 100644 --- a/kustomize/internal/commands/edit/remove/removepatch.go +++ b/kustomize/internal/commands/edit/remove/removepatch.go @@ -25,7 +25,7 @@ func newCmdRemovePatch(fsys fs.FileSystem) *cobra.Command { cmd := &cobra.Command{ Use: "patch", - Short: "Removes one or more patches from " + pgmconfig.KustomizationFileNames[0], + Short: "Removes one or more patches from " + pgmconfig.KustomizationFileName0, Example: ` remove patch {filepath}`, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/kustomize/internal/commands/edit/remove/removepatch_test.go b/kustomize/internal/commands/edit/remove/removepatch_test.go index 90f168c1a..c63f15e6c 100644 --- a/kustomize/internal/commands/edit/remove/removepatch_test.go +++ b/kustomize/internal/commands/edit/remove/removepatch_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" "sigs.k8s.io/kustomize/v3/pkg/patch" ) @@ -20,23 +21,23 @@ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ) func makeKustomizationPatchFS() fs.FileSystem { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() patches := []string{"patch1.yaml", "patch2.yaml"} - fakeFS.WriteTestKustomizationWith([]byte( + testutils.WriteTestKustomizationWith(fSys, []byte( fmt.Sprintf("patchesStrategicMerge:\n - %s", strings.Join(patches, "\n - ")))) for _, p := range patches { - fakeFS.WriteFile(p, []byte(patchFileContent)) + fSys.WriteFile(p, []byte(patchFileContent)) } - fakeFS.WriteFile("patch3.yaml", []byte(patchFileContent)) - return fakeFS + fSys.WriteFile("patch3.yaml", []byte(patchFileContent)) + return fSys } func TestRemovePatch(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) args := []string{"patch1.yaml"} err := cmd.RunE(cmd, args) @@ -44,7 +45,7 @@ func TestRemovePatch(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) for _, k := range args { if patch.Exist(m.PatchesStrategicMerge, k) { t.Errorf("%s must be deleted", k) @@ -53,8 +54,8 @@ func TestRemovePatch(t *testing.T) { } func TestRemovePatchMultipleArgs(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) args := []string{"patch1.yaml", "patch2.yaml"} err := cmd.RunE(cmd, args) @@ -62,7 +63,7 @@ func TestRemovePatchMultipleArgs(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) for _, k := range args { if patch.Exist(m.PatchesStrategicMerge, k) { t.Errorf("%s must be deleted", k) @@ -71,8 +72,8 @@ func TestRemovePatchMultipleArgs(t *testing.T) { } func TestRemovePatchGlob(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) args := []string{"patch*.yaml"} err := cmd.RunE(cmd, args) @@ -80,15 +81,15 @@ func TestRemovePatchGlob(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) if len(m.PatchesStrategicMerge) != 0 { t.Errorf("all patch must be deleted") } } func TestRemovePatchNotDefinedInKustomization(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) args := []string{"patch3.yaml"} err := cmd.RunE(cmd, args) @@ -96,7 +97,7 @@ func TestRemovePatchNotDefinedInKustomization(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) for _, k := range []string{"patch1.yaml", "patch2.yaml"} { if !patch.Exist(m.PatchesStrategicMerge, k) { t.Errorf("%s must exist", k) @@ -105,8 +106,8 @@ func TestRemovePatchNotDefinedInKustomization(t *testing.T) { } func TestRemovePatchNotExist(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) args := []string{"patch4.yaml"} err := cmd.RunE(cmd, args) @@ -114,7 +115,7 @@ func TestRemovePatchNotExist(t *testing.T) { t.Errorf("unexpected error %v", err) } - m := readKustomizationFS(t, fakeFS) + m := readKustomizationFS(t, fSys) for _, k := range []string{"patch1.yaml", "patch2.yaml"} { if !patch.Exist(m.PatchesStrategicMerge, k) { t.Errorf("%s must exist", k) @@ -123,8 +124,8 @@ func TestRemovePatchNotExist(t *testing.T) { } func TestRemovePatchNoArgs(t *testing.T) { - fakeFS := makeKustomizationPatchFS() - cmd := newCmdRemovePatch(fakeFS) + fSys := makeKustomizationPatchFS() + cmd := newCmdRemovePatch(fSys) err := cmd.RunE(cmd, nil) if err == nil { diff --git a/kustomize/internal/commands/edit/remove/removeresource.go b/kustomize/internal/commands/edit/remove/removeresource.go index 32f466b1e..fa49dfd53 100644 --- a/kustomize/internal/commands/edit/remove/removeresource.go +++ b/kustomize/internal/commands/edit/remove/removeresource.go @@ -23,7 +23,7 @@ func newCmdRemoveResource(fsys fs.FileSystem) *cobra.Command { cmd := &cobra.Command{ Use: "resource", - Short: "Removes one or more resource file paths from " + pgmconfig.KustomizationFileNames[0], + Short: "Removes one or more resource file paths from " + pgmconfig.KustomizationFileName0, Example: ` remove resource my-resource.yml remove resource resource1.yml resource2.yml resource3.yml diff --git a/kustomize/internal/commands/edit/remove/removeresource_test.go b/kustomize/internal/commands/edit/remove/removeresource_test.go index 57995388a..1089ba67e 100644 --- a/kustomize/internal/commands/edit/remove/removeresource_test.go +++ b/kustomize/internal/commands/edit/remove/removeresource_test.go @@ -9,6 +9,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -124,9 +125,12 @@ func TestRemoveResources(t *testing.T) { for _, tc := range testCases { t.Run(tc.description, func(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomizationWith([]byte(fmt.Sprintf("resources:\n - %s", strings.Join(tc.given.resources, "\n - ")))) - cmd := newCmdRemoveResource(fakeFS) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith( + fSys, + []byte(fmt.Sprintf( + "resources:\n - %s", strings.Join(tc.given.resources, "\n - ")))) + cmd := newCmdRemoveResource(fSys) err := cmd.RunE(cmd, tc.given.removeArgs) if err != nil && tc.expected.err == nil { @@ -137,7 +141,7 @@ func TestRemoveResources(t *testing.T) { } return } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } diff --git a/kustomize/internal/commands/edit/set/set_name_prefix_test.go b/kustomize/internal/commands/edit/set/set_name_prefix_test.go index b7c682e02..88ae5790d 100644 --- a/kustomize/internal/commands/edit/set/set_name_prefix_test.go +++ b/kustomize/internal/commands/edit/set/set_name_prefix_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -15,16 +16,16 @@ const ( ) func TestSetNamePrefixHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) - cmd := newCmdSetNamePrefix(fakeFS) + cmd := newCmdSetNamePrefix(fSys) args := []string{goodPrefixValue} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -34,9 +35,9 @@ func TestSetNamePrefixHappyPath(t *testing.T) { } func TestSetNamePrefixNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdSetNamePrefix(fakeFS) + cmd := newCmdSetNamePrefix(fSys) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) diff --git a/kustomize/internal/commands/edit/set/set_name_suffix_test.go b/kustomize/internal/commands/edit/set/set_name_suffix_test.go index 37d9ec1ad..d0a73e8e8 100644 --- a/kustomize/internal/commands/edit/set/set_name_suffix_test.go +++ b/kustomize/internal/commands/edit/set/set_name_suffix_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -15,16 +16,16 @@ const ( ) func TestSetNameSuffixHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) - cmd := newCmdSetNameSuffix(fakeFS) + cmd := newCmdSetNameSuffix(fSys) args := []string{goodSuffixValue} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -34,9 +35,8 @@ func TestSetNameSuffixHappyPath(t *testing.T) { } func TestSetNameSuffixNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() - - cmd := newCmdSetNameSuffix(fakeFS) + fSys := fs.MakeFsInMemory() + cmd := newCmdSetNameSuffix(fSys) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) diff --git a/kustomize/internal/commands/edit/set/setimage_test.go b/kustomize/internal/commands/edit/set/setimage_test.go index 4af81c768..51ff25457 100644 --- a/kustomize/internal/commands/edit/set/setimage_test.go +++ b/kustomize/internal/commands/edit/set/setimage_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" ) @@ -189,16 +190,16 @@ func TestSetImage(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("%s%v", tc.description, tc.given.args), func(t *testing.T) { - // arrange - fakeFS := fs.MakeFakeFS() - cmd := newCmdSetImage(fakeFS) + fSys := fs.MakeFsInMemory() + cmd := newCmdSetImage(fSys) if len(tc.given.infileImages) > 0 { // write file with infileImages - fakeFS.WriteTestKustomizationWith([]byte(strings.Join(tc.given.infileImages, "\n"))) + testutils.WriteTestKustomizationWith( + fSys, + []byte(strings.Join(tc.given.infileImages, "\n"))) } else { - // writes default kustomization file - fakeFS.WriteTestKustomization() + testutils.WriteTestKustomization(fSys) } // act @@ -210,7 +211,7 @@ func TestSetImage(t *testing.T) { t.FailNow() } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) t.FailNow() diff --git a/kustomize/internal/commands/edit/set/setnamespace_test.go b/kustomize/internal/commands/edit/set/setnamespace_test.go index fff949160..b5c92ada1 100644 --- a/kustomize/internal/commands/edit/set/setnamespace_test.go +++ b/kustomize/internal/commands/edit/set/setnamespace_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" "sigs.k8s.io/kustomize/v3/pkg/fs" "sigs.k8s.io/kustomize/v3/pkg/validators" ) @@ -17,16 +18,16 @@ const ( ) func TestSetNamespaceHappyPath(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) - cmd := newCmdSetNamespace(fakeFS, validators.MakeFakeValidator()) + cmd := newCmdSetNamespace(fSys, validators.MakeFakeValidator()) args := []string{goodNamespaceValue} err := cmd.RunE(cmd, args) if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -37,10 +38,10 @@ func TestSetNamespaceHappyPath(t *testing.T) { } func TestSetNamespaceOverride(t *testing.T) { - fakeFS := fs.MakeFakeFS() - fakeFS.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) - cmd := newCmdSetNamespace(fakeFS, validators.MakeFakeValidator()) + cmd := newCmdSetNamespace(fSys, validators.MakeFakeValidator()) args := []string{goodNamespaceValue} err := cmd.RunE(cmd, args) if err != nil { @@ -51,7 +52,7 @@ func TestSetNamespaceOverride(t *testing.T) { if err != nil { t.Errorf("unexpected cmd error: %v", err) } - content, err := fakeFS.ReadTestKustomization() + content, err := testutils.ReadTestKustomization(fSys) if err != nil { t.Errorf("unexpected read error: %v", err) } @@ -62,9 +63,9 @@ func TestSetNamespaceOverride(t *testing.T) { } func TestSetNamespaceNoArgs(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdSetNamespace(fakeFS, validators.MakeFakeValidator()) + cmd := newCmdSetNamespace(fSys, validators.MakeFakeValidator()) err := cmd.Execute() if err == nil { t.Errorf("expected error: %v", err) @@ -75,9 +76,9 @@ func TestSetNamespaceNoArgs(t *testing.T) { } func TestSetNamespaceInvalid(t *testing.T) { - fakeFS := fs.MakeFakeFS() + fSys := fs.MakeFsInMemory() - cmd := newCmdSetNamespace(fakeFS, validators.MakeFakeValidator()) + cmd := newCmdSetNamespace(fSys, validators.MakeFakeValidator()) args := []string{"/badnamespace/"} err := cmd.RunE(cmd, args) if err == nil { diff --git a/kustomize/internal/commands/kustfile/kustomizationfile.go b/kustomize/internal/commands/kustfile/kustomizationfile.go index 32dc5bd8c..3152f0235 100644 --- a/kustomize/internal/commands/kustfile/kustomizationfile.go +++ b/kustomize/internal/commands/kustfile/kustomizationfile.go @@ -34,7 +34,7 @@ func determineFieldOrder() []string { s := reflect.ValueOf(&types.Kustomization{}).Elem() typeOfT := s.Type() for i := 0; i < s.NumField(); i++ { - m[string(typeOfT.Field(i).Name)] = false + m[typeOfT.Field(i).Name] = false } ordered := []string{ @@ -119,7 +119,7 @@ func NewKustomizationFile(fSys fs.FileSystem) (*kustomizationFile, error) { // n func (mf *kustomizationFile) validate() error { match := 0 var path []string - for _, kfilename := range pgmconfig.KustomizationFileNames { + for _, kfilename := range pgmconfig.KustomizationFileNames() { if mf.fSys.Exists(kfilename) { match += 1 path = append(path, kfilename) @@ -128,7 +128,7 @@ func (mf *kustomizationFile) validate() error { switch match { case 0: - return fmt.Errorf("Missing kustomization file '%s'.\n", pgmconfig.KustomizationFileNames[0]) + return fmt.Errorf("Missing kustomization file '%s'.\n", pgmconfig.KustomizationFileName0) case 1: mf.path = path[0] default: diff --git a/kustomize/internal/commands/kustfile/kustomizationfile_test.go b/kustomize/internal/commands/kustfile/kustomizationfile_test.go index f2102a675..fbf5fa6c7 100644 --- a/kustomize/internal/commands/kustfile/kustomizationfile_test.go +++ b/kustomize/internal/commands/kustfile/kustomizationfile_test.go @@ -8,6 +8,8 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils" + "sigs.k8s.io/kustomize/v3/pkg/fs" "sigs.k8s.io/kustomize/v3/pkg/pgmconfig" "sigs.k8s.io/kustomize/v3/pkg/types" @@ -55,8 +57,8 @@ func TestWriteAndRead(t *testing.T) { NamePrefix: "prefix", } - fSys := fs.MakeFakeFS() - fSys.WriteTestKustomization() + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomization(fSys) mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) @@ -77,8 +79,8 @@ func TestWriteAndRead(t *testing.T) { } func TestNewNotExist(t *testing.T) { - fakeFS := fs.MakeFakeFS() - _, err := NewKustomizationFile(fakeFS) + fSys := fs.MakeFsInMemory() + _, err := NewKustomizationFile(fSys) if err == nil { t.Fatalf("expect an error") } @@ -86,7 +88,7 @@ func TestNewNotExist(t *testing.T) { if !strings.Contains(err.Error(), contained) { t.Fatalf("expect an error contains %q, but got %v", contained, err) } - _, err = NewKustomizationFile(fakeFS) + _, err = NewKustomizationFile(fSys) if err == nil { t.Fatalf("expect an error") } @@ -103,13 +105,13 @@ configMapGenerator: - baz=qux name: my-configmap ` - fakeFS := fs.MakeFakeFS() - fakeFS.WriteFile(pgmconfig.KustomizationFileNames[1], []byte(kcontent)) - k, err := NewKustomizationFile(fakeFS) + fSys := fs.MakeFsInMemory() + fSys.WriteFile(pgmconfig.KustomizationFileName1, []byte(kcontent)) + k, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) } - if k.path != pgmconfig.KustomizationFileNames[1] { + if k.path != pgmconfig.KustomizationFileName1 { t.Fatalf("Load incorrect file path %s", k.path) } } @@ -139,8 +141,8 @@ patchesStrategicMerge: - service.yaml - pod.yaml `) - fSys := fs.MakeFakeFS() - fSys.WriteTestKustomizationWith(kustomizationContentWithComments) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, kustomizationContentWithComments) mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) @@ -231,8 +233,9 @@ patchesStrategicMerge: generatorOptions: disableNameSuffixHash: true `) - fSys := fs.MakeFakeFS() - fSys.WriteTestKustomizationWith(kustomizationContentWithComments) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith( + fSys, kustomizationContentWithComments) mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) @@ -268,8 +271,9 @@ patchesStrategicMerge: apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization `) - fSys := fs.MakeFakeFS() - fSys.WriteTestKustomizationWith(kustomizationContentWithComments) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith( + fSys, kustomizationContentWithComments) mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) @@ -313,8 +317,8 @@ patches: apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization `) - fSys := fs.MakeFakeFS() - fSys.WriteTestKustomizationWith(kustomizationContentWithComments) + fSys := fs.MakeFsInMemory() + testutils.WriteTestKustomizationWith(fSys, kustomizationContentWithComments) mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) diff --git a/kustomize/internal/commands/testutils/testutils.go b/kustomize/internal/commands/testutils/testutils.go new file mode 100644 index 000000000..d0004915b --- /dev/null +++ b/kustomize/internal/commands/testutils/testutils.go @@ -0,0 +1,47 @@ +// Copyright 2019 The Kubernetes Authors. +// SPDX-License-Identifier: Apache-2.0 + +package testutils + +import ( + "sigs.k8s.io/kustomize/v3/pkg/fs" + "sigs.k8s.io/kustomize/v3/pkg/pgmconfig" +) + +const ( + // kustomizationContent is used in tests. + kustomizationContent = `apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namePrefix: some-prefix +nameSuffix: some-suffix +# Labels to add to all objects and selectors. +# These labels would also be used to form the selector for apply --prune +# Named differently than “labels” to avoid confusion with metadata for this object +commonLabels: + app: helloworld +commonAnnotations: + note: This is an example annotation +resources: [] +#- service.yaml +#- ../some-dir/ +# There could also be configmaps in Base, which would make these overlays +configMapGenerator: [] +# There could be secrets in Base, if just using a fork/rebase workflow +secretGenerator: [] +` +) + +// WriteTestKustomization writes a standard test file. +func WriteTestKustomization(fSys fs.FileSystem) { + WriteTestKustomizationWith(fSys, []byte(kustomizationContent)) +} + +// WriteTestKustomizationWith writes content to a well known file name. +func WriteTestKustomizationWith(fSys fs.FileSystem, bytes []byte) { + fSys.WriteFile(pgmconfig.KustomizationFileName0, bytes) +} + +// ReadTestKustomization reads content from a well known file name. +func ReadTestKustomization(fSys fs.FileSystem) ([]byte, error) { + return fSys.ReadFile(pgmconfig.KustomizationFileName0) +} diff --git a/pkg/fs/fsinmemory.go b/pkg/fs/fsinmemory.go index 28e6021af..540756e70 100644 --- a/pkg/fs/fsinmemory.go +++ b/pkg/fs/fsinmemory.go @@ -9,8 +9,6 @@ import ( "path/filepath" "sort" "strings" - - "sigs.k8s.io/kustomize/v3/pkg/pgmconfig" ) var _ FileSystem = &fsInMemory{} @@ -31,26 +29,6 @@ func MakeFsInMemory() FileSystem { const ( separator = string(filepath.Separator) doubleSep = separator + separator - // kustomizationContent is used in tests. - kustomizationContent = `apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namePrefix: some-prefix -nameSuffix: some-suffix -# Labels to add to all objects and selectors. -# These labels would also be used to form the selector for apply --prune -# Named differently than “labels” to avoid confusion with metadata for this object -commonLabels: - app: helloworld -commonAnnotations: - note: This is an example annotation -resources: [] -#- service.yaml -#- ../some-dir/ -# There could also be configmaps in Base, which would make these overlays -configMapGenerator: [] -# There could be secrets in Base, if just using a fork/rebase workflow -secretGenerator: [] -` ) // Create assures a fake file appears in the in-memory file system. @@ -150,10 +128,6 @@ func (fs *fsInMemory) ReadFile(name string) ([]byte, error) { return nil, fmt.Errorf("cannot read file %q", name) } -func (fs *fsInMemory) ReadTestKustomization() ([]byte, error) { - return fs.ReadFile(pgmconfig.KustomizationFileNames[0]) -} - // WriteFile always succeeds and does nothing. func (fs *fsInMemory) WriteFile(name string, c []byte) error { ff := &fileInMemory{} @@ -162,16 +136,6 @@ func (fs *fsInMemory) WriteFile(name string, c []byte) error { return nil } -// WriteTestKustomization writes a standard test file. -func (fs *fsInMemory) WriteTestKustomization() { - fs.WriteTestKustomizationWith([]byte(kustomizationContent)) -} - -// WriteTestKustomizationWith writes a standard test file. -func (fs *fsInMemory) WriteTestKustomizationWith(bytes []byte) { - fs.WriteFile(pgmconfig.KustomizationFileNames[0], bytes) -} - // Walk implements filepath.Walk using the fake filesystem. func (fs *fsInMemory) Walk(path string, walkFn filepath.WalkFunc) error { info, err := fs.lstat(path) diff --git a/pkg/kusttest/kusttestharness.go b/pkg/kusttest/kusttestharness.go index eb5712a53..cf3a2b83e 100644 --- a/pkg/kusttest/kusttestharness.go +++ b/pkg/kusttest/kusttestharness.go @@ -74,7 +74,7 @@ func (th *KustTestHarness) WriteF(dir string, content string) { } func (th *KustTestHarness) WriteK(dir string, content string) { - th.WriteF(filepath.Join(dir, pgmconfig.KustomizationFileNames[0]), ` + th.WriteF(filepath.Join(dir, pgmconfig.KustomizationFileName0), ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization `+content) diff --git a/pkg/loader/fileloader_test.go b/pkg/loader/fileloader_test.go index ccd7d1666..abcda6c25 100644 --- a/pkg/loader/fileloader_test.go +++ b/pkg/loader/fileloader_test.go @@ -389,7 +389,7 @@ func TestNewLoaderAtGitClone(t *testing.T) { fSys.MkdirAll(coRoot) fSys.MkdirAll(coRoot + "/" + pathInRepo) fSys.WriteFile( - coRoot+"/"+pathInRepo+"/"+pgmconfig.KustomizationFileNames[0], + coRoot+"/"+pathInRepo+"/"+pgmconfig.KustomizationFileName0, []byte(` whatever `)) diff --git a/pkg/pgmconfig/config.go b/pkg/pgmconfig/config.go index 5dc5eb8ad..5185c50cd 100644 --- a/pkg/pgmconfig/config.go +++ b/pkg/pgmconfig/config.go @@ -27,7 +27,6 @@ import ( const ( XDG_CONFIG_HOME = "XDG_CONFIG_HOME" defaultConfigSubdir = ".config" - PluginRoot = "plugin" ) // Use https://github.com/kirsle/configdir instead? diff --git a/pkg/pgmconfig/constants.go b/pkg/pgmconfig/constants.go index 92aaf5fba..d4b7c8862 100644 --- a/pkg/pgmconfig/constants.go +++ b/pkg/pgmconfig/constants.go @@ -1,36 +1,28 @@ -/* -Copyright 2017 The Kubernetes Authors. +// Copyright 2019 The Kubernetes Authors. +// SPDX-License-Identifier: Apache-2.0 -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package constants holds global constants for the kustomize tool. +// Package pgmconfig holds global constants for the kustomize tool. package pgmconfig // KustomizationFileNames is a list of filenames // that kustomize recognizes. // To avoid ambiguity, a directory cannot contain // more than one match to this list. -var KustomizationFileNames = []string{ - "kustomization.yaml", - "kustomization.yml", - "Kustomization", +func KustomizationFileNames() []string { + return []string{ + KustomizationFileName0, + KustomizationFileName1, + KustomizationFileName2} } const ( + KustomizationFileName0 = "kustomization.yaml" + KustomizationFileName1 = "kustomization.yml" + KustomizationFileName2 = "Kustomization" // Program name, for help, finding the XDG_CONFIG_DIR, etc. ProgramName = "kustomize" // Domain from which kustomize code is imported, for locating // plugin source code under $GOPATH. DomainName = "sigs.k8s.io" + PluginRoot = "plugin" ) diff --git a/pkg/resmap/factory_test.go b/pkg/resmap/factory_test.go index 4f04d0295..4dbfc398b 100644 --- a/pkg/resmap/factory_test.go +++ b/pkg/resmap/factory_test.go @@ -234,10 +234,10 @@ func TestNewResMapFromSecretArgs(t *testing.T) { Type: ifc.SecretTypeOpaque, }, } - fakeFs := fs.MakeFsInMemory() - fakeFs.Mkdir(".") + fSys := fs.MakeFsInMemory() + fSys.Mkdir(".") actual, err := rmF.NewResMapFromSecretArgs( - loader.NewFileLoaderAtRoot(validators.MakeFakeValidator(), fakeFs), nil, secrets) + loader.NewFileLoaderAtRoot(validators.MakeFakeValidator(), fSys), nil, secrets) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/pkg/target/kusttarget.go b/pkg/target/kusttarget.go index 2bbfe2b32..55624903b 100644 --- a/pkg/target/kusttarget.go +++ b/pkg/target/kusttarget.go @@ -81,7 +81,7 @@ func commaOr(q []string) string { func loadKustFile(ldr ifc.Loader) ([]byte, error) { var content []byte match := 0 - for _, kf := range pgmconfig.KustomizationFileNames { + for _, kf := range pgmconfig.KustomizationFileNames() { c, err := ldr.Load(kf) if err == nil { match += 1 @@ -92,7 +92,8 @@ func loadKustFile(ldr ifc.Loader) ([]byte, error) { case 0: return nil, fmt.Errorf( "unable to find one of %v in directory '%s'", - commaOr(quoted(pgmconfig.KustomizationFileNames)), ldr.Root()) + commaOr(quoted(pgmconfig.KustomizationFileNames())), + ldr.Root()) case 1: return content, nil default: diff --git a/pkg/transformers/multitransformer.go b/pkg/transformers/multitransformer.go index 40ed07aea..619ec6b84 100644 --- a/pkg/transformers/multitransformer.go +++ b/pkg/transformers/multitransformer.go @@ -39,15 +39,6 @@ func NewMultiTransformer(t []resmap.Transformer) resmap.Transformer { return r } -// NewMultiTransformerWithConflictCheck constructs a multiTransformer with checking of conflicts. -func NewMultiTransformerWithConflictCheck(t []resmap.Transformer) resmap.Transformer { - r := &multiTransformer{ - transformers: make([]resmap.Transformer, len(t)), - checkConflictEnabled: true} - copy(r.transformers, t) - return r -} - // Transform prepends the name prefix. func (o *multiTransformer) Transform(m resmap.ResMap) error { if o.checkConflictEnabled { diff --git a/pkg/transformers/namereference.go b/pkg/transformers/namereference.go index 27fde2eae..e57d01f05 100644 --- a/pkg/transformers/namereference.go +++ b/pkg/transformers/namereference.go @@ -265,16 +265,6 @@ func (o *nameReferenceTransformer) getNewNameFunc( } } -func indexOf(s string, slice []string) []int { - var index []int - for i, item := range slice { - if item == s { - index = append(index, i) - } - } - return index -} - func getIds(rs []*resource.Resource) []string { var result []string for _, r := range rs { diff --git a/plugin/builtin/NamespaceTransformer.go b/plugin/builtin/NamespaceTransformer.go index c9c8ca764..29767d140 100644 --- a/plugin/builtin/NamespaceTransformer.go +++ b/plugin/builtin/NamespaceTransformer.go @@ -64,7 +64,7 @@ const metaNamespace = "metadata/namespace" // that don't exist in a namespace (the Namespace // object itself doesn't live in a namespace). func (p *NamespaceTransformerPlugin) applicableFieldSpecs(id resid.ResId) []config.FieldSpec { - res := []config.FieldSpec{} + var res []config.FieldSpec for _, fs := range p.FieldSpecs { if id.IsSelected(&fs.Gvk) && (fs.Path != metaNamespace || (fs.Path == metaNamespace && id.IsNamespaceableKind())) { res = append(res, fs) @@ -73,14 +73,14 @@ func (p *NamespaceTransformerPlugin) applicableFieldSpecs(id resid.ResId) []conf return res } -func (o *NamespaceTransformerPlugin) changeNamespace( +func (p *NamespaceTransformerPlugin) changeNamespace( referrer *resource.Resource) func(in interface{}) (interface{}, error) { return func(in interface{}) (interface{}, error) { switch in.(type) { case string: // will happen when the metadata/namespace // value is replaced - return o.Namespace, nil + return p.Namespace, nil case []interface{}: l, _ := in.([]interface{}) for idx, item := range l { @@ -102,7 +102,7 @@ func (o *NamespaceTransformerPlugin) changeNamespace( if name != "default" { continue } - inMap["namespace"] = o.Namespace + inMap["namespace"] = p.Namespace l[idx] = inMap default: // nothing to do for right now @@ -115,7 +115,7 @@ func (o *NamespaceTransformerPlugin) changeNamespace( // object inMap := in.(map[string]interface{}) if len(inMap) == 0 { - return o.Namespace, nil + return p.Namespace, nil } else { return in, nil } diff --git a/plugin/builtin/ReplicaCountTransformer.go b/plugin/builtin/ReplicaCountTransformer.go index 93235ab5c..1d97cc205 100644 --- a/plugin/builtin/ReplicaCountTransformer.go +++ b/plugin/builtin/ReplicaCountTransformer.go @@ -52,7 +52,7 @@ func (p *ReplicaCountTransformerPlugin) Transform(m resmap.ResMap) error { for i, replicaSpec := range p.FieldSpecs { gvks[i] = replicaSpec.Gvk.String() } - return fmt.Errorf("Resource with name %s does not match a config with the following GVK %v", + return fmt.Errorf("resource with name %s does not match a config with the following GVK %v", p.Replica.Name, gvks) } diff --git a/plugin/builtin/namespacetransformer/NamespaceTransformer.go b/plugin/builtin/namespacetransformer/NamespaceTransformer.go index f8f047e18..9d867bf40 100644 --- a/plugin/builtin/namespacetransformer/NamespaceTransformer.go +++ b/plugin/builtin/namespacetransformer/NamespaceTransformer.go @@ -70,7 +70,7 @@ const metaNamespace = "metadata/namespace" // that don't exist in a namespace (the Namespace // object itself doesn't live in a namespace). func (p *plugin) applicableFieldSpecs(id resid.ResId) []config.FieldSpec { - res := []config.FieldSpec{} + var res []config.FieldSpec for _, fs := range p.FieldSpecs { if id.IsSelected(&fs.Gvk) && (fs.Path != metaNamespace || (fs.Path == metaNamespace && id.IsNamespaceableKind())) { res = append(res, fs) @@ -79,14 +79,14 @@ func (p *plugin) applicableFieldSpecs(id resid.ResId) []config.FieldSpec { return res } -func (o *plugin) changeNamespace( +func (p *plugin) changeNamespace( referrer *resource.Resource) func(in interface{}) (interface{}, error) { return func(in interface{}) (interface{}, error) { switch in.(type) { case string: // will happen when the metadata/namespace // value is replaced - return o.Namespace, nil + return p.Namespace, nil case []interface{}: l, _ := in.([]interface{}) for idx, item := range l { @@ -108,7 +108,7 @@ func (o *plugin) changeNamespace( if name != "default" { continue } - inMap["namespace"] = o.Namespace + inMap["namespace"] = p.Namespace l[idx] = inMap default: // nothing to do for right now @@ -121,7 +121,7 @@ func (o *plugin) changeNamespace( // object inMap := in.(map[string]interface{}) if len(inMap) == 0 { - return o.Namespace, nil + return p.Namespace, nil } else { return in, nil } diff --git a/plugin/builtin/patchstrategicmergetransformer/PatchStrategicMergeTransformer_test.go b/plugin/builtin/patchstrategicmergetransformer/PatchStrategicMergeTransformer_test.go index f8aee86fc..4cc87dd17 100644 --- a/plugin/builtin/patchstrategicmergetransformer/PatchStrategicMergeTransformer_test.go +++ b/plugin/builtin/patchstrategicmergetransformer/PatchStrategicMergeTransformer_test.go @@ -600,11 +600,6 @@ func addNamespace(namespace string, base string) string { return res } -// unExpectedError function handles unexpected error -func unExpectedError(t *testing.T, name string, err error) { - t.Fatalf("%q; - unexpected error %v", name, err) -} - // compareExpectedError compares the expectedError and the actualError return by GetFieldValue func compareExpectedError(t *testing.T, name string, err error, errorMsg string) { if err == nil { @@ -854,7 +849,7 @@ metadata: name: notImportantHere paths: ` - for idx, _ := range patches { + for idx := range patches { config = fmt.Sprintf("%s\n- ./patch%d.yaml", config, idx) } diff --git a/plugin/builtin/replicacounttransformer/ReplicaCountTransformer.go b/plugin/builtin/replicacounttransformer/ReplicaCountTransformer.go index df1964c68..1e6e5cf79 100644 --- a/plugin/builtin/replicacounttransformer/ReplicaCountTransformer.go +++ b/plugin/builtin/replicacounttransformer/ReplicaCountTransformer.go @@ -58,7 +58,7 @@ func (p *plugin) Transform(m resmap.ResMap) error { for i, replicaSpec := range p.FieldSpecs { gvks[i] = replicaSpec.Gvk.String() } - return fmt.Errorf("Resource with name %s does not match a config with the following GVK %v", + return fmt.Errorf("resource with name %s does not match a config with the following GVK %v", p.Replica.Name, gvks) } diff --git a/plugin/builtin/replicacounttransformer/ReplicaCountTransformer_test.go b/plugin/builtin/replicacounttransformer/ReplicaCountTransformer_test.go index c1c1a1e67..3a80d775b 100644 --- a/plugin/builtin/replicacounttransformer/ReplicaCountTransformer_test.go +++ b/plugin/builtin/replicacounttransformer/ReplicaCountTransformer_test.go @@ -229,7 +229,7 @@ spec: t.Fatalf("No match should return an error") } if err.Error() != - "Resource with name service does not match a config with the following GVK [~G_~V_Deployment]" { + "resource with name service does not match a config with the following GVK [~G_~V_Deployment]" { t.Fatalf("Unexpected error: %v", err) } }