mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 01:35:24 -04:00
36 lines
544 B
Go
36 lines
544 B
Go
package debugging
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestPossibleBlocking(t *testing.T) {
|
|
triggered := false
|
|
|
|
PossibleBlocking(func() any {
|
|
time.Sleep(time.Second * 1)
|
|
return nil
|
|
}, time.Millisecond*500, func() {
|
|
triggered = true
|
|
})
|
|
|
|
if !triggered {
|
|
t.Fatal("possible blocking not triggered")
|
|
}
|
|
}
|
|
|
|
func TestPossibleBlocking_Blocking(t *testing.T) {
|
|
triggered := false
|
|
|
|
PossibleBlocking(func() any {
|
|
return nil
|
|
}, time.Second*1, func() {
|
|
triggered = true
|
|
})
|
|
|
|
if triggered {
|
|
t.Fatal("possible blocking triggered")
|
|
}
|
|
}
|