Skip to content

Commit

Permalink
[release-19.0] Remove broken panic handler (#17354) (#17358)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Co-authored-by: Dirkjan Bussink <[email protected]>
Co-authored-by: Shlomi Noach <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent f0d9386 commit d320f54
Show file tree
Hide file tree
Showing 151 changed files with 4 additions and 409 deletions.
2 changes: 0 additions & 2 deletions go/test/endtoend/backup/vtbackup/backup_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func TestTabletInitialBackup(t *testing.T) {
// - Take a Second Backup
// - Bring up a second replica, and restore from the second backup
// - list the backups, remove them
defer cluster.PanicHandler(t)

waitForReplicationToCatchup([]cluster.Vttablet{*replica1, *replica2})

Expand Down Expand Up @@ -102,7 +101,6 @@ func TestTabletBackupOnly(t *testing.T) {
// - Take a Second Backup
// - Bring up a second replica, and restore from the second backup
// - list the backups, remove them
defer cluster.PanicHandler(t)

// Reset the tablet object values in order on init tablet in the next step.
primary.VttabletProcess.ServingStatus = "NOT_SERVING"
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/backup/vtbackup/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitCode, err := func() (int, error) {
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/backup/vtctlbackup/backup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ func TestBackup(t *testing.T, setupType int, streamMode string, stripes int, cDe
}, //
}

defer cluster.PanicHandler(t)
// setup cluster for the testing
code, err := LaunchCluster(setupType, streamMode, stripes, cDetails)
require.Nilf(t, err, "setup failed with status code %d", code)
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/backup/vtctlbackup/pitr_test_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func waitForReplica(t *testing.T, replicaIndex int) {
// in between, it makes writes to the database, and takes notes: what data was available in what backup.
// It then restores each and every one of those backups, in random order, and expects to find the specific data associated with the backup.
func ExecTestIncrementalBackupAndRestoreToPos(t *testing.T, tcase *PITRTestCase) {
defer cluster.PanicHandler(t)

t.Run(tcase.Name, func(t *testing.T) {
// setup cluster for the testing
Expand Down Expand Up @@ -320,7 +319,6 @@ func ExecTestIncrementalBackupAndRestoreToPos(t *testing.T, tcase *PITRTestCase)

// ExecTestIncrementalBackupAndRestoreToPos
func ExecTestIncrementalBackupAndRestoreToTimestamp(t *testing.T, tcase *PITRTestCase) {
defer cluster.PanicHandler(t)

var lastInsertedRowTimestamp time.Time
insertRowOnPrimary := func(t *testing.T, hint string) {
Expand Down Expand Up @@ -580,7 +578,6 @@ func ExecTestIncrementalBackupAndRestoreToTimestamp(t *testing.T, tcase *PITRTes
// Specifically, it's designed to test how incremental backups are taken by interleaved replicas, so that they successfully build on
// one another.
func ExecTestIncrementalBackupOnTwoTablets(t *testing.T, tcase *PITRTestCase) {
defer cluster.PanicHandler(t)

t.Run(tcase.Name, func(t *testing.T) {
// setup cluster for the testing
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/cellalias/cell_alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitcode, err := func() (int, error) {
Expand Down Expand Up @@ -232,7 +231,6 @@ func TestMain(m *testing.M) {
}

func TestAlias(t *testing.T) {
defer cluster.PanicHandler(t)

insertInitialValues(t)
defer deleteInitialValues(t)
Expand Down Expand Up @@ -296,7 +294,6 @@ func TestAlias(t *testing.T) {
}

func TestAddAliasWhileVtgateUp(t *testing.T) {
defer cluster.PanicHandler(t)

insertInitialValues(t)
defer deleteInitialValues(t)
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/cluster/cluster_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ func (cluster *LocalProcessCluster) VtctlclientChangeTabletType(tablet *Vttablet

// Teardown brings down the cluster by invoking teardown for individual processes
func (cluster *LocalProcessCluster) Teardown() {
PanicHandler(nil)
cluster.mx.Lock()
defer cluster.mx.Unlock()
if cluster.teardownCompleted {
Expand Down
9 changes: 0 additions & 9 deletions go/test/endtoend/cluster/cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,6 @@ func VerifyRowsInTablet(t *testing.T, vttablet *Vttablet, ksName string, expecte
VerifyRowsInTabletForTable(t, vttablet, ksName, expectedRows, "vt_insert_test")
}

// PanicHandler handles the panic in the testcase.
func PanicHandler(t testing.TB) {
err := recover()
if t == nil {
return
}
require.Nilf(t, err, "panic occured in testcase %v", t.Name())
}

// ListBackups Lists back preset in shard
func (cluster LocalProcessCluster) ListBackups(shardKsName string) ([]string, error) {
output, err := cluster.VtctlclientProcess.ExecuteCommandWithOutput("ListBackups", shardKsName)
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/clustertest/add_keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ primary key (id)
)

func TestAddKeyspace(t *testing.T) {
defer cluster.PanicHandler(t)
if err := clusterInstance.StartKeyspace(*testKeyspace, []string{"-80", "80-"}, 0, false); err != nil {
log.Errorf("failed to AddKeyspace %v: %v", *testKeyspace, err)
t.Fatal(err)
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/clustertest/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ import (

"github.com/stretchr/testify/require"
clientv3 "go.etcd.io/etcd/client/v3"

"vitess.io/vitess/go/test/endtoend/cluster"
)

func TestEtcdServer(t *testing.T) {
defer cluster.PanicHandler(t)

// Confirm the basic etcd cluster health.
etcdHealthURL := fmt.Sprintf("http://%s:%d/health", clusterInstance.Hostname, clusterInstance.TopoPort)
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/clustertest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitCode := func() int {
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/clustertest/vtctld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/test/endtoend/cluster"
)

var (
Expand All @@ -44,7 +42,6 @@ var (
)

func TestVtctldProcess(t *testing.T) {
defer cluster.PanicHandler(t)
url := fmt.Sprintf("http://%s:%d/api/keyspaces/", clusterInstance.Hostname, clusterInstance.VtctldHTTPPort)
testURL(t, url, "keyspace url")

Expand Down
2 changes: 0 additions & 2 deletions go/test/endtoend/clustertest/vtgate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ import (
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
)

func TestVtgateProcess(t *testing.T) {
defer cluster.PanicHandler(t)
verifyVtgateVariables(t, clusterInstance.VtgateProcess.VerifyURL)
ctx := context.Background()
conn, err := mysql.Connect(ctx, &vtParams)
Expand Down
4 changes: 0 additions & 4 deletions go/test/endtoend/clustertest/vttablet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ import (
"testing"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/test/endtoend/cluster"
)

func TestVttabletProcess(t *testing.T) {
defer cluster.PanicHandler(t)
firstTabletPort := clusterInstance.Keyspaces[0].Shards[0].Vttablets[0].HTTPPort
testURL(t, fmt.Sprintf("http://localhost:%d/debug/vars/", firstTabletPort), "tablet debug var url")
resp, err := http.Get(fmt.Sprintf("http://localhost:%d/debug/vars", firstTabletPort))
Expand All @@ -48,7 +45,6 @@ func TestVttabletProcess(t *testing.T) {
}

func TestDeleteTablet(t *testing.T) {
defer cluster.PanicHandler(t)
primary := clusterInstance.Keyspaces[0].Shards[0].PrimaryTablet()
require.NotNil(t, primary)
_, err := clusterInstance.VtctlclientProcess.ExecuteCommandWithOutput("DeleteTablet", "--", "--allow_primary", primary.Alias)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var (

// This test makes sure that we can use SSL replication with Vitess
func TestSecure(t *testing.T) {
defer cluster.PanicHandler(t)
testReplicationBase(t, true)
testReplicationBase(t, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ var (
)

func TestSecureTransport(t *testing.T) {
defer cluster.PanicHandler(t)
flag.Parse()

// initialize cluster
Expand Down
9 changes: 0 additions & 9 deletions go/test/endtoend/keyspace/keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitCode := func() int {
Expand Down Expand Up @@ -169,15 +168,13 @@ func checkDurabilityPolicy(t *testing.T, durabilityPolicy string) {
}

func TestGetSrvKeyspaceNames(t *testing.T) {
defer cluster.PanicHandler(t)
output, err := clusterForKSTest.VtctlclientProcess.ExecuteCommandWithOutput("GetSrvKeyspaceNames", cell)
require.Nil(t, err)
assert.Contains(t, strings.Split(output, "\n"), keyspaceUnshardedName)
assert.Contains(t, strings.Split(output, "\n"), keyspaceShardedName)
}

func TestGetSrvKeyspacePartitions(t *testing.T) {
defer cluster.PanicHandler(t)
shardedSrvKeyspace := getSrvKeyspace(t, cell, keyspaceShardedName)
otherShardRefFound := false
for _, partition := range shardedSrvKeyspace.Partitions {
Expand Down Expand Up @@ -206,7 +203,6 @@ func TestGetSrvKeyspacePartitions(t *testing.T) {
}

func TestShardNames(t *testing.T) {
defer cluster.PanicHandler(t)
output, err := clusterForKSTest.VtctlclientProcess.ExecuteCommandWithOutput("GetSrvKeyspace", cell, keyspaceShardedName)
require.Nil(t, err)
var srvKeyspace topodata.SrvKeyspace
Expand All @@ -216,7 +212,6 @@ func TestShardNames(t *testing.T) {
}

func TestGetKeyspace(t *testing.T) {
defer cluster.PanicHandler(t)
output, err := clusterForKSTest.VtctlclientProcess.ExecuteCommandWithOutput("GetKeyspace", keyspaceUnshardedName)
require.Nil(t, err)

Expand All @@ -227,7 +222,6 @@ func TestGetKeyspace(t *testing.T) {
}

func TestDeleteKeyspace(t *testing.T) {
defer cluster.PanicHandler(t)
_ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateKeyspace", "test_delete_keyspace")
_ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace/0")
_ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--", "--keyspace=test_delete_keyspace", "--shard=0", "zone1-0000000100", "primary")
Expand Down Expand Up @@ -346,7 +340,6 @@ func TestDeleteKeyspace(t *testing.T) {
} */

func TestShardCountForAllKeyspaces(t *testing.T) {
defer cluster.PanicHandler(t)
testShardCountForKeyspace(t, keyspaceUnshardedName, 1)
testShardCountForKeyspace(t, keyspaceShardedName, 2)
}
Expand All @@ -363,7 +356,6 @@ func testShardCountForKeyspace(t *testing.T, keyspace string, count int) {
}

func TestShardNameForAllKeyspaces(t *testing.T) {
defer cluster.PanicHandler(t)
testShardNameForKeyspace(t, keyspaceUnshardedName, []string{"test_ks_unsharded"})
testShardNameForKeyspace(t, keyspaceShardedName, []string{"-80", "80-"})
}
Expand All @@ -382,7 +374,6 @@ func testShardNameForKeyspace(t *testing.T, keyspace string, shardNames []string
}

func TestKeyspaceToShardName(t *testing.T) {
defer cluster.PanicHandler(t)
var id []byte
srvKeyspace := getSrvKeyspace(t, cell, keyspaceShardedName)

Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/messaging/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitcode, err := func() (int, error) {
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/messaging/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ func TestUnsharded(t *testing.T) {

// TestReparenting checks the client connection count after reparenting.
func TestReparenting(t *testing.T) {
defer cluster.PanicHandler(t)
name := "sharded_message"

ctx := context.Background()
Expand Down Expand Up @@ -435,7 +434,6 @@ func TestReparenting(t *testing.T) {

// TestConnection validate the connection count and message streaming.
func TestConnection(t *testing.T) {
defer cluster.PanicHandler(t)

name := "sharded_message"

Expand Down Expand Up @@ -494,7 +492,6 @@ func TestConnection(t *testing.T) {
}

func testMessaging(t *testing.T, name, ks string) {
defer cluster.PanicHandler(t)
ctx := context.Background()
stream, err := VtgateGrpcConn(ctx, clusterInstance)
require.Nil(t, err)
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/mysqlctl/mysqlctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitCode := func() int {
Expand Down Expand Up @@ -139,7 +138,6 @@ func initCluster(shardNames []string, totalTabletsRequired int) {
}

func TestRestart(t *testing.T) {
defer cluster.PanicHandler(t)
err := primaryTablet.MysqlctlProcess.Stop()
require.Nil(t, err)
primaryTablet.MysqlctlProcess.CleanupFiles(primaryTablet.TabletUID)
Expand All @@ -148,7 +146,6 @@ func TestRestart(t *testing.T) {
}

func TestAutoDetect(t *testing.T) {
defer cluster.PanicHandler(t)

err := clusterInstance.Keyspaces[0].Shards[0].Vttablets[0].VttabletProcess.Setup()
require.Nil(t, err, "error should be nil")
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/mysqlctld/mysqlctld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var (
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

exitCode := func() int {
Expand Down Expand Up @@ -141,7 +140,6 @@ func initCluster(shardNames []string, totalTabletsRequired int) error {
}

func TestRestart(t *testing.T) {
defer cluster.PanicHandler(t)
err := primaryTablet.MysqlctldProcess.Stop()
require.Nil(t, err)
require.Truef(t, primaryTablet.MysqlctldProcess.WaitForMysqlCtldShutdown(), "Mysqlctld has not stopped...")
Expand All @@ -151,7 +149,6 @@ func TestRestart(t *testing.T) {
}

func TestAutoDetect(t *testing.T) {
defer cluster.PanicHandler(t)

err := clusterInstance.Keyspaces[0].Shards[0].Vttablets[0].VttabletProcess.Setup()
require.Nil(t, err, "error should be nil")
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/mysqlserver/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ END;
)

func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()

// setting grpc max size
Expand Down
Loading

0 comments on commit d320f54

Please sign in to comment.