mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: bump github.com/onsi/gomega from 1.20.1 to 1.22.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.20.1 to 1.22.1. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.20.1...v1.22.1) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
02ed5ec189
commit
49245788fc
9
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
9
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
@ -1,3 +1,12 @@
|
||||
## 1.22.1
|
||||
|
||||
## Fixes
|
||||
- When passed a context and no explicit timeout, Eventually will only timeout when the context is cancelled [e5105cf]
|
||||
- Allow StopTrying() to be wrapped [bf3cba9]
|
||||
|
||||
## Maintenance
|
||||
- bump to ginkgo v2.3.0 [c5d5c39]
|
||||
|
||||
## 1.22.0
|
||||
|
||||
### Features
|
||||
|
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.22.0"
|
||||
const GOMEGA_VERSION = "1.22.1"
|
||||
|
||||
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().
|
||||
|
71
vendor/github.com/onsi/gomega/internal/async_assertion.go
generated
vendored
71
vendor/github.com/onsi/gomega/internal/async_assertion.go
generated
vendored
@ -2,6 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
@ -17,6 +18,22 @@ type StopTryingError interface {
|
||||
wasViaPanic() bool
|
||||
}
|
||||
|
||||
func asStopTryingError(actual interface{}) (StopTryingError, bool) {
|
||||
if actual == nil {
|
||||
return nil, false
|
||||
}
|
||||
if actualErr, ok := actual.(error); ok {
|
||||
var target *stopTryingError
|
||||
if errors.As(actualErr, &target) {
|
||||
return target, true
|
||||
} else {
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
type stopTryingError struct {
|
||||
message string
|
||||
viaPanic bool
|
||||
@ -35,8 +52,6 @@ func (s *stopTryingError) wasViaPanic() bool {
|
||||
return s.viaPanic
|
||||
}
|
||||
|
||||
var stopTryingErrorType = reflect.TypeOf(&stopTryingError{})
|
||||
|
||||
var StopTrying = func(message string) StopTryingError {
|
||||
return &stopTryingError{message: message}
|
||||
}
|
||||
@ -157,20 +172,19 @@ func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (in
|
||||
return nil, fmt.Errorf("No values were returned by the function passed to Gomega"), stopTrying
|
||||
}
|
||||
actual := values[0].Interface()
|
||||
if actual != nil && reflect.TypeOf(actual) == stopTryingErrorType {
|
||||
stopTrying = actual.(StopTryingError)
|
||||
if stopTryingErr, ok := asStopTryingError(actual); ok {
|
||||
stopTrying = stopTryingErr
|
||||
}
|
||||
for i, extraValue := range values[1:] {
|
||||
extra := extraValue.Interface()
|
||||
if extra == nil {
|
||||
continue
|
||||
}
|
||||
extraType := reflect.TypeOf(extra)
|
||||
if extraType == stopTryingErrorType {
|
||||
stopTrying = extra.(StopTryingError)
|
||||
if stopTryingErr, ok := asStopTryingError(extra); ok {
|
||||
stopTrying = stopTryingErr
|
||||
continue
|
||||
}
|
||||
zero := reflect.Zero(extraType).Interface()
|
||||
zero := reflect.Zero(reflect.TypeOf(extra)).Interface()
|
||||
if reflect.DeepEqual(extra, zero) {
|
||||
continue
|
||||
}
|
||||
@ -226,8 +240,8 @@ func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error
|
||||
return func() (actual interface{}, err error, stopTrying StopTryingError) {
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
if reflect.TypeOf(e) == stopTryingErrorType {
|
||||
stopTrying = e.(StopTryingError)
|
||||
if stopTryingErr, ok := asStopTryingError(e); ok {
|
||||
stopTrying = stopTryingErr
|
||||
} else {
|
||||
panic(e)
|
||||
}
|
||||
@ -291,8 +305,8 @@ func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error
|
||||
}
|
||||
}
|
||||
if e := recover(); e != nil {
|
||||
if reflect.TypeOf(e) == stopTryingErrorType {
|
||||
stopTrying = e.(StopTryingError)
|
||||
if stopTryingErr, ok := asStopTryingError(e); ok {
|
||||
stopTrying = stopTryingErr
|
||||
} else if assertionFailure == nil {
|
||||
panic(e)
|
||||
}
|
||||
@ -310,13 +324,40 @@ func (assertion *AsyncAssertion) matcherSaysStopTrying(matcher types.GomegaMatch
|
||||
return StopTrying("No future change is possible. Bailing out early")
|
||||
}
|
||||
|
||||
func (assertion *AsyncAssertion) afterTimeout() <-chan time.Time {
|
||||
if assertion.timeoutInterval >= 0 {
|
||||
return time.After(assertion.timeoutInterval)
|
||||
}
|
||||
|
||||
if assertion.asyncType == AsyncAssertionTypeConsistently {
|
||||
return time.After(assertion.g.DurationBundle.ConsistentlyDuration)
|
||||
} else {
|
||||
if assertion.ctx == nil {
|
||||
return time.After(assertion.g.DurationBundle.EventuallyTimeout)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (assertion *AsyncAssertion) afterPolling() <-chan time.Time {
|
||||
if assertion.pollingInterval >= 0 {
|
||||
return time.After(assertion.pollingInterval)
|
||||
}
|
||||
if assertion.asyncType == AsyncAssertionTypeConsistently {
|
||||
return time.After(assertion.g.DurationBundle.ConsistentlyPollingInterval)
|
||||
} else {
|
||||
return time.After(assertion.g.DurationBundle.EventuallyPollingInterval)
|
||||
}
|
||||
}
|
||||
|
||||
type contextWithAttachProgressReporter interface {
|
||||
AttachProgressReporter(func() string) func()
|
||||
}
|
||||
|
||||
func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool {
|
||||
timer := time.Now()
|
||||
timeout := time.After(assertion.timeoutInterval)
|
||||
timeout := assertion.afterTimeout()
|
||||
lock := sync.Mutex{}
|
||||
|
||||
var matches bool
|
||||
@ -383,7 +424,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(assertion.pollingInterval):
|
||||
case <-assertion.afterPolling():
|
||||
v, e, st := pollActual()
|
||||
if st != nil && st.wasViaPanic() {
|
||||
// we were told to stop trying via panic - which means we dont' have reasonable new values
|
||||
@ -423,7 +464,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(assertion.pollingInterval):
|
||||
case <-assertion.afterPolling():
|
||||
v, e, st := pollActual()
|
||||
if st != nil && st.wasViaPanic() {
|
||||
// we were told to stop trying via panic - which means we made it this far and should return successfully
|
||||
|
8
vendor/github.com/onsi/gomega/internal/gomega.go
generated
vendored
8
vendor/github.com/onsi/gomega/internal/gomega.go
generated
vendored
@ -57,8 +57,8 @@ func (g *Gomega) Eventually(actual interface{}, intervals ...interface{}) types.
|
||||
}
|
||||
|
||||
func (g *Gomega) EventuallyWithOffset(offset int, actual interface{}, args ...interface{}) types.AsyncAssertion {
|
||||
timeoutInterval := g.DurationBundle.EventuallyTimeout
|
||||
pollingInterval := g.DurationBundle.EventuallyPollingInterval
|
||||
timeoutInterval := -time.Duration(1)
|
||||
pollingInterval := -time.Duration(1)
|
||||
intervals := []interface{}{}
|
||||
var ctx context.Context
|
||||
for _, arg := range args {
|
||||
@ -84,8 +84,8 @@ func (g *Gomega) Consistently(actual interface{}, intervals ...interface{}) type
|
||||
}
|
||||
|
||||
func (g *Gomega) ConsistentlyWithOffset(offset int, actual interface{}, args ...interface{}) types.AsyncAssertion {
|
||||
timeoutInterval := g.DurationBundle.ConsistentlyDuration
|
||||
pollingInterval := g.DurationBundle.ConsistentlyPollingInterval
|
||||
timeoutInterval := -time.Duration(1)
|
||||
pollingInterval := -time.Duration(1)
|
||||
intervals := []interface{}{}
|
||||
var ctx context.Context
|
||||
for _, arg := range args {
|
||||
|
Reference in New Issue
Block a user