From 0b1421b8ad89284e00274e434394c3edf6581bf7 Mon Sep 17 00:00:00 2001 From: Milos Tomic <59831542+tmilos77@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:38:39 +0200 Subject: [PATCH] chore: increase GcpNfsVolume ready timeout . (#23) --- internal/valueAssert.go | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/internal/valueAssert.go b/internal/valueAssert.go index 7c1ac1e..c0d14cb 100644 --- a/internal/valueAssert.go +++ b/internal/valueAssert.go @@ -14,23 +14,31 @@ func eventuallyValueAssertEqualsNoOptions(ctx context.Context, a string, b strin func eventuallyValueAssertEqualsWithOptions(ctx context.Context, a string, b string, withOpts string) error { timeout := DefaultEventuallyTimeout - opts := strings.Split(withOpts, ",") - for _, opt := range opts { - opt = strings.TrimSpace(opt) - // ugly, but for now with just few timeout1-5X works, if you add more, try to find a better implementation - switch opt { - case "timeout2X": - timeout = 2 * timeout - case "timeout3X": - timeout = 3 * timeout - case "timeout4X": - timeout = 4 * timeout - case "timeout5X": - timeout = 5 * timeout - default: - return fmt.Errorf("unknown option: %s", opt) + + withOpts = strings.TrimSpace(withOpts) + if len(withOpts) > 0 { + opts := strings.Split(withOpts, ",") + for _, opt := range opts { + opt = strings.TrimSpace(opt) + if opt == "" { + continue + } + // ugly, but for now with just few timeout1-5X works, if you add more, try to find a better implementation. + switch opt { + case "timeout2X": + timeout = 2 * timeout + case "timeout3X": + timeout = 3 * timeout + case "timeout4X": + timeout = 4 * timeout + case "timeout5X": + timeout = 5 * timeout + default: + return fmt.Errorf("unknown option: %s", opt) + } } } + var errMsg string gm := gomega.NewGomega(func(message string, callerSkip ...int) { errMsg = message