kmtest icon indicating copy to clipboard operation
kmtest copied to clipboard

Think about asynchronous/multithreading support

Open SergiusTheBest opened this issue 3 months ago • 0 comments

@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

SergiusTheBest avatar Sep 17 '25 15:09 SergiusTheBest