From 8f41bcf43ef5823b3f81a66ba2b752ad87ab975a Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Sun, 5 Jun 2022 13:34:15 -0400 Subject: [PATCH] Update SwitchTraffic [all|default] tests for user facing client behavior Meaning that we don't explicitly specify a tablet_types value and leverage the command default which should be: in_order:RDONLY,REPLICA,PRIMARY This also requires that the tests actually create RDONLY tablets, so do that for the basic v2 workflow tests. Signed-off-by: Matt Lord --- .../vreplication/resharding_workflows_v2_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/go/test/endtoend/vreplication/resharding_workflows_v2_test.go b/go/test/endtoend/vreplication/resharding_workflows_v2_test.go index 2c90185ceae..b9d81a0cf51 100644 --- a/go/test/endtoend/vreplication/resharding_workflows_v2_test.go +++ b/go/test/endtoend/vreplication/resharding_workflows_v2_test.go @@ -148,12 +148,16 @@ func tstWorkflowReverseWrites(t *testing.T) { require.NoError(t, tstWorkflowAction(t, workflowActionReverseTraffic, "primary", "")) } +// tstWorkflowSwitchReadsAndWrites tests that SwitchWrites w/o any user provided --tablet_types +// value switches all traffic func tstWorkflowSwitchReadsAndWrites(t *testing.T) { - require.NoError(t, tstWorkflowAction(t, workflowActionSwitchTraffic, "replica,rdonly,primary", "")) + require.NoError(t, tstWorkflowAction(t, workflowActionSwitchTraffic, "", "")) } +// tstWorkflowReversesReadsAndWrites tests that SwitchWrites w/o any user provided --tablet_types +// value switches all traffic in reverse func tstWorkflowReverseReadsAndWrites(t *testing.T) { - require.NoError(t, tstWorkflowAction(t, workflowActionReverseTraffic, "replica,rdonly,primary", "")) + require.NoError(t, tstWorkflowAction(t, workflowActionReverseTraffic, "", "")) } func tstWorkflowComplete(t *testing.T) error { @@ -237,6 +241,11 @@ func getCurrentState(t *testing.T) string { // but CI currently fails on creating multiple clusters even after the previous ones are torn down func TestBasicV2Workflows(t *testing.T) { + ogv := defaultRdonly + defaultRdonly = 1 + defer func() { + defaultRdonly = ogv + }() vc = setupCluster(t) defer vtgateConn.Close() defer vc.TearDown(t) @@ -548,6 +557,7 @@ func testRestOfWorkflow(t *testing.T) { validateWritesRouteToSource(t) tstWorkflowSwitchReadsAndWrites(t) + validateReadsRouteToTarget(t, "rdonly") validateReadsRouteToTarget(t, "replica") validateWritesRouteToTarget(t) waitForLowLag(t, keyspace, "wf1_reverse") @@ -563,6 +573,7 @@ func testRestOfWorkflow(t *testing.T) { // fully switch and complete waitForLowLag(t, "customer", "wf1") tstWorkflowSwitchReadsAndWrites(t) + validateReadsRouteToTarget(t, "rdonly") validateReadsRouteToTarget(t, "replica") validateWritesRouteToTarget(t)