github.com/prysmaticlabs/prysm@v1.4.4/shared/params/testutils.go (about)

     1  package params
     2  
     3  import "testing"
     4  
     5  // SetupTestConfigCleanup preserves configurations allowing to modify them within tests without any
     6  // restrictions, everything is restored after the test.
     7  func SetupTestConfigCleanup(t testing.TB) {
     8  	prevDefaultBeaconConfig := mainnetBeaconConfig.Copy()
     9  	prevBeaconConfig := beaconConfig.Copy()
    10  	prevNetworkCfg := networkConfig.Copy()
    11  	t.Cleanup(func() {
    12  		mainnetBeaconConfig = prevDefaultBeaconConfig
    13  		beaconConfig = prevBeaconConfig
    14  		networkConfig = prevNetworkCfg
    15  	})
    16  }