Skip to content

Commit

Permalink
Fix vtgate tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Jan 13, 2025
1 parent cd455a0 commit 8d0d520
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion go/vt/vtgate/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ type sandboxTopo struct {
//
// when this version is used, WatchSrvVSchema can properly simulate watches
func newSandboxForCells(ctx context.Context, cells []string) *sandboxTopo {
ts := memorytopo.NewServer(ctx, cells...)
for ks := range ksToSandbox {
ts.EnsureVSchema(ctx, ks)
}
return &sandboxTopo{
topoServer: memorytopo.NewServer(ctx, cells...),
ts,
}
}

Expand Down Expand Up @@ -293,6 +297,16 @@ func (sct *sandboxTopo) WatchSrvVSchema(ctx context.Context, cell string, callba
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 {
panic(fmt.Sprintf("sandboxTopo SaveVSchema returned an error: %v", err))
}
}
sct.topoServer.UpdateSrvVSchema(ctx, cell, srvVSchema)
current, updateChan, err := sct.topoServer.WatchSrvVSchema(ctx, cell)
if err != nil {
Expand Down

0 comments on commit 8d0d520

Please sign in to comment.