kmtest
kmtest copied to clipboard
Think about asynchronous/multithreading support
@SergiusTheBest What do you think about new kmtest feature "REQUIRE_EVENTUALLY" for testing of multithreading code? There is an example of work with Eventually in gomega:
import (
. "github.com/onsi/gomega"
"time"
)
func TestAsyncOperation(t *testing.T) {
// Simulate an asynchronous operation that sets a flag after a delay
var done bool
go func() {
time.Sleep(100 * time.Millisecond)
done = true
}()
// Use Eventually to wait for the 'done' flag to become true
Eventually(func() bool {
return done
}).Should(BeTrue())
}
Originally posted by @belyshevdenis in https://github.com/apriorit/kf/pull/67#discussion_r2279496993