@@ -450,3 +450,36 @@ func TestCancelMigration_SHARDS(t *testing.T) {
450450 assert .Empty (t , env .tmc .vrQueries [100 ])
451451 assert .Empty (t , env .tmc .vrQueries [200 ])
452452}
453+
454+
455+ func TestDropTargetShards_NoOp (t * testing.T ) {
456+ ctx , cancel := context .WithTimeout (context .Background (), 60 * time .Second )
457+ defer cancel ()
458+
459+ workflowName := "wf1"
460+ tableName := "t1"
461+ sourceKeyspace := & testKeyspace {KeyspaceName : "sourceks" , ShardNames : []string {"0" }}
462+ targetKeyspace := & testKeyspace {KeyspaceName : "targetks" , ShardNames : []string {"0" }}
463+
464+ schema := map [string ]* tabletmanagerdatapb.SchemaDefinition {
465+ tableName : {
466+ TableDefinitions : []* tabletmanagerdatapb.TableDefinition {
467+ {
468+ Name : tableName ,
469+ Schema : fmt .Sprintf ("CREATE TABLE %s (id BIGINT, name VARCHAR(64), PRIMARY KEY (id))" , tableName ),
470+ },
471+ },
472+ },
473+ }
474+
475+ env := newTestEnv (t , ctx , defaultCellName , sourceKeyspace , targetKeyspace )
476+ defer env .close ()
477+ env .tmc .schema = schema
478+
479+ ts , _ , err := env .ws .getWorkflowState (ctx , targetKeyspace .KeyspaceName , workflowName )
480+ require .NoError (t , err )
481+
482+ // Verify dropTargetShards can be called safely
483+ err = ts .dropTargetShards (ctx )
484+ require .NoError (t , err )
485+ }
0 commit comments