diff --git a/go/vt/vtexplain/testdata/test-healthcheck-schema.sql b/go/vt/vtexplain/testdata/test-healthcheck-schema.sql new file mode 100644 index 00000000000..63546b89973 --- /dev/null +++ b/go/vt/vtexplain/testdata/test-healthcheck-schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE t1 ( + id int NOT NULL, + PRIMARY KEY (id) +); diff --git a/go/vt/vtexplain/testdata/test-healthcheck-vschema.json b/go/vt/vtexplain/testdata/test-healthcheck-vschema.json new file mode 100644 index 00000000000..467a1571d4e --- /dev/null +++ b/go/vt/vtexplain/testdata/test-healthcheck-vschema.json @@ -0,0 +1,20 @@ +{ + "ks1": { + "sharded": true, + "tables": { + "t1": { + "column_vindexes": [ + { + "column": "id", + "name": "hash" + } + ] + } + }, + "vindexes": { + "hash": { + "type": "hash" + } + } + } +} diff --git a/go/vt/vtexplain/vtexplain_flaky_test.go b/go/vt/vtexplain/vtexplain_flaky_test.go index 36b84ba9351..1e7fef0ef9f 100644 --- a/go/vt/vtexplain/vtexplain_flaky_test.go +++ b/go/vt/vtexplain/vtexplain_flaky_test.go @@ -51,6 +51,28 @@ func initTest(mode string, opts *Options, t *testing.T) { require.NoError(t, err, "vtexplain Init error\n%s", string(schema)) } +func TestVTExplainWithNewHealthCheck(t *testing.T) { + schema, err := ioutil.ReadFile("testdata/test-healthcheck-schema.sql") + require.NoError(t, err) + + vSchema, err := ioutil.ReadFile("testdata/test-healthcheck-vschema.json") + require.NoError(t, err) + + opts := &Options{ + ReplicationMode: "ROW", + NumShards: 2, + Normalize: true, + StrictDDL: true, + ExecutionMode: ModeMulti, + } + + err = Init(string(vSchema), string(schema), opts) + require.NoError(t, err, "vtexplain Init error\n%s", string(schema)) + + _, err = Run("SELECT * from t1") + require.NoError(t, err) +} + func testExplain(testcase string, opts *Options, t *testing.T) { modes := []string{ ModeMulti,