From 5d8fa9a38c9a15f5f488daf397db9e128492bc7e Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Wed, 23 Feb 2022 20:51:16 -0500 Subject: [PATCH] Update tests now that we check BinlogSource when externalizing lookup vindexes Signed-off-by: Matt Lord --- go/vt/wrangler/materializer_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/go/vt/wrangler/materializer_test.go b/go/vt/wrangler/materializer_test.go index 720858c9348..dabcb8ce4ca 100644 --- a/go/vt/wrangler/materializer_test.go +++ b/go/vt/wrangler/materializer_test.go @@ -1560,11 +1560,13 @@ func TestExternalizeVindex(t *testing.T) { }, } fields := sqltypes.MakeTestFields( - "id|state|message", - "int64|varbinary|varbinary", + "id|state|message|source", + "int64|varbinary|varbinary|blob", ) - running := sqltypes.MakeTestResult(fields, "1|Running|msg") - stopped := sqltypes.MakeTestResult(fields, "1|Stopped|Stopped after copy") + sourceStopAfterCopy := `keyspace:"sourceKs",shard:"0",filter:{rules:{match:"owned" filter:"select * from t1 where in_keyrange(col1, 'sourceKs.hash', '-80')"}} stop_after_copy:true` + sourceKeepRunningAfterCopy := `keyspace:"sourceKs",shard:"0",filter:{rules:{match:"owned" filter:"select * from t1 where in_keyrange(col1, 'sourceKs.hash', '-80')"}}` + running := sqltypes.MakeTestResult(fields, "1|Running|msg|"+sourceKeepRunningAfterCopy) + stopped := sqltypes.MakeTestResult(fields, "1|Stopped|Stopped after copy|"+sourceStopAfterCopy) testcases := []struct { input string vrResponse *sqltypes.Result @@ -1587,9 +1589,9 @@ func TestExternalizeVindex(t *testing.T) { input: "sourceks.bad", err: "table name in vindex should be of the form keyspace.table: unqualified", }, { - input: "sourceks.owned", - vrResponse: running, - err: "is not in Stopped after copy state", + input: "sourceks.owned", + vrResponse: running, + expectDelete: true, }, { input: "sourceks.unowned", vrResponse: stopped, @@ -1601,7 +1603,7 @@ func TestExternalizeVindex(t *testing.T) { t.Fatal(err) } if tcase.vrResponse != nil { - validationQuery := "select id, state, message from _vt.vreplication where workflow='lkp_vdx' and db_name='vt_targetks'" + validationQuery := "select id, state, message, source from _vt.vreplication where workflow='lkp_vdx' and db_name='vt_targetks'" env.tmc.expectVRQuery(200, validationQuery, tcase.vrResponse) env.tmc.expectVRQuery(210, validationQuery, tcase.vrResponse) }