From 6292d95c6ebf682a046083aa99870761e1559bfa Mon Sep 17 00:00:00 2001 From: "vitess-bot[bot]" <108069721+vitess-bot[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:43:48 +0200 Subject: [PATCH 1/2] Cherry-pick bf2a56ab9e40724eae9f239965b6a0357d3c854b with conflicts --- go/cmd/vttestserver/cli/main_test.go | 31 ++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/go/cmd/vttestserver/cli/main_test.go b/go/cmd/vttestserver/cli/main_test.go index c7fba2dc2a5..6248c49afdc 100644 --- a/go/cmd/vttestserver/cli/main_test.go +++ b/go/cmd/vttestserver/cli/main_test.go @@ -20,9 +20,17 @@ import ( "context" "fmt" "io" + "maps" "math/rand/v2" "os/exec" "path" +<<<<<<< HEAD +||||||| parent of bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) + "strconv" +======= + "slices" + "strconv" +>>>>>>> bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) "strings" "testing" "time" @@ -421,12 +429,31 @@ func assertColumnVindex(t *testing.T, cluster vttest.LocalCluster, expected colu err := vtctlclient.RunCommandAndWait(ctx, server, args, func(e *logutilpb.Event) { var keyspace vschemapb.Keyspace +<<<<<<< HEAD if err := protojson.Unmarshal([]byte(e.Value), &keyspace); err != nil { t.Error(err) } +||||||| parent of bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) + if err := protojson.Unmarshal([]byte(e.Value), &keyspace); err != nil { + assert.NoError(t, err) + } +======= + require.NoError(t, protojson.Unmarshal([]byte(e.Value), &keyspace)) + + // Look the table and vindex up before dereferencing them, so that a + // vschema missing either fails with a message naming what was missing + // instead of panicking on a nil map entry and taking down the whole + // test binary. + table, ok := keyspace.Tables[expected.table] + require.Truef(t, ok, "keyspace %s has no table %s in its vschema, found tables %v", expected.keyspace, expected.table, slices.Sorted(maps.Keys(keyspace.Tables))) + require.NotEmptyf(t, table.ColumnVindexes, "table %s.%s has no column vindexes", expected.keyspace, expected.table) + columnVindex := table.ColumnVindexes[0] + require.NotEmptyf(t, columnVindex.Columns, "column vindex %s on %s.%s has no columns", columnVindex.Name, expected.keyspace, expected.table) + + actualVindex, ok := keyspace.Vindexes[expected.vindex] + require.Truef(t, ok, "keyspace %s has no vindex %s in its vschema, found vindexes %v", expected.keyspace, expected.vindex, slices.Sorted(maps.Keys(keyspace.Vindexes))) +>>>>>>> bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) - columnVindex := keyspace.Tables[expected.table].ColumnVindexes[0] - actualVindex := keyspace.Vindexes[expected.vindex] assertEqual(t, actualVindex.Type, expected.vindexType, "Actual vindex type different from expected") assertEqual(t, columnVindex.Name, expected.vindex, "Actual vindex name different from expected") assertEqual(t, columnVindex.Columns[0], expected.column, "Actual vindex column different from expected") From 4800f9d376405c8c84744b297911cf0bbfb66cea Mon Sep 17 00:00:00 2001 From: Arthur Schreiber Date: Wed, 29 Jul 2026 14:49:07 +0000 Subject: [PATCH 2/2] resolve conflicts for backport of #20740 Signed-off-by: Arthur Schreiber --- go/cmd/vttestserver/cli/main_test.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/go/cmd/vttestserver/cli/main_test.go b/go/cmd/vttestserver/cli/main_test.go index 6248c49afdc..1b0e68462cb 100644 --- a/go/cmd/vttestserver/cli/main_test.go +++ b/go/cmd/vttestserver/cli/main_test.go @@ -24,13 +24,7 @@ import ( "math/rand/v2" "os/exec" "path" -<<<<<<< HEAD -||||||| parent of bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) - "strconv" -======= "slices" - "strconv" ->>>>>>> bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) "strings" "testing" "time" @@ -429,15 +423,6 @@ func assertColumnVindex(t *testing.T, cluster vttest.LocalCluster, expected colu err := vtctlclient.RunCommandAndWait(ctx, server, args, func(e *logutilpb.Event) { var keyspace vschemapb.Keyspace -<<<<<<< HEAD - if err := protojson.Unmarshal([]byte(e.Value), &keyspace); err != nil { - t.Error(err) - } -||||||| parent of bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) - if err := protojson.Unmarshal([]byte(e.Value), &keyspace); err != nil { - assert.NoError(t, err) - } -======= require.NoError(t, protojson.Unmarshal([]byte(e.Value), &keyspace)) // Look the table and vindex up before dereferencing them, so that a @@ -452,7 +437,6 @@ func assertColumnVindex(t *testing.T, cluster vttest.LocalCluster, expected colu actualVindex, ok := keyspace.Vindexes[expected.vindex] require.Truef(t, ok, "keyspace %s has no vindex %s in its vschema, found vindexes %v", expected.keyspace, expected.vindex, slices.Sorted(maps.Keys(keyspace.Vindexes))) ->>>>>>> bf2a56ab9e (vttestserver: fail, don't panic, on a vschema missing a table or vindex (#20740)) assertEqual(t, actualVindex.Type, expected.vindexType, "Actual vindex type different from expected") assertEqual(t, columnVindex.Name, expected.vindex, "Actual vindex name different from expected")