mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
bbde2a6820
* add reset funcs * init -> TestMain for beacon config params * fixes build file * core/epoch spectests updated * core/blocks spectests updated * fix the rest of spectests * SetupTestConfigCleanup * revert copy() api * rever all cases of copy() * fixes spectests * updates fork_test * config_test update * fixes spectest/config_test * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge branch 'master' into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge branch 'master' into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests * Merge refs/heads/master into assert-no-side-effects-occur-in-tests
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package params_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
// Test cases can be executed in an arbitrary order. TestOverrideBeaconConfigTestTeardown checks
|
|
// that there's no state mutation leak from the previous test, therefore we need a sentinel flag,
|
|
// to make sure that previous test case has already been completed and check can be run.
|
|
var testOverrideBeaconConfigExecuted bool
|
|
|
|
func TestOverrideBeaconConfig(t *testing.T) {
|
|
// Ensure that param modifications are safe.
|
|
params.SetupTestConfigCleanup(t)
|
|
cfg := params.BeaconConfig()
|
|
cfg.SlotsPerEpoch = 5
|
|
params.OverrideBeaconConfig(cfg)
|
|
if c := params.BeaconConfig(); c.SlotsPerEpoch != 5 {
|
|
t.Errorf("Shardcount in BeaconConfig incorrect. Wanted %d, got %d", 5, c.SlotsPerEpoch)
|
|
}
|
|
testOverrideBeaconConfigExecuted = true
|
|
}
|
|
|
|
func TestOverrideBeaconConfigTestTeardown(t *testing.T) {
|
|
if !testOverrideBeaconConfigExecuted {
|
|
t.Skip("State leak can occur only if state mutating test has already completed")
|
|
}
|
|
cfg := params.BeaconConfig()
|
|
if cfg.SlotsPerEpoch == 5 {
|
|
t.Fatal("Parameter update has been leaked out of previous test")
|
|
}
|
|
}
|