graphvent/gql_test.go

35 lines
913 B
Go

2023-06-25 20:20:59 -06:00
package graphvent
import (
"testing"
2023-06-25 22:19:05 -06:00
"time"
2023-06-25 20:20:59 -06:00
)
func TestGQLThread(t * testing.T) {
ctx := testContext(t)
2023-06-25 20:20:59 -06:00
gql_thread, err := NewGQLThread(ctx, ":8080", []Lockable{}, ObjTypeMap{}, FieldMap{}, FieldMap{}, FieldMap{})
fatalErr(t, err)
test_thread_1, err := NewSimpleBaseThread(ctx, "Test thread 1", []Lockable{}, ThreadActions{}, ThreadHandlers{})
2023-06-25 20:20:59 -06:00
fatalErr(t, err)
test_thread_2, err := NewSimpleBaseThread(ctx, "Test thread 2", []Lockable{}, ThreadActions{}, ThreadHandlers{})
fatalErr(t, err)
i1 := NewGQLThreadInfo(true)
err = LinkThreads(ctx, gql_thread, test_thread_1, &i1)
fatalErr(t, err)
i2 := NewGQLThreadInfo(false)
err = LinkThreads(ctx, gql_thread, test_thread_2, &i2)
2023-06-25 20:20:59 -06:00
fatalErr(t, err)
2023-06-25 22:19:05 -06:00
go func(thread Thread){
time.Sleep(10*time.Millisecond)
SendUpdate(ctx, thread, CancelSignal(nil))
}(gql_thread)
2023-06-25 20:20:59 -06:00
err = RunThread(ctx, gql_thread)
fatalErr(t, err)
}