mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
check selecthandler
This commit is contained in:
parent
e915d75df6
commit
7fa71d9548
1 changed files with 28 additions and 0 deletions
28
sql/handler_test.go
Normal file
28
sql/handler_test.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package sql_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/molecula/featurebase/v2/sql"
|
||||
"github.com/molecula/featurebase/v2/test"
|
||||
)
|
||||
|
||||
func TestHandler(t *testing.T) {
|
||||
cluster := test.MustRunCluster(t, 1)
|
||||
defer cluster.Close()
|
||||
api := cluster.GetNode(0).API
|
||||
queryStr := "select * from nowhere"
|
||||
mapper := sql.NewMapper()
|
||||
query, err := mapper.MapSQL(queryStr)
|
||||
if err != nil {
|
||||
t.Fatal("failed to map SQL")
|
||||
}
|
||||
handler := sql.NewSelectHandler(api)
|
||||
_, err = handler.Handle(context.Background(), query)
|
||||
if err.Error() != "mapping select: handling: nowhere: index not found" {
|
||||
//expecting it to fail with index not found
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue