mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
Miscellaneous code quality improvements (#7414)
* anti-patterns * performance issues * handle skipped defer * gazelle fix * misc bug risks * make logging of proposer slashings more robust * simplify calling span.End() Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -57,16 +57,20 @@ func keySetup() {
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
dir := testutil.TempDir() + "/keystore1"
|
||||
defer func() {
|
||||
cleanup := func() {
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
log.WithError(err).Debug("Cannot remove keystore folder")
|
||||
}
|
||||
}()
|
||||
}
|
||||
defer cleanup()
|
||||
if err := v1.NewValidatorAccount(dir, "1234"); err != nil {
|
||||
log.WithError(err).Debug("Cannot create validator account")
|
||||
}
|
||||
keySetup()
|
||||
os.Exit(m.Run())
|
||||
code := m.Run()
|
||||
// os.Exit will prevent defer from being called
|
||||
cleanup()
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func TestStop_CancelsContext(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user