prysm-pulse/config/params/testutils.go

17 lines
511 B
Go
Raw Normal View History

package params
import "testing"
// SetupTestConfigCleanup preserves configurations allowing to modify them within tests without any
// restrictions, everything is restored after the test.
func SetupTestConfigCleanup(t testing.TB) {
prevDefaultBeaconConfig := mainnetBeaconConfig.Copy()
prevBeaconConfig := beaconConfig.Copy()
prevNetworkCfg := networkConfig.Copy()
t.Cleanup(func() {
mainnetBeaconConfig = prevDefaultBeaconConfig
beaconConfig = prevBeaconConfig
networkConfig = prevNetworkCfg
})
}