From f0bfc72bad1a62945888b478be34a7f0b7820da6 Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Thu, 6 Jun 2019 06:12:12 -0700 Subject: [PATCH] Update dependencies (#982) Signed-off-by: Vince Prignano --- Gopkg.lock | 31 +- Gopkg.toml | 2 +- ...create-cluster-no-args-invalid-flag.golden | 2 +- .../testdata/create-cluster-no-args.golden | 2 +- .../create-no-args-invalid-flag.golden | 2 +- cmd/clusterctl/testdata/create-no-args.golden | 2 +- ...delete-cluster-no-args-invalid-flag.golden | 2 +- .../testdata/delete-cluster-no-args.golden | 2 +- .../delete-no-args-invalid-flag.golden | 2 +- cmd/clusterctl/testdata/delete-no-args.golden | 2 +- .../testdata/no-args-invalid-flag.golden | 2 +- cmd/clusterctl/testdata/no-args.golden | 2 +- ...lidate-cluster-no-args-invalid-flag.golden | 2 +- .../validate-no-args-invalid-flag.golden | 2 +- .../testdata/validate-no-args.golden | 2 +- vendor/github.com/google/uuid/node.go | 1 + vendor/github.com/onsi/ginkgo/.travis.yml | 8 +- vendor/github.com/onsi/ginkgo/CHANGELOG.md | 11 + .../github.com/onsi/ginkgo/config/config.go | 2 +- vendor/github.com/onsi/ginkgo/ginkgo_dsl.go | 4 +- .../onsi/ginkgo/internal/spec/specs.go | 45 ++- vendor/github.com/onsi/gomega/.travis.yml | 10 +- vendor/github.com/onsi/gomega/CHANGELOG.md | 11 + vendor/github.com/onsi/gomega/Makefile | 6 + vendor/github.com/onsi/gomega/gomega_dsl.go | 282 +++++++++--------- .../gomega/matchers/have_occurred_matcher.go | 2 +- .../onsi/gomega/matchers/match_xml_matcher.go | 4 +- vendor/k8s.io/klog/klog.go | 196 ++++++++---- .../pkg/cache/internal/BUILD.bazel | 1 + .../pkg/cache/internal/cache_reader.go | 30 +- .../pkg/client/fake/BUILD.bazel | 2 + .../pkg/client/fake/client.go | 27 +- .../pkg/client/typed_client.go | 1 - .../pkg/internal/objectutil/BUILD.bazel | 14 + .../pkg/internal/objectutil/filter.go | 42 +++ 35 files changed, 479 insertions(+), 279 deletions(-) create mode 100644 vendor/github.com/onsi/gomega/Makefile create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/BUILD.bazel create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go diff --git a/Gopkg.lock b/Gopkg.lock index 0b358ad23f84..7a856203927c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -179,12 +179,12 @@ revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" [[projects]] - digest = "1:236d7e1bdb50d8f68559af37dbcf9d142d56b431c9b2176d41e2a009b664cda8" + digest = "1:582b704bebaa06b48c29b0cec224a6058a09c86883aaddabde889cd1a5f73e1b" name = "github.com/google/uuid" packages = ["."] pruneopts = "UT" - revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8" - version = "v1.1.0" + revision = "0cd6bf5da1e1c83f8b45653022c74f71af0538a4" + version = "v1.1.1" [[projects]] digest = "1:65c4414eeb350c47b8de71110150d0ea8a281835b1f386eacaa3ad7325929c21" @@ -315,7 +315,7 @@ version = "1.0.1" [[projects]] - digest = "1:5f4b78246f0bcb105b1e3b2b9e22b52a57cd02f57a8078572fe27c62f4a75ff7" + digest = "1:e9c3bb68a6c9470302b8046d4647e0612a2ea6037b9c6a47de60c0a90db504f8" name = "github.com/onsi/ginkgo" packages = [ ".", @@ -338,11 +338,11 @@ "types", ] pruneopts = "UT" - revision = "2e1be8f7d90e9d3e3e58b0ce470f2f14d075406f" - version = "v1.7.0" + revision = "eea6ad008b96acdaa524f5b409513bf062b500ad" + version = "v1.8.0" [[projects]] - digest = "1:b4764603c54d74435f246901248aefb2b9d430bb7b160afde1afc41d89d48f1a" + digest = "1:029c6999f3efa5f1cd3f8b9e02a8bc4276cc439d2dc8dc73cd98e4efd5c76cba" name = "github.com/onsi/gomega" packages = [ ".", @@ -361,8 +361,8 @@ "types", ] pruneopts = "UT" - revision = "65fb64232476ad9046e57c26cd0bff3d3a8dc6cd" - version = "v1.4.3" + revision = "90e289841c1ed79b7a598a7cd9959750cb5e89e2" + version = "v1.5.0" [[projects]] digest = "1:e5d0bd87abc2781d14e274807a470acd180f0499f8bf5bb18606e9ec22ad9de9" @@ -1104,12 +1104,12 @@ revision = "f8a0810f38afb8478882b3835a615aebfda39afa" [[projects]] - digest = "1:c696379ad201c1e86591785579e16bf6cf886c362e9a7534e8eb0d1028b20582" + digest = "1:fa0be820e3b9d58b99264b0ca771ceeb36c7293f8409f70455d4a1e5253a87a0" name = "k8s.io/klog" packages = ["."] pruneopts = "UT" - revision = "e531227889390a39d9533dde61f590fe9f4b0035" - version = "v0.3.0" + revision = "78315d914a8af2453db4864e69230b647b1ff711" + version = "v0.3.2" [[projects]] branch = "master" @@ -1120,7 +1120,7 @@ revision = "ced9eb3070a5f1c548ef46e8dfe2a97c208d9f03" [[projects]] - digest = "1:b27154c2a91d1d3adf28894c60eae5650d1f1e9e1bcba6e943623c6c2beccb24" + digest = "1:723a0b3f18d8042f63570d2478cda739bc547d4c94ba787786ce5bb6b6ccb603" name = "sigs.k8s.io/controller-runtime" packages = [ "pkg/cache", @@ -1136,6 +1136,7 @@ "pkg/handler", "pkg/internal/controller", "pkg/internal/controller/metrics", + "pkg/internal/objectutil", "pkg/internal/recorder", "pkg/leaderelection", "pkg/manager", @@ -1161,8 +1162,8 @@ "pkg/webhook/types", ] pruneopts = "UT" - revision = "12d98582e72927b6cd0123e2b4e819f9341ce62c" - version = "v0.1.10" + revision = "477bf4f046c31c351b46fa00262bc814ac0bbca1" + version = "v0.1.11" [[projects]] digest = "1:992675a6714d511089a0b7ffb7063d36e5423089cda610642de7a0cfbbf673ab" diff --git a/Gopkg.toml b/Gopkg.toml index 253e16e7d4e2..f2be59abd2f3 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -24,7 +24,7 @@ required = [ [[constraint]] name="sigs.k8s.io/controller-runtime" - version="v0.1.10" + version="v0.1.11" [[constraint]] name="sigs.k8s.io/controller-tools" diff --git a/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden index 4e89d69d1b59..ee7a56a873dd 100644 --- a/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden @@ -27,7 +27,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/create-cluster-no-args.golden b/cmd/clusterctl/testdata/create-cluster-no-args.golden index c3b2f2d266bd..c6b350a274f1 100644 --- a/cmd/clusterctl/testdata/create-cluster-no-args.golden +++ b/cmd/clusterctl/testdata/create-cluster-no-args.golden @@ -27,7 +27,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden index b6ca97cd1b0d..626fd1196c60 100644 --- a/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/create-no-args-invalid-flag.golden @@ -19,7 +19,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/create-no-args.golden b/cmd/clusterctl/testdata/create-no-args.golden index 5369b32f3122..ad5118511257 100644 --- a/cmd/clusterctl/testdata/create-no-args.golden +++ b/cmd/clusterctl/testdata/create-no-args.golden @@ -20,7 +20,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden index 4c2c40b13d9a..153050588b96 100644 --- a/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden @@ -24,7 +24,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/delete-cluster-no-args.golden b/cmd/clusterctl/testdata/delete-cluster-no-args.golden index 82e0add99b9f..91edb26dc316 100644 --- a/cmd/clusterctl/testdata/delete-cluster-no-args.golden +++ b/cmd/clusterctl/testdata/delete-cluster-no-args.golden @@ -26,7 +26,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden index 54ed0e0ebcc8..9344b377cda6 100644 --- a/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden @@ -19,7 +19,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/delete-no-args.golden b/cmd/clusterctl/testdata/delete-no-args.golden index 86cc1d355e84..f914826e224d 100644 --- a/cmd/clusterctl/testdata/delete-no-args.golden +++ b/cmd/clusterctl/testdata/delete-no-args.golden @@ -20,7 +20,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/no-args-invalid-flag.golden b/cmd/clusterctl/testdata/no-args-invalid-flag.golden index cbe4f8e4efd6..cd0b38b4c85b 100644 --- a/cmd/clusterctl/testdata/no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/no-args-invalid-flag.golden @@ -22,7 +22,7 @@ Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/no-args.golden b/cmd/clusterctl/testdata/no-args.golden index 005a7c359f89..812f19afdbc0 100644 --- a/cmd/clusterctl/testdata/no-args.golden +++ b/cmd/clusterctl/testdata/no-args.golden @@ -23,7 +23,7 @@ Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden index 9ca44dee7cab..7dc93adbab7c 100644 --- a/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden @@ -19,7 +19,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden b/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden index 943573942336..b0dd25c4f154 100644 --- a/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden +++ b/cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden @@ -19,7 +19,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/cmd/clusterctl/testdata/validate-no-args.golden b/cmd/clusterctl/testdata/validate-no-args.golden index e88396b0321c..b053749dcad4 100644 --- a/cmd/clusterctl/testdata/validate-no-args.golden +++ b/cmd/clusterctl/testdata/validate-no-args.golden @@ -20,7 +20,7 @@ Global Flags: --logtostderr log to standard error instead of files (default true) --master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster. --skip-headers If true, avoid header prefixes in the log messages - --skip-log-headers If true, avoid headers when openning log files + --skip-log-headers If true, avoid headers when opening log files --stderrthreshold severity logs at or above this threshold go to stderr (default 2) -v, --v Level number for the log level verbosity --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go index 3e4e90dc444c..d651a2b0619f 100644 --- a/vendor/github.com/google/uuid/node.go +++ b/vendor/github.com/google/uuid/node.go @@ -48,6 +48,7 @@ func setNodeInterface(name string) bool { // does not specify a specific interface generate a random Node ID // (section 4.1.6) if name == "" { + ifname = "random" randomBits(nodeID[:]) return true } diff --git a/vendor/github.com/onsi/ginkgo/.travis.yml b/vendor/github.com/onsi/ginkgo/.travis.yml index 3900878bd20c..72e8ccf0be98 100644 --- a/vendor/github.com/onsi/ginkgo/.travis.yml +++ b/vendor/github.com/onsi/ginkgo/.travis.yml @@ -1,11 +1,9 @@ language: go go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - 1.10.x - 1.11.x + - 1.12.x + - tip install: - go get -v -t ./... @@ -14,4 +12,4 @@ install: - go install github.com/onsi/ginkgo/ginkgo - export PATH=$PATH:$HOME/gopath/bin -script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet +script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet diff --git a/vendor/github.com/onsi/ginkgo/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/CHANGELOG.md index d7d797017ab2..4920406aeb82 100644 --- a/vendor/github.com/onsi/ginkgo/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.8.0 + +### New Features +- allow config of the vet flag for `go test` (#562) [3cd45fa] +- Support projects using go modules [d56ee76] + +### Fixes and Minor Improvements +- chore(godoc): fixes typos in Measurement funcs [dbaca8e] +- Optimize focus to avoid allocations [f493786] +- Ensure generated test file names are underscored [505cc35] + ## 1.7.0 ### New Features diff --git a/vendor/github.com/onsi/ginkgo/config/config.go b/vendor/github.com/onsi/ginkgo/config/config.go index 5e509313c3c1..dab2a24708cb 100644 --- a/vendor/github.com/onsi/ginkgo/config/config.go +++ b/vendor/github.com/onsi/ginkgo/config/config.go @@ -20,7 +20,7 @@ import ( "fmt" ) -const VERSION = "1.7.0" +const VERSION = "1.8.0" type GinkgoConfigType struct { RandomSeed int64 diff --git a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index 5aa96b4d9351..a6b96d88fdfd 100644 --- a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -457,13 +457,13 @@ func FMeasure(text string, body interface{}, samples int) bool { return true } -//You can mark Maeasurements as pending using PMeasure +//You can mark Measurements as pending using PMeasure func PMeasure(text string, _ ...interface{}) bool { globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//You can mark Maeasurements as pending using XMeasure +//You can mark Measurements as pending using XMeasure func XMeasure(text string, _ ...interface{}) bool { globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true diff --git a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go index 006185ab5d86..27c0d1d6cd0f 100644 --- a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go +++ b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go @@ -7,14 +7,21 @@ import ( ) type Specs struct { - specs []*Spec + specs []*Spec + names []string + hasProgrammaticFocus bool RegexScansFilePath bool } func NewSpecs(specs []*Spec) *Specs { + names := make([]string, len(specs)) + for i, spec := range specs { + names[i] = spec.ConcatenatedString() + } return &Specs{ specs: specs, + names: names, } } @@ -30,10 +37,13 @@ func (e *Specs) Shuffle(r *rand.Rand) { sort.Sort(e) permutation := r.Perm(len(e.specs)) shuffledSpecs := make([]*Spec, len(e.specs)) + names := make([]string, len(e.specs)) for i, j := range permutation { shuffledSpecs[i] = e.specs[j] + names[i] = e.names[j] } e.specs = shuffledSpecs + e.names = names } func (e *Specs) ApplyFocus(description string, focusString string, skipString string) { @@ -64,33 +74,43 @@ func (e *Specs) applyProgrammaticFocus() { // toMatch returns a byte[] to be used by regex matchers. When adding new behaviours to the matching function, // this is the place which we append to. -func (e *Specs) toMatch(description string, spec *Spec) []byte { +func (e *Specs) toMatch(description string, i int) []byte { + if i > len(e.names) { + return nil + } if e.RegexScansFilePath { return []byte( description + " " + - spec.ConcatenatedString() + " " + - spec.subject.CodeLocation().FileName) + e.names[i] + " " + + e.specs[i].subject.CodeLocation().FileName) } else { return []byte( description + " " + - spec.ConcatenatedString()) + e.names[i]) } } func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string, skipString string) { - for _, spec := range e.specs { + var focusFilter *regexp.Regexp + if focusString != "" { + focusFilter = regexp.MustCompile(focusString) + } + var skipFilter *regexp.Regexp + if skipString != "" { + skipFilter = regexp.MustCompile(skipString) + } + + for i, spec := range e.specs { matchesFocus := true matchesSkip := false - toMatch := e.toMatch(description, spec) + toMatch := e.toMatch(description, i) - if focusString != "" { - focusFilter := regexp.MustCompile(focusString) + if focusFilter != nil { matchesFocus = focusFilter.Match([]byte(toMatch)) } - if skipString != "" { - skipFilter := regexp.MustCompile(skipString) + if skipFilter != nil { matchesSkip = skipFilter.Match([]byte(toMatch)) } @@ -115,9 +135,10 @@ func (e *Specs) Len() int { } func (e *Specs) Less(i, j int) bool { - return e.specs[i].ConcatenatedString() < e.specs[j].ConcatenatedString() + return e.names[i] < e.names[j] } func (e *Specs) Swap(i, j int) { + e.names[i], e.names[j] = e.names[j], e.names[i] e.specs[i], e.specs[j] = e.specs[j], e.specs[i] } diff --git a/vendor/github.com/onsi/gomega/.travis.yml b/vendor/github.com/onsi/gomega/.travis.yml index 4d71367f6fb6..2420a5d07091 100644 --- a/vendor/github.com/onsi/gomega/.travis.yml +++ b/vendor/github.com/onsi/gomega/.travis.yml @@ -1,12 +1,9 @@ language: go go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - 1.10.x - 1.11.x + - 1.12.x env: - GO111MODULE=on @@ -17,7 +14,4 @@ install: - go get github.com/onsi/ginkgo - go install github.com/onsi/ginkgo/ginkgo -script: | - $HOME/gopath/bin/ginkgo -p -r --randomizeAllSpecs --failOnPending --randomizeSuites --race && - go vet && - [ -z "`gofmt -l -e -s -w .`" ] +script: make test diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 9153294f75fb..5d1eda83741e 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.5.0 + +### Features + +- Added MatchKeys matchers [8b909fc] + +### Fixes and Minor Improvements + +- Add type aliases to remove stuttering [03b0461] +- Don't run session_test.go on windows (#324) [5533ce8] + ## 1.4.3 ### Fixes: diff --git a/vendor/github.com/onsi/gomega/Makefile b/vendor/github.com/onsi/gomega/Makefile new file mode 100644 index 000000000000..c92cd56e3adc --- /dev/null +++ b/vendor/github.com/onsi/gomega/Makefile @@ -0,0 +1,6 @@ +test: + [ -z "`gofmt -s -w -l -e .`" ] + go vet + ginkgo -p -r --randomizeAllSpecs --failOnPending --randomizeSuites --race + +.PHONY: test diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 471f691a62a5..448d595da64b 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -24,7 +24,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.4.3" +const GOMEGA_VERSION = "1.5.0" const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil. If you're using Ginkgo then you probably forgot to put your assertion in an It(). @@ -39,20 +39,14 @@ var defaultEventuallyPollingInterval = 10 * time.Millisecond var defaultConsistentlyDuration = 100 * time.Millisecond var defaultConsistentlyPollingInterval = 10 * time.Millisecond -//RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails -//the fail handler passed into RegisterFailHandler is called. +// RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails +// the fail handler passed into RegisterFailHandler is called. func RegisterFailHandler(handler types.GomegaFailHandler) { - if handler == nil { - globalFailWrapper = nil - return - } - - globalFailWrapper = &types.GomegaFailWrapper{ - Fail: handler, - TWithHelper: testingtsupport.EmptyTWithHelper{}, - } + RegisterFailHandlerWithT(testingtsupport.EmptyTWithHelper{}, handler) } +// RegisterFailHandlerWithT ensures that the given types.TWithHelper and fail handler +// are used globally. func RegisterFailHandlerWithT(t types.TWithHelper, handler types.GomegaFailHandler) { if handler == nil { globalFailWrapper = nil @@ -65,12 +59,12 @@ func RegisterFailHandlerWithT(t types.TWithHelper, handler types.GomegaFailHandl } } -//RegisterTestingT connects Gomega to Golang's XUnit style -//Testing.T tests. It is now deprecated and you should use NewGomegaWithT() instead. +// RegisterTestingT connects Gomega to Golang's XUnit style +// Testing.T tests. It is now deprecated and you should use NewWithT() instead. // -//Legacy Documentation: +// Legacy Documentation: // -//You'll need to call this at the top of each XUnit style test: +// You'll need to call this at the top of each XUnit style test: // // func TestFarmHasCow(t *testing.T) { // RegisterTestingT(t) @@ -83,7 +77,7 @@ func RegisterFailHandlerWithT(t types.TWithHelper, handler types.GomegaFailHandl // pass `t` down to the matcher itself). This means that you cannot run the XUnit style tests // in parallel as the global fail handler cannot point to more than one testing.T at a time. // -// NewGomegaWithT() does not have this limitation +// NewWithT() does not have this limitation // // (As an aside: Ginkgo gets around this limitation by running parallel tests in different *processes*). func RegisterTestingT(t types.GomegaTestingT) { @@ -95,15 +89,15 @@ func RegisterTestingT(t types.GomegaTestingT) { RegisterFailHandlerWithT(tWithHelper, testingtsupport.BuildTestingTGomegaFailWrapper(t).Fail) } -//InterceptGomegaHandlers runs a given callback and returns an array of -//failure messages generated by any Gomega assertions within the callback. +// InterceptGomegaFailures runs a given callback and returns an array of +// failure messages generated by any Gomega assertions within the callback. // -//This is accomplished by temporarily replacing the *global* fail handler -//with a fail handler that simply annotates failures. The original fail handler -//is reset when InterceptGomegaFailures returns. +// This is accomplished by temporarily replacing the *global* fail handler +// with a fail handler that simply annotates failures. The original fail handler +// is reset when InterceptGomegaFailures returns. // -//This is most useful when testing custom matchers, but can also be used to check -//on a value using a Gomega assertion without causing a test failure. +// This is most useful when testing custom matchers, but can also be used to check +// on a value using a Gomega assertion without causing a test failure. func InterceptGomegaFailures(f func()) []string { originalHandler := globalFailWrapper.Fail failures := []string{} @@ -115,108 +109,108 @@ func InterceptGomegaFailures(f func()) []string { return failures } -//Ω wraps an actual value allowing assertions to be made on it: +// Ω wraps an actual value allowing assertions to be made on it: // Ω("foo").Should(Equal("foo")) // -//If Ω is passed more than one argument it will pass the *first* argument to the matcher. -//All subsequent arguments will be required to be nil/zero. +// If Ω is passed more than one argument it will pass the *first* argument to the matcher. +// All subsequent arguments will be required to be nil/zero. // -//This is convenient if you want to make an assertion on a method/function that returns -//a value and an error - a common patter in Go. +// This is convenient if you want to make an assertion on a method/function that returns +// a value and an error - a common patter in Go. // -//For example, given a function with signature: -// func MyAmazingThing() (int, error) +// For example, given a function with signature: +// func MyAmazingThing() (int, error) // -//Then: +// Then: // Ω(MyAmazingThing()).Should(Equal(3)) -//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// Will succeed only if `MyAmazingThing()` returns `(3, nil)` // -//Ω and Expect are identical -func Ω(actual interface{}, extra ...interface{}) GomegaAssertion { +// Ω and Expect are identical +func Ω(actual interface{}, extra ...interface{}) Assertion { return ExpectWithOffset(0, actual, extra...) } -//Expect wraps an actual value allowing assertions to be made on it: +// Expect wraps an actual value allowing assertions to be made on it: // Expect("foo").To(Equal("foo")) // -//If Expect is passed more than one argument it will pass the *first* argument to the matcher. -//All subsequent arguments will be required to be nil/zero. +// If Expect is passed more than one argument it will pass the *first* argument to the matcher. +// All subsequent arguments will be required to be nil/zero. // -//This is convenient if you want to make an assertion on a method/function that returns -//a value and an error - a common patter in Go. +// This is convenient if you want to make an assertion on a method/function that returns +// a value and an error - a common patter in Go. // -//For example, given a function with signature: -// func MyAmazingThing() (int, error) +// For example, given a function with signature: +// func MyAmazingThing() (int, error) // -//Then: +// Then: // Expect(MyAmazingThing()).Should(Equal(3)) -//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// Will succeed only if `MyAmazingThing()` returns `(3, nil)` // -//Expect and Ω are identical -func Expect(actual interface{}, extra ...interface{}) GomegaAssertion { +// Expect and Ω are identical +func Expect(actual interface{}, extra ...interface{}) Assertion { return ExpectWithOffset(0, actual, extra...) } -//ExpectWithOffset wraps an actual value allowing assertions to be made on it: +// ExpectWithOffset wraps an actual value allowing assertions to be made on it: // ExpectWithOffset(1, "foo").To(Equal("foo")) // -//Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument -//this is used to modify the call-stack offset when computing line numbers. +// Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument +// this is used to modify the call-stack offset when computing line numbers. // -//This is most useful in helper functions that make assertions. If you want Gomega's -//error message to refer to the calling line in the test (as opposed to the line in the helper function) -//set the first argument of `ExpectWithOffset` appropriately. -func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) GomegaAssertion { +// This is most useful in helper functions that make assertions. If you want Gomega's +// error message to refer to the calling line in the test (as opposed to the line in the helper function) +// set the first argument of `ExpectWithOffset` appropriately. +func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } return assertion.New(actual, globalFailWrapper, offset, extra...) } -//Eventually wraps an actual value allowing assertions to be made on it. -//The assertion is tried periodically until it passes or a timeout occurs. +// Eventually wraps an actual value allowing assertions to be made on it. +// The assertion is tried periodically until it passes or a timeout occurs. // -//Both the timeout and polling interval are configurable as optional arguments: -//The first optional argument is the timeout -//The second optional argument is the polling interval +// Both the timeout and polling interval are configurable as optional arguments: +// The first optional argument is the timeout +// The second optional argument is the polling interval // -//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -//last case they are interpreted as seconds. +// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +// last case they are interpreted as seconds. // -//If Eventually is passed an actual that is a function taking no arguments and returning at least one value, -//then Eventually will call the function periodically and try the matcher against the function's first return value. +// If Eventually is passed an actual that is a function taking no arguments and returning at least one value, +// then Eventually will call the function periodically and try the matcher against the function's first return value. // -//Example: +// Example: // // Eventually(func() int { // return thingImPolling.Count() // }).Should(BeNumerically(">=", 17)) // -//Note that this example could be rewritten: +// Note that this example could be rewritten: // // Eventually(thingImPolling.Count).Should(BeNumerically(">=", 17)) // -//If the function returns more than one value, then Eventually will pass the first value to the matcher and -//assert that all other values are nil/zero. -//This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. +// If the function returns more than one value, then Eventually will pass the first value to the matcher and +// assert that all other values are nil/zero. +// This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. // -//For example, consider a method that returns a value and an error: +// For example, consider a method that returns a value and an error: // func FetchFromDB() (string, error) // -//Then +// Then // Eventually(FetchFromDB).Should(Equal("hasselhoff")) // -//Will pass only if the the returned error is nil and the returned string passes the matcher. +// Will pass only if the the returned error is nil and the returned string passes the matcher. // -//Eventually's default timeout is 1 second, and its default polling interval is 10ms -func Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// Eventually's default timeout is 1 second, and its default polling interval is 10ms +func Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { return EventuallyWithOffset(0, actual, intervals...) } -//EventuallyWithOffset operates like Eventually but takes an additional -//initial argument to indicate an offset in the call stack. This is useful when building helper -//functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// EventuallyWithOffset operates like Eventually but takes an additional +// initial argument to indicate an offset in the call stack. This is useful when building helper +// functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } @@ -231,37 +225,37 @@ func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, globalFailWrapper, timeoutInterval, pollingInterval, offset) } -//Consistently wraps an actual value allowing assertions to be made on it. -//The assertion is tried periodically and is required to pass for a period of time. +// Consistently wraps an actual value allowing assertions to be made on it. +// The assertion is tried periodically and is required to pass for a period of time. // -//Both the total time and polling interval are configurable as optional arguments: -//The first optional argument is the duration that Consistently will run for -//The second optional argument is the polling interval +// Both the total time and polling interval are configurable as optional arguments: +// The first optional argument is the duration that Consistently will run for +// The second optional argument is the polling interval // -//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -//last case they are interpreted as seconds. +// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +// last case they are interpreted as seconds. // -//If Consistently is passed an actual that is a function taking no arguments and returning at least one value, -//then Consistently will call the function periodically and try the matcher against the function's first return value. +// If Consistently is passed an actual that is a function taking no arguments and returning at least one value, +// then Consistently will call the function periodically and try the matcher against the function's first return value. // -//If the function returns more than one value, then Consistently will pass the first value to the matcher and -//assert that all other values are nil/zero. -//This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. +// If the function returns more than one value, then Consistently will pass the first value to the matcher and +// assert that all other values are nil/zero. +// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. // -//Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. -//For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: +// Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. +// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: // -// Consistently(channel).ShouldNot(Receive()) +// Consistently(channel).ShouldNot(Receive()) // -//Consistently's default duration is 100ms, and its default polling interval is 10ms -func Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// Consistently's default duration is 100ms, and its default polling interval is 10ms +func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { return ConsistentlyWithOffset(0, actual, intervals...) } -//ConsistentlyWithOffset operates like Consistnetly but takes an additional -//initial argument to indicate an offset in the call stack. This is useful when building helper -//functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// ConsistentlyWithOffset operates like Consistnetly but takes an additional +// initial argument to indicate an offset in the call stack. This is useful when building helper +// functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } @@ -276,59 +270,62 @@ func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interfa return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, globalFailWrapper, timeoutInterval, pollingInterval, offset) } -//Set the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. +// SetDefaultEventuallyTimeout sets the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. func SetDefaultEventuallyTimeout(t time.Duration) { defaultEventuallyTimeout = t } -//Set the default polling interval for Eventually. +// SetDefaultEventuallyPollingInterval sets the default polling interval for Eventually. func SetDefaultEventuallyPollingInterval(t time.Duration) { defaultEventuallyPollingInterval = t } -//Set the default duration for Consistently. Consistently will verify that your condition is satsified for this long. +// SetDefaultConsistentlyDuration sets the default duration for Consistently. Consistently will verify that your condition is satsified for this long. func SetDefaultConsistentlyDuration(t time.Duration) { defaultConsistentlyDuration = t } -//Set the default polling interval for Consistently. +// SetDefaultConsistentlyPollingInterval sets the default polling interval for Consistently. func SetDefaultConsistentlyPollingInterval(t time.Duration) { defaultConsistentlyPollingInterval = t } -//GomegaAsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against -//the matcher passed to the Should and ShouldNot methods. +// AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against +// the matcher passed to the Should and ShouldNot methods. // -//Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to -//fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more -//descriptive +// Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to +// fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more +// descriptive. // -//Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. +// Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. // -//Example: +// Example: // -// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") -// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") -type GomegaAsyncAssertion interface { +// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") +// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") +type AsyncAssertion interface { Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool } -//GomegaAssertion is returned by Ω and Expect and compares the actual value to the matcher -//passed to the Should/ShouldNot and To/ToNot/NotTo methods. +// GomegaAsyncAssertion is deprecated in favor of AsyncAssertion, which does not stutter. +type GomegaAsyncAssertion = AsyncAssertion + +// Assertion is returned by Ω and Expect and compares the actual value to the matcher +// passed to the Should/ShouldNot and To/ToNot/NotTo methods. // -//Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect -//though this is not enforced. +// Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect +// though this is not enforced. // -//All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() -//and is used to annotate failure messages. +// All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() +// and is used to annotate failure messages. // -//All methods return a bool that is true if hte assertion passed and false if it failed. +// All methods return a bool that is true if hte assertion passed and false if it failed. // -//Example: +// Example: // -// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) -type GomegaAssertion interface { +// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) +type Assertion interface { Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool @@ -337,39 +334,50 @@ type GomegaAssertion interface { NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool } -//OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it +// GomegaAssertion is deprecated in favor of Assertion, which does not stutter. +type GomegaAssertion = Assertion + +// OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it type OmegaMatcher types.GomegaMatcher -//GomegaWithT wraps a *testing.T and provides `Expect`, `Eventually`, and `Consistently` methods. This allows you to leverage -//Gomega's rich ecosystem of matchers in standard `testing` test suites. +// WithT wraps a *testing.T and provides `Expect`, `Eventually`, and `Consistently` methods. This allows you to leverage +// Gomega's rich ecosystem of matchers in standard `testing` test suites. // -//Use `NewGomegaWithT` to instantiate a `GomegaWithT` -type GomegaWithT struct { +// Use `NewWithT` to instantiate a `WithT` +type WithT struct { t types.GomegaTestingT } -//NewGomegaWithT takes a *testing.T and returngs a `GomegaWithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with -//Gomega's rich ecosystem of matchers in standard `testing` test suits. +// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter. +type GomegaWithT = WithT + +// NewWithT takes a *testing.T and returngs a `gomega.WithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with +// Gomega's rich ecosystem of matchers in standard `testing` test suits. // // func TestFarmHasCow(t *testing.T) { -// g := GomegaWithT(t) +// g := gomega.NewWithT(t) // // f := farm.New([]string{"Cow", "Horse"}) // g.Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") // } -func NewGomegaWithT(t types.GomegaTestingT) *GomegaWithT { - return &GomegaWithT{ +func NewWithT(t types.GomegaTestingT) *WithT { + return &WithT{ t: t, } } -//See documentation for Expect -func (g *GomegaWithT) Expect(actual interface{}, extra ...interface{}) GomegaAssertion { +// NewGomegaWithT is deprecated in favor of gomega.NewWithT, which does not stutter. +func NewGomegaWithT(t types.GomegaTestingT) *GomegaWithT { + return NewWithT(t) +} + +// Expect is used to make assertions. See documentation for Expect. +func (g *WithT) Expect(actual interface{}, extra ...interface{}) Assertion { return assertion.New(actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), 0, extra...) } -//See documentation for Eventually -func (g *GomegaWithT) Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// Eventually is used to make asynchronous assertions. See documentation for Eventually. +func (g *WithT) Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { timeoutInterval := defaultEventuallyTimeout pollingInterval := defaultEventuallyPollingInterval if len(intervals) > 0 { @@ -381,8 +389,8 @@ func (g *GomegaWithT) Eventually(actual interface{}, intervals ...interface{}) G return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), timeoutInterval, pollingInterval, 0) } -//See documentation for Consistently -func (g *GomegaWithT) Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { +// Consistently is used to make asynchronous assertions. See documentation for Consistently. +func (g *WithT) Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { timeoutInterval := defaultConsistentlyDuration pollingInterval := defaultConsistentlyPollingInterval if len(intervals) > 0 { diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go index ebdd71786d87..bef00ae21de9 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -29,5 +29,5 @@ func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message } func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") + return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred") } diff --git a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go index 3b412ce818a7..5c815f5af740 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go @@ -70,7 +70,7 @@ func parseXmlContent(content string) (*xmlNode, error) { if err == io.EOF { break } - return nil, fmt.Errorf("failed to decode next token: %v", err) + return nil, fmt.Errorf("failed to decode next token: %v", err) // untested section } lastNodeIndex := len(allNodes) - 1 @@ -94,7 +94,7 @@ func parseXmlContent(content string) (*xmlNode, error) { case xml.CharData: lastNode.Content = append(lastNode.Content, tok.Copy()...) case xml.Comment: - lastNode.Comments = append(lastNode.Comments, tok.Copy()) + lastNode.Comments = append(lastNode.Comments, tok.Copy()) // untested section case xml.ProcInst: lastNode.ProcInsts = append(lastNode.ProcInsts, tok.Copy()) } diff --git a/vendor/k8s.io/klog/klog.go b/vendor/k8s.io/klog/klog.go index 887ea62dff75..b033996c0529 100644 --- a/vendor/k8s.io/klog/klog.go +++ b/vendor/k8s.io/klog/klog.go @@ -35,11 +35,11 @@ // Log output is buffered and written periodically using Flush. Programs // should call Flush before exiting to guarantee all log output is written. // -// By default, all log statements write to files in a temporary directory. +// By default, all log statements write to standard error. // This package provides several flags that modify this behavior. // As a result, flag.Parse must be called before any logging is done. // -// -logtostderr=false +// -logtostderr=true // Logs are written to standard error instead of to files. // -alsologtostderr=false // Logs are written to standard error as well as to files. @@ -404,21 +404,46 @@ func init() { go logging.flushDaemon() } -// InitFlags is for explicitly initializing the flags +var initDefaultsOnce sync.Once + +// InitFlags is for explicitly initializing the flags. func InitFlags(flagset *flag.FlagSet) { + + // Initialize defaults. + initDefaultsOnce.Do(func() { + logging.logDir = "" + logging.logFile = "" + logging.logFileMaxSizeMB = 1800 + // TODO: The default value of toStderr should be false. + // Ideally, toStderr can be deprecated. + // If --log-file is set, only log to the dedicated log-file. + // If --alsoToStderr is true, whether or not --log-file is set, we will + // log to stderr. + // Since kubernetes/kubernetes are currently using klog with + // default --toStderr to be true, we can't change this default value + // directly. + // As a compromise, when --log-file is set, the toStdErr is reset to + // be false. e.g. See function `IsSingleMode`. + logging.toStderr = true + logging.alsoToStderr = false + logging.skipHeaders = false + logging.skipLogHeaders = false + }) + if flagset == nil { flagset = flag.CommandLine } - flagset.StringVar(&logging.logDir, "log_dir", "", "If non-empty, write log files in this directory") - flagset.StringVar(&logging.logFile, "log_file", "", "If non-empty, use this log file") - flagset.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", 1800, + + flagset.StringVar(&logging.logDir, "log_dir", logging.logDir, "If non-empty, write log files in this directory") + flagset.StringVar(&logging.logFile, "log_file", logging.logFile, "If non-empty, use this log file") + flagset.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", logging.logFileMaxSizeMB, "Defines the maximum size a log file can grow to. Unit is megabytes. "+ "If the value is 0, the maximum file size is unlimited.") - flagset.BoolVar(&logging.toStderr, "logtostderr", true, "log to standard error instead of files") - flagset.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files") + flagset.BoolVar(&logging.toStderr, "logtostderr", logging.toStderr, "log to standard error instead of files") + flagset.BoolVar(&logging.alsoToStderr, "alsologtostderr", logging.alsoToStderr, "log to standard error as well as files") flagset.Var(&logging.verbosity, "v", "number for the log level verbosity") - flagset.BoolVar(&logging.skipHeaders, "skip_headers", false, "If true, avoid header prefixes in the log messages") - flagset.BoolVar(&logging.skipLogHeaders, "skip_log_headers", false, "If true, avoid headers when openning log files") + flagset.BoolVar(&logging.skipHeaders, "skip_headers", logging.skipHeaders, "If true, avoid header prefixes in the log messages") + flagset.BoolVar(&logging.skipLogHeaders, "skip_log_headers", logging.skipLogHeaders, "If true, avoid headers when opening log files") flagset.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr") flagset.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging") flagset.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace") @@ -452,6 +477,8 @@ type loggingT struct { mu sync.Mutex // file holds writer for each of the log types. file [numSeverity]flushSyncWriter + // file holds writer for the dedicated file when --log-file is set. + singleModeFile flushSyncWriter // pcs is used in V to avoid an allocation when computing the caller's PC. pcs [1]uintptr // vmap is a cache of the V Level for each V() call site, identified by PC. @@ -496,6 +523,16 @@ type buffer struct { var logging loggingT +func (l *loggingT) IsSingleMode() bool { + if l.logFile != "" { + // TODO: Remove the toStdErr reset when switching the logging.toStderr + // default value to be false. + l.toStderr = false + return true + } + return false +} + // setVState sets a consistent state for V logging. // l.mu is held. func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) { @@ -721,24 +758,40 @@ func (rb *redirectBuffer) Write(bytes []byte) (n int, err error) { // SetOutput sets the output destination for all severities func SetOutput(w io.Writer) { - for s := fatalLog; s >= infoLog; s-- { + // In single-mode, all severity logs are tracked in a single dedicated file. + if logging.IsSingleMode() { rb := &redirectBuffer{ w: w, } - logging.file[s] = rb + logging.singleModeFile = rb + } else { + for s := fatalLog; s >= infoLog; s-- { + rb := &redirectBuffer{ + w: w, + } + logging.file[s] = rb + } } } // SetOutputBySeverity sets the output destination for specific severity func SetOutputBySeverity(name string, w io.Writer) { - sev, ok := severityByName(name) - if !ok { - panic(fmt.Sprintf("SetOutputBySeverity(%q): unrecognized severity name", name)) - } - rb := &redirectBuffer{ - w: w, + // In single-mode, all severity logs are tracked in a single dedicated file. + // Guarantee this buffer exists whatever severity output is trying to be set. + if logging.IsSingleMode() { + if logging.singleModeFile == nil { + logging.singleModeFile = &redirectBuffer{w: w} + } + } else { + sev, ok := severityByName(name) + if !ok { + panic(fmt.Sprintf("SetOutputBySeverity(%q): unrecognized severity name", name)) + } + rb := &redirectBuffer{ + w: w, + } + logging.file[sev] = rb } - logging.file[sev] = rb } // output writes the data to the log files and releases the buffer. @@ -750,32 +803,7 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo } } data := buf.Bytes() - if l.toStderr { - os.Stderr.Write(data) - } else { - if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() { - os.Stderr.Write(data) - } - if l.file[s] == nil { - if err := l.createFiles(s); err != nil { - os.Stderr.Write(data) // Make sure the message appears somewhere. - l.exit(err) - } - } - switch s { - case fatalLog: - l.file[fatalLog].Write(data) - fallthrough - case errorLog: - l.file[errorLog].Write(data) - fallthrough - case warningLog: - l.file[warningLog].Write(data) - fallthrough - case infoLog: - l.file[infoLog].Write(data) - } - } + l.writeLogData(s, data) if s == fatalLog { // If we got here via Exit rather than Fatal, print no stacks. if atomic.LoadUint32(&fatalNoStacks) > 0 { @@ -783,33 +811,65 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo timeoutFlush(10 * time.Second) os.Exit(1) } - // Dump all goroutine stacks before exiting. - // First, make sure we see the trace for the current goroutine on standard error. - // If -logtostderr has been specified, the loop below will do that anyway - // as the first stack in the full dump. - if !l.toStderr { - os.Stderr.Write(stacks(false)) - } - // Write the stack trace for all goroutines to the files. - trace := stacks(true) logExitFunc = func(error) {} // If we get a write error, we'll still exit below. - for log := fatalLog; log >= infoLog; log-- { - if f := l.file[log]; f != nil { // Can be nil if -logtostderr is set. - f.Write(trace) - } - } + l.writeLogData(fatalLog, stacks(true)) l.mu.Unlock() timeoutFlush(10 * time.Second) os.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway. } l.putBuffer(buf) l.mu.Unlock() + // Note: The stats estimate logs for each severity level individually, + // even in the situation that log-file is specified and + // all severity-level logs are tracked only in the infoLog file. if stats := severityStats[s]; stats != nil { atomic.AddInt64(&stats.lines, 1) atomic.AddInt64(&stats.bytes, int64(len(data))) } } +// writeLogData writes |data| to the `s` and lower severity files. +// e.g. If Severity level is Error, the data will be written to all the Error, +// Warning, and Info log file. However, if --log_file flag is provided, klog +// no longer tracks logs separately due to their severity level, but rather +// only write to the singleModeFile which later on will be flushed to the +// dedicated log_file. +func (l *loggingT) writeLogData(s severity, data []byte) { + shouldAlsoToStderr := l.alsoToStderr && s >= l.stderrThreshold.get() + if l.IsSingleMode() { + if shouldAlsoToStderr { + os.Stderr.Write(data) + } + if l.singleModeFile == nil { + now := time.Now() + sb := &syncBuffer{ + logger: l, + maxbytes: CalculateMaxSize(), + } + if err := sb.rotateFile(now, true); err != nil { + l.exit(err) + } + l.singleModeFile = sb + } + l.singleModeFile.Write(data) + } else { + if l.toStderr || shouldAlsoToStderr { + os.Stderr.Write(data) + } + for currSeverity := s; currSeverity >= infoLog; currSeverity-- { + if l.file[currSeverity] == nil { + if err := l.createFiles(currSeverity); err != nil { + os.Stderr.Write(data) // Make sure the message appears somewhere. + l.exit(err) + } + } + if f := l.file[currSeverity]; f != nil { // Can be nil if -logtostderr is set. + f.Write(data) + } + } + } +} + // timeoutFlush calls Flush and returns when it completes or after timeout // elapses, whichever happens first. This is needed because the hooks invoked // by Flush may deadlock when glog.Fatal is called from a hook that holds @@ -987,13 +1047,21 @@ func (l *loggingT) lockAndFlushAll() { // flushAll flushes all the logs and attempts to "sync" their data to disk. // l.mu is held. func (l *loggingT) flushAll() { - // Flush from fatal down, in case there's trouble flushing. - for s := fatalLog; s >= infoLog; s-- { - file := l.file[s] + if l.IsSingleMode() { + file := l.singleModeFile if file != nil { file.Flush() // ignore error file.Sync() // ignore error } + } else { + // Flush from fatal down, in case there's trouble flushing. + for s := fatalLog; s >= infoLog; s-- { + file := l.file[s] + if file != nil { + file.Flush() // ignore error + file.Sync() // ignore error + } + } } } @@ -1079,9 +1147,9 @@ type Verbose bool // The returned value is a boolean of type Verbose, which implements Info, Infoln // and Infof. These methods will write to the Info log if called. // Thus, one may write either -// if glog.V(2) { glog.Info("log this") } +// if glog.V(2) { glog.Info("log this") } // or -// glog.V(2).Info("log this") +// glog.V(2).Info("log this") // The second form is shorter but the first is cheaper if logging is off because it does // not evaluate its arguments. // diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/BUILD.bazel b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/BUILD.bazel index 8f48cde740ad..4d055541137e 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/BUILD.bazel +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/BUILD.bazel @@ -27,5 +27,6 @@ go_library( "//vendor/k8s.io/client-go/tools/cache:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client/apiutil:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil:go_default_library", ], ) diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/cache_reader.go b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/cache_reader.go index 62a16eb1ae08..a5bac803851a 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/cache_reader.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/cache_reader.go @@ -30,6 +30,7 @@ import ( "k8s.io/apimachinery/pkg/selection" "k8s.io/client-go/tools/cache" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/internal/objectutil" ) // CacheReader is a CacheReader @@ -115,33 +116,30 @@ func (c *CacheReader) List(_ context.Context, opts *client.ListOptions, out runt labelSel = opts.LabelSelector } - outItems, err := c.getListItems(objs, labelSel) + filteredItems, err := c.filterListItems(objs, labelSel) if err != nil { return err } - return apimeta.SetList(out, outItems) + + return apimeta.SetList(out, filteredItems) } -func (c *CacheReader) getListItems(objs []interface{}, labelSel labels.Selector) ([]runtime.Object, error) { - outItems := make([]runtime.Object, 0, len(objs)) +func (c *CacheReader) filterListItems(objs []interface{}, labelSel labels.Selector) ([]runtime.Object, error) { + runtimeObjs := make([]runtime.Object, 0, len(objs)) for _, item := range objs { obj, isObj := item.(runtime.Object) if !isObj { return nil, fmt.Errorf("cache contained %T, which is not an Object", obj) } - meta, err := apimeta.Accessor(obj) - if err != nil { - return nil, err - } - if labelSel != nil { - lbls := labels.Set(meta.GetLabels()) - if !labelSel.Matches(lbls) { - continue - } - } - outItems = append(outItems, obj.DeepCopyObject()) + runtimeObjs = append(runtimeObjs, obj) } - return outItems, nil + + filteredItems, err := objectutil.FilterWithLabels(runtimeObjs, labelSel) + if err != nil { + return nil, err + } + + return filteredItems, nil } // objectKeyToStorageKey converts an object key to store key. diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/BUILD.bazel b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/BUILD.bazel index e4b306350948..120265abbf21 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/BUILD.bazel +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/BUILD.bazel @@ -11,12 +11,14 @@ go_library( visibility = ["//visibility:public"], deps = [ "//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", "//vendor/k8s.io/client-go/testing:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/client/apiutil:go_default_library", + "//vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil:go_default_library", "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/log:go_default_library", ], ) diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go index 09055a5bac8a..1d730940ca3d 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go @@ -24,6 +24,7 @@ import ( "strings" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes/scheme" @@ -31,6 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + "sigs.k8s.io/controller-runtime/pkg/internal/objectutil" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" ) @@ -110,7 +112,30 @@ func (c *fakeClient) List(ctx context.Context, opts *client.ListOptions, list ru } decoder := scheme.Codecs.UniversalDecoder() _, _, err = decoder.Decode(j, nil, list) - return err + if err != nil { + return err + } + + if opts.LabelSelector != nil { + return filterListItems(list, opts.LabelSelector) + } + return nil +} + +func filterListItems(list runtime.Object, labSel labels.Selector) error { + objs, err := meta.ExtractList(list) + if err != nil { + return err + } + filteredObjs, err := objectutil.FilterWithLabels(objs, labSel) + if err != nil { + return err + } + err = meta.SetList(list, filteredObjs) + if err != nil { + return err + } + return nil } func (c *fakeClient) Create(ctx context.Context, obj runtime.Object) error { diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/typed_client.go b/vendor/sigs.k8s.io/controller-runtime/pkg/client/typed_client.go index 26cb81d8ba35..51cef3006fa6 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/client/typed_client.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/typed_client.go @@ -104,7 +104,6 @@ func (c *typedClient) List(ctx context.Context, opts *ListOptions, obj runtime.O return r.Get(). NamespaceIfScoped(namespace, r.isNamespaced()). Resource(r.resource()). - Body(obj). VersionedParams(opts.AsListOptions(), c.paramCodec). Context(ctx). Do(). diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/BUILD.bazel b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/BUILD.bazel new file mode 100644 index 000000000000..81401fb7bec7 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["filter.go"], + importmap = "sigs.k8s.io/cluster-api/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil", + importpath = "sigs.k8s.io/controller-runtime/pkg/internal/objectutil", + visibility = ["//vendor/sigs.k8s.io/controller-runtime/pkg:__subpackages__"], + deps = [ + "//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + ], +) diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go new file mode 100644 index 000000000000..8513846e2c17 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go @@ -0,0 +1,42 @@ +/* +Copyright 2018 The Kubernetes Authors. + +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 objectutil + +import ( + apimeta "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" +) + +// FilterWithLabels returns a copy of the items in objs matching labelSel +func FilterWithLabels(objs []runtime.Object, labelSel labels.Selector) ([]runtime.Object, error) { + outItems := make([]runtime.Object, 0, len(objs)) + for _, obj := range objs { + meta, err := apimeta.Accessor(obj) + if err != nil { + return nil, err + } + if labelSel != nil { + lbls := labels.Set(meta.GetLabels()) + if !labelSel.Matches(lbls) { + continue + } + } + outItems = append(outItems, obj.DeepCopyObject()) + } + return outItems, nil +}