Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that vtexplain works with healthcheck #6252

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go/vt/vtexplain/testdata/test-healthcheck-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TABLE t1 (
id int NOT NULL,
PRIMARY KEY (id)
);
20 changes: 20 additions & 0 deletions go/vt/vtexplain/testdata/test-healthcheck-vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"ks1": {
"sharded": true,
"tables": {
"t1": {
"column_vindexes": [
{
"column": "id",
"name": "hash"
}
]
}
},
"vindexes": {
"hash": {
"type": "hash"
}
}
}
}
22 changes: 22 additions & 0 deletions go/vt/vtexplain/vtexplain_flaky_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down