mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
30 lines
736 B
Go
30 lines
736 B
Go
// Copyright 2021 Molecula Corp. All rights reserved.
|
|
package sql_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/molecula/featurebase/v3/sql"
|
|
"github.com/molecula/featurebase/v3/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
|
|
//can be more elaborate later
|
|
t.Fatal(err)
|
|
}
|
|
|
|
}
|