Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion go/vt/vtgate/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,35 @@ func (sct *sandboxTopo) WatchSrvVSchema(ctx context.Context, cell string, callba
return
}

// Context may already be canceled during test cleanup - exit gracefully.
if ctx.Err() != nil {
return
}

// Update the backing topo server with the current sandbox vschemas.
for ks := range ksToSandbox {
ksvs := &topo.KeyspaceVSchemaInfo{
Name: ks,
Keyspace: srvVSchema.Keyspaces[ks],
}
if err := sct.topoServer.SaveVSchema(ctx, ksvs); err != nil {
if ctx.Err() != nil {
return
}
panic(fmt.Sprintf("sandboxTopo SaveVSchema returned an error: %v", err))
}
}
sct.topoServer.UpdateSrvVSchema(ctx, cell, srvVSchema)
if err := sct.topoServer.UpdateSrvVSchema(ctx, cell, srvVSchema); err != nil {
if ctx.Err() != nil {
return
}
panic(fmt.Sprintf("sandboxTopo UpdateSrvVSchema returned an error: %v", err))
}
current, updateChan, err := sct.topoServer.WatchSrvVSchema(ctx, cell)
if err != nil {
if ctx.Err() != nil {
return
}
panic(fmt.Sprintf("sandboxTopo WatchSrvVSchema returned an error: %v", err))
}
if !callback(current.Value, nil) {
Expand Down
Loading