mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
* save progress * tidy * Update go.yml * make CI happy * gosec * revert back * Update go.yml * change go version * remove fixed test case * fix ci * fix updates * fix up * fix race tests * fix bad mock * lock it * fix it * fix e2e builds * use gotags * Revert "use gotags" This reverts commit808863f427. * Revert "fix e2e builds" This reverts commiteb351e7d31. * Revert "fix it" This reverts commit9e99dac94f. * Revert "lock it" This reverts commit1a3c60ad41. * different approach * better Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
29 lines
761 B
Go
29 lines
761 B
Go
//go:build develop
|
|
|
|
package params
|
|
|
|
import "testing"
|
|
|
|
// SetupTestConfigCleanupWithLock preserves configurations allowing to modify them within tests without any
|
|
// restrictions, everything is restored after the test. This locks our config when undoing our config
|
|
// change in order to satisfy the race detector.
|
|
func SetupTestConfigCleanupWithLock(t testing.TB) {
|
|
prevDefaultBeaconConfig := mainnetBeaconConfig.Copy()
|
|
temp := configs.getActive().Copy()
|
|
undo, err := SetActiveWithUndo(temp)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
prevNetworkCfg := networkConfig.Copy()
|
|
t.Cleanup(func() {
|
|
mainnetBeaconConfig = prevDefaultBeaconConfig
|
|
cfgrw.Lock()
|
|
err = undo()
|
|
cfgrw.Unlock()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
networkConfig = prevNetworkCfg
|
|
})
|
|
}
|