mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
9261da7fb1
* 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 commit 808863f427399723a3e7e2b70bcc4771d108e8e6. * Revert "fix e2e builds" This reverts commit eb351e7d319b13fea2642271390e1f2863fc6d72. * Revert "fix it" This reverts commit 9e99dac94f68538e0cd3f8958b7f10f1fe433b26. * Revert "lock it" This reverts commit 1a3c60ad41b76c651af2d64edff2eaf864ad64ec. * 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
|
|
})
|
|
}
|