2020-06-27 00:20:24 +00:00
|
|
|
package params
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
// SetupTestConfigCleanup preserves configurations allowing to modify them within tests without any
|
|
|
|
// restrictions, everything is restored after the test.
|
2020-09-14 18:42:08 +00:00
|
|
|
func SetupTestConfigCleanup(t testing.TB) {
|
2020-06-27 00:20:24 +00:00
|
|
|
prevDefaultBeaconConfig := mainnetBeaconConfig.Copy()
|
|
|
|
prevBeaconConfig := beaconConfig.Copy()
|
2021-04-14 07:39:20 +00:00
|
|
|
prevNetworkCfg := networkConfig.Copy()
|
2020-06-27 00:20:24 +00:00
|
|
|
t.Cleanup(func() {
|
|
|
|
mainnetBeaconConfig = prevDefaultBeaconConfig
|
|
|
|
beaconConfig = prevBeaconConfig
|
2021-04-14 07:39:20 +00:00
|
|
|
networkConfig = prevNetworkCfg
|
2020-06-27 00:20:24 +00:00
|
|
|
})
|
|
|
|
}
|