diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-11 21:22:43 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-11 21:22:43 -0600 |
| commit | 05fae21a33b74e7768a94eb84294f6198c3cec56 (patch) | |
| tree | fce6d4813f10704d3d17ba69e235e097da1f0574 /vendor/github.com/testcontainers/testcontainers-go/wait | |
| parent | b1b29603622451f677f61be9300987ee3e79a2ff (diff) | |
chore: update go modules
Diffstat (limited to 'vendor/github.com/testcontainers/testcontainers-go/wait')
3 files changed, 25 insertions, 11 deletions
diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/all.go b/vendor/github.com/testcontainers/testcontainers-go/wait/all.go index fb7eb4e..9bf4cbe 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/all.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/all.go @@ -3,6 +3,7 @@ package wait import ( "context" "errors" + "reflect" "time" ) @@ -62,6 +63,13 @@ func (ms *MultiStrategy) WaitUntilReady(ctx context.Context, target StrategyTarg } for _, strategy := range ms.Strategies { + if strategy == nil || reflect.ValueOf(strategy).IsNil() { + // A module could be appending strategies after part of the container initialization, + // and use wait.ForAll on a not initialized strategy. + // In this case, we just skip the nil strategy. + continue + } + strategyCtx := ctx // Set default Timeout when strategy implements StrategyTimeout diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/http.go b/vendor/github.com/testcontainers/testcontainers-go/wait/http.go index 2c7c655..32dc877 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/http.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/http.go @@ -208,7 +208,7 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge } if lowestPort == "" { - return errors.New("No exposed tcp ports or mapped ports - cannot wait for status") + return errors.New("no exposed tcp ports or mapped ports - cannot wait for status") } mappedPort, _ = nat.NewPort(lowestPort.Proto(), hostPort) @@ -229,7 +229,7 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge } if mappedPort.Proto() != "tcp" { - return errors.New("Cannot use HTTP client on non-TCP ports") + return errors.New("cannot use HTTP client on non-TCP ports") } } diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/walk.go b/vendor/github.com/testcontainers/testcontainers-go/wait/walk.go index 4685e50..009e563 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/walk.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/walk.go @@ -5,18 +5,24 @@ import ( ) var ( - // VisitStop is used as a return value from [VisitFunc] to stop the walk. + // ErrVisitStop is used as a return value from [VisitFunc] to stop the walk. // It is not returned as an error by any function. - VisitStop = errors.New("stop the walk") + ErrVisitStop = errors.New("stop the walk") - // VisitRemove is used as a return value from [VisitFunc] to have the current node removed. + // Deprecated: use [ErrVisitStop] instead. + VisitStop = ErrVisitStop + + // ErrVisitRemove is used as a return value from [VisitFunc] to have the current node removed. // It is not returned as an error by any function. - VisitRemove = errors.New("remove this strategy") + ErrVisitRemove = errors.New("remove this strategy") + + // Deprecated: use [ErrVisitRemove] instead. + VisitRemove = ErrVisitRemove ) // VisitFunc is a function that visits a strategy node. -// If it returns [VisitStop], the walk stops. -// If it returns [VisitRemove], the current node is removed. +// If it returns [ErrVisitStop], the walk stops. +// If it returns [ErrVisitRemove], the current node is removed. type VisitFunc func(root Strategy) error // Walk walks the strategies tree and calls the visit function for each node. @@ -26,7 +32,7 @@ func Walk(root *Strategy, visit VisitFunc) error { } if err := walk(root, visit); err != nil { - if errors.Is(err, VisitRemove) || errors.Is(err, VisitStop) { + if errors.Is(err, ErrVisitRemove) || errors.Is(err, ErrVisitStop) { return nil } return err @@ -45,7 +51,7 @@ func walk(root *Strategy, visit VisitFunc) error { // Allow the visit function to customize the behaviour of the walk before visiting the children. if err := visit(*root); err != nil { - if errors.Is(err, VisitRemove) { + if errors.Is(err, ErrVisitRemove) { *root = nil } @@ -56,7 +62,7 @@ func walk(root *Strategy, visit VisitFunc) error { var i int for range s.Strategies { if err := walk(&s.Strategies[i], visit); err != nil { - if errors.Is(err, VisitRemove) { + if errors.Is(err, ErrVisitRemove) { s.Strategies = append(s.Strategies[:i], s.Strategies[i+1:]...) if errors.Is(err, VisitStop) { return VisitStop |
