MCPcopy
hub / github.com/dosco/graphjin / newTestEngineWithTables

Function newTestEngineWithTables

core/openapi_bridge_test.go:144–160  ·  view source on GitHub ↗
(t *testing.T, conf *Config, primarySchema string, names ...string)

Source from the content-addressed store, hash-verified

142}
143
144func newTestEngineWithTables(t *testing.T, conf *Config, primarySchema string, names ...string) (*graphjinEngine, *bytes.Buffer) {
145 t.Helper()
146 tables := make([]sdata.DBTable, 0, len(names))
147 for _, n := range names {
148 tables = append(tables, sdata.DBTable{Schema: primarySchema, Name: n, Type: "table"})
149 }
150 var logBuf bytes.Buffer
151 gj := &graphjinEngine{
152 conf: conf,
153 log: _log.New(&logBuf, "", 0),
154 defaultDB: "primary",
155 databases: map[string]*dbContext{
156 "primary": {name: "primary", dbinfo: &sdata.DBInfo{Schema: primarySchema, Tables: tables}},
157 },
158 }
159 return gj, &logBuf
160}
161
162func TestCollisionWithRealTableErrors(t *testing.T) {
163 gj, _ := newTestEngineWithTables(t, &Config{}, "public", "users", "orders")

Calls

no outgoing calls

Tested by

no test coverage detected