From 68d28b946a0b363dbc03725584a5fad2f3fdc6ee Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Mon, 7 Oct 2024 17:32:40 -0400 Subject: [PATCH] Start working on tests Signed-off-by: Matt Lord --- .../vreplication/multi_tenant_test.go | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/go/test/endtoend/vreplication/multi_tenant_test.go b/go/test/endtoend/vreplication/multi_tenant_test.go index b10395b08c8..c82ee8a620f 100644 --- a/go/test/endtoend/vreplication/multi_tenant_test.go +++ b/go/test/endtoend/vreplication/multi_tenant_test.go @@ -196,12 +196,26 @@ func TestMultiTenantSimple(t *testing.T) { require.Zero(t, len(getKeyspaceRoutingRules(t, vc).Rules)) - mt.Create() - confirmKeyspacesRoutedTo(t, sourceKeyspace, "s1", "t1", nil) - validateKeyspaceRoutingRules(t, vc, initialRules) + createFunc := func() { + mt.Create() + confirmKeyspacesRoutedTo(t, sourceKeyspace, "s1", "t1", nil) + validateKeyspaceRoutingRules(t, vc, initialRules) - lastIndex = insertRows(lastIndex, sourceKeyspace) - waitForWorkflowState(t, vc, fmt.Sprintf("%s.%s", targetKeyspace, mt.workflowName), binlogdatapb.VReplicationWorkflowState_Running.String()) + lastIndex = insertRows(lastIndex, sourceKeyspace) + waitForWorkflowState(t, vc, fmt.Sprintf("%s.%s", targetKeyspace, mt.workflowName), binlogdatapb.VReplicationWorkflowState_Running.String()) + } + + t.Run("cancel", func(t *testing.T) { + // First let's test canceling the workflow to ensure that it properly + // cleans up all of the data. + createFunc() + mt.Cancel() + rowCount := getRowCount(t, vtgateConn, fmt.Sprintf("%s.%s", targetKeyspace, "t1")) + require.Zero(t, rowCount) + }) + + // Create again and run it to completion. + createFunc() vdiff(t, targetKeyspace, workflowName, defaultCellName, false, true, nil) mt.SwitchReads()