package discovery import ( "context" "os" "os/signal" "sync" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) func TestIface(t *testing.T) { ctx, cancel := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt) t.Cleanup(cancel) ctx, cancel = context.WithTimeout(ctx, time.Second*5) t.Cleanup(cancel) set, err := NewDiscoverySet(zaptest.NewLogger(t).Named("discovery"), 1234, WithDebug()) require.NoError(t, err) wg := sync.WaitGroup{} wg.Add(1) go set[0].Start(ctx, &wg) go func() { for { time.Sleep(time.Second) } }() wg.Wait() assert.Len(t, set[0].NewNodes(), 1) }