-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathengine_test.go
More file actions
69 lines (60 loc) · 1.33 KB
/
engine_test.go
File metadata and controls
69 lines (60 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package hugr
import (
"context"
"testing"
_ "embed"
"github.com/hugr-lab/query-engine/pkg/catalog"
"github.com/hugr-lab/query-engine/pkg/catalog/compiler"
"github.com/hugr-lab/query-engine/pkg/catalog/sdl"
"github.com/hugr-lab/query-engine/pkg/catalog/sources"
"github.com/hugr-lab/query-engine/pkg/catalog/static"
"github.com/hugr-lab/query-engine/pkg/engines"
)
//go:embed pkg/data-sources/sources/runtime/core-db/schema.graphql
var testSchemaData string
func Test_processQuery(t *testing.T) {
provider, err := static.New()
if err != nil {
t.Fatal(err)
}
ss := catalog.NewService(provider)
e := engines.NewDuckDB()
cat, err := sources.NewStringSource("test", e, compiler.Options{
Name: "core",
EngineType: string(e.Type()),
AsModule: true,
Capabilities: e.Capabilities(),
}, testSchemaData)
if err != nil {
t.Fatal(err)
}
err = ss.AddCatalog(context.Background(), "test", cat)
if err != nil {
t.Fatal(err)
}
query := `
query test {
__schema {
queryType {
name
}
}
core {
__typename
data_sources {
name
type
prefix
description
path
}
}
}
`
op, err := ss.ParseQuery(context.Background(), query, nil, "test")
if err != nil {
t.Fatal(err)
}
resolvers, _ := sdl.QueryRequestInfo(op.Definition.SelectionSet)
t.Logf("%+v", resolvers)
}