From 0ba868dfd6c30d372ee7bc12772d02a2c74282d2 Mon Sep 17 00:00:00 2001 From: Justin Alvarez Date: Tue, 27 Feb 2024 17:39:14 -0500 Subject: [PATCH] fix: use new values of session Signed-off-by: Justin Alvarez --- tests/events.go | 6 +++++- tests/logs.go | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/events.go b/tests/events.go index 847a680..7cf494d 100644 --- a/tests/events.go +++ b/tests/events.go @@ -4,10 +4,12 @@ package tests import ( + "strings" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" "github.com/runfinch/common-tests/command" "github.com/runfinch/common-tests/option" @@ -29,7 +31,9 @@ func Events(o *option.Option) { gomega.Expect(session.Out.Contents()).Should(gomega.BeEmpty()) command.Run(o, "pull", defaultImage) // allow propagation time - gomega.Eventually(session.Out.Contents()). + gomega.Eventually(func(session *gexec.Session) string { + return strings.TrimSpace(string(session.Out.Contents())) + }).WithArguments(session). WithTimeout(15 * time.Second). WithPolling(1 * time.Second). Should(gomega.ContainSubstring(defaultImage)) diff --git a/tests/logs.go b/tests/logs.go index e874b3e..e1bb762 100644 --- a/tests/logs.go +++ b/tests/logs.go @@ -10,6 +10,7 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" "github.com/runfinch/common-tests/command" "github.com/runfinch/common-tests/option" @@ -100,7 +101,9 @@ func Logs(o *option.Option) { gomega.Expect(session.Out.Contents()).Should(gomega.BeEmpty()) command.Run(o, "exec", testContainerName, "sh", "-c", fmt.Sprintf("echo %s >> /proc/1/fd/1", newLog)) // allow propagation time - gomega.Eventually(strings.TrimSpace(string(session.Out.Contents()))). + gomega.Eventually(func(session *gexec.Session) string { + return strings.TrimSpace(string(session.Out.Contents())) + }).WithArguments(session). WithTimeout(30 * time.Second). WithPolling(1 * time.Second). Should(gomega.Equal(newLog))