Skip to content

Commit

Permalink
Update SwitchTraffic [all|default] tests for user facing client behavior
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mattlord committed Jun 6, 2022
1 parent 2e15443 commit 8f41bcf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions go/test/endtoend/vreplication/resharding_workflows_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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)

Expand Down

0 comments on commit 8f41bcf

Please sign in to comment.