Skip to content

Commit

Permalink
added global test
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Dec 2, 2024
1 parent 7864e3a commit a518157
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Empty file.
15 changes: 15 additions & 0 deletions go/vt/vtgate/vindexes/vschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"reflect"
"strings"
"testing"
Expand Down Expand Up @@ -3551,6 +3552,20 @@ func TestFindTableWithSequences(t *testing.T) {
}
}

func TestGlobalTables(t *testing.T) {
input, err := os.ReadFile("../planbuilder/testdata/vschemas/schema.json")
require.NoError(t, err)

var vs vschemapb.SrvVSchema
err = json2.UnmarshalPB(input, &vs)
require.NoError(t, err)

got := BuildVSchema(&vs, sqlparser.NewTestParser())
tbl, err := got.findGlobalTable("user", false)
require.NoError(t, err)
assert.NotNil(t, tbl)
}

func vindexNames(vindexes []*ColumnVindex) (result []string) {
for _, vindex := range vindexes {
result = append(result, vindex.Name)
Expand Down

0 comments on commit a518157

Please sign in to comment.