Merge pull request #550 from kubernetes-csi/dependabot/go_modules/github.com/onsi/gomega-1.30.0

chore(deps): bump github.com/onsi/gomega from 1.29.0 to 1.30.0
This commit is contained in:
Kubernetes Prow Robot 2023-11-14 08:18:35 +01:00 committed by GitHub
commit 57de884a16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 9 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/golang/protobuf v1.5.3 github.com/golang/protobuf v1.5.3
github.com/kubernetes-csi/csi-lib-utils v0.9.0 github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/onsi/ginkgo/v2 v2.13.1 github.com/onsi/ginkgo/v2 v2.13.1
github.com/onsi/gomega v1.29.0 github.com/onsi/gomega v1.30.0
github.com/pborman/uuid v1.2.1 github.com/pborman/uuid v1.2.1
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
golang.org/x/net v0.18.0 golang.org/x/net v0.18.0

4
go.sum
View File

@ -311,8 +311,8 @@ github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeR
github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc=
github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM=
github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg=
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU= github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU=

View File

@ -1,3 +1,12 @@
## 1.30.0
### Features
- BeTrueBecause and BeFalseBecause allow for better failure messages [4da4c7f]
### Maintenance
- Bump actions/checkout from 3 to 4 (#694) [6ca6e97]
- doc: fix type on gleak go doc [f1b8343]
## 1.29.0 ## 1.29.0
### Features ### Features

View File

@ -22,7 +22,7 @@ import (
"github.com/onsi/gomega/types" "github.com/onsi/gomega/types"
) )
const GOMEGA_VERSION = "1.29.0" const GOMEGA_VERSION = "1.30.0"
const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.
If you're using Ginkgo then you probably forgot to put your assertion in an It(). If you're using Ginkgo then you probably forgot to put your assertion in an It().

View File

@ -1,6 +1,7 @@
package gomega package gomega
import ( import (
"fmt"
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
@ -52,15 +53,31 @@ func BeNil() types.GomegaMatcher {
} }
// BeTrue succeeds if actual is true // BeTrue succeeds if actual is true
//
// In general, it's better to use `BeTrueBecause(reason)` to provide a more useful error message if a true check fails.
func BeTrue() types.GomegaMatcher { func BeTrue() types.GomegaMatcher {
return &matchers.BeTrueMatcher{} return &matchers.BeTrueMatcher{}
} }
// BeFalse succeeds if actual is false // BeFalse succeeds if actual is false
//
// In general, it's better to use `BeFalseBecause(reason)` to provide a more useful error message if a false check fails.
func BeFalse() types.GomegaMatcher { func BeFalse() types.GomegaMatcher {
return &matchers.BeFalseMatcher{} return &matchers.BeFalseMatcher{}
} }
// BeTrueBecause succeeds if actual is true and displays the provided reason if it is false
// fmt.Sprintf is used to render the reason
func BeTrueBecause(format string, args ...any) types.GomegaMatcher {
return &matchers.BeTrueMatcher{Reason: fmt.Sprintf(format, args...)}
}
// BeFalseBecause succeeds if actual is false and displays the provided reason if it is true.
// fmt.Sprintf is used to render the reason
func BeFalseBecause(format string, args ...any) types.GomegaMatcher {
return &matchers.BeFalseMatcher{Reason: fmt.Sprintf(format, args...)}
}
// HaveOccurred succeeds if actual is a non-nil error // HaveOccurred succeeds if actual is a non-nil error
// The typical Go error checking pattern looks like: // The typical Go error checking pattern looks like:
// //

View File

@ -9,6 +9,7 @@ import (
) )
type BeFalseMatcher struct { type BeFalseMatcher struct {
Reason string
} }
func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) {
@ -20,9 +21,17 @@ func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err erro
} }
func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) {
return format.Message(actual, "to be false") if matcher.Reason == "" {
return format.Message(actual, "to be false")
} else {
return matcher.Reason
}
} }
func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return format.Message(actual, "not to be false") if matcher.Reason == "" {
return format.Message(actual, "not to be false")
} else {
return fmt.Sprintf(`Expected not false but got false\nNegation of "%s" failed`, matcher.Reason)
}
} }

View File

@ -9,6 +9,7 @@ import (
) )
type BeTrueMatcher struct { type BeTrueMatcher struct {
Reason string
} }
func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) {
@ -20,9 +21,17 @@ func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error
} }
func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) {
return format.Message(actual, "to be true") if matcher.Reason == "" {
return format.Message(actual, "to be true")
} else {
return matcher.Reason
}
} }
func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return format.Message(actual, "not to be true") if matcher.Reason == "" {
return format.Message(actual, "not to be true")
} else {
return fmt.Sprintf(`Expected not true but got true\nNegation of "%s" failed`, matcher.Reason)
}
} }

2
vendor/modules.txt vendored
View File

@ -185,7 +185,7 @@ github.com/onsi/ginkgo/v2/internal/parallel_support
github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/internal/testingtproxy
github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/reporters
github.com/onsi/ginkgo/v2/types github.com/onsi/ginkgo/v2/types
# github.com/onsi/gomega v1.29.0 # github.com/onsi/gomega v1.30.0
## explicit; go 1.18 ## explicit; go 1.18
github.com/onsi/gomega github.com/onsi/gomega
github.com/onsi/gomega/format github.com/onsi/gomega/format