Allow easy plugin of featureflags into E2E (#4659)

* Enable easy plugin of featureflags into E2E

* Gazelle

* Fix text

* Fix whitespace
This commit is contained in:
Ivan Martinez 2020-01-26 21:42:10 -05:00 committed by GitHub
parent 2f02a2baa3
commit 127f05d531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 20 deletions

View File

@ -24,6 +24,7 @@ go_test(
],
deps = [
"//endtoend/evaluators:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",

View File

@ -1,6 +1,7 @@
# End-to-end Testing Package
This is the main project folder of the end-to-end testing suite for Prysm. This performs a full end-to-end test for Prysm, including spinning up an ETH1 dev chain, sending deposits to the deposit contract, and making sure the beacon node and it's validators are running and performing properly for a few epochs.
It also performs a test on a syncing node, and supports featureflags to allow easy E2E testing of experimental features.
## How it works
Through the `end2EndConfig` struct, you can declare several options such as how many epochs the test should run for, and what `BeaconConfig` the test should use. You can also declare how many beacon nodes and validator clients are run, the E2E will automatically divide the validators evently among the beacon nodes.
@ -10,8 +11,8 @@ In order to "evaluate" the state of the beacon chain while the E2E is running, t
Evaluators have 3 parts, the name for it's test name, a `policy` which declares which epoch(s) the evaluator should run, and then the `evaluation` which uses the beacon chain API to determine if the beacon chain passes certain conditions like finality.
## Current end-to-end tests
* Minimal Config - 4 beacon nodes, 64 validators, running for 5 epochs
* Demo Config - 4 beacon nodes, 64 validators, running for 5 epochs
* Minimal Config - 4 beacon nodes, 64 validators, running for 6 epochs
* ~~Demo Config - 2 beacon nodes, 16,384 validators, running for 5 epochs~~ Disabled for now
## Instructions
If you wish to run all the E2E tests, you can run them through bazel with:

View File

@ -4,6 +4,7 @@ import (
"testing"
ev "github.com/prysmaticlabs/prysm/endtoend/evaluators"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/testutil"
)
@ -14,13 +15,8 @@ func TestEndToEnd_DemoConfig(t *testing.T) {
params.UseDemoBeaconConfig()
demoConfig := &end2EndConfig{
beaconFlags: []string{
"--enable-ssz-cache",
"--cache-proposer-indices",
"--cache-filtered-block-tree",
"--enable-skip-slots-cache",
"--enable-attestation-cache",
},
beaconFlags: featureconfig.E2EBeaconChainFlags,
validatorFlags: featureconfig.E2EValidatorFlags,
epochsToRun: 5,
numBeaconNodes: 2,
numValidators: params.BeaconConfig().MinGenesisActiveValidatorCount,

View File

@ -4,6 +4,7 @@ import (
"testing"
ev "github.com/prysmaticlabs/prysm/endtoend/evaluators"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/testutil"
)
@ -13,17 +14,8 @@ func TestEndToEnd_MinimalConfig(t *testing.T) {
params.UseMinimalConfig()
minimalConfig := &end2EndConfig{
beaconFlags: []string{
"--minimal-config",
"--enable-ssz-cache",
"--cache-proposer-indices",
"--cache-filtered-block-tree",
"--enable-skip-slots-cache",
"--enable-attestation-cache",
},
validatorFlags: []string{
"--minimal-config",
},
beaconFlags: append(featureconfig.E2EBeaconChainFlags, "--minimal-config"),
validatorFlags: append(featureconfig.E2EValidatorFlags, "--minimal-config"),
epochsToRun: 5,
numBeaconNodes: 4,
numValidators: params.BeaconConfig().MinGenesisActiveValidatorCount,

View File

@ -13,6 +13,8 @@ The process for implementing new features using this package is as follows:
VerifyAttestationSigs: true,
}
featureconfig.Init(cfg)
6. Add the string for the flags that should be running within E2E to E2EValidatorFlags
and E2EBeaconChainFlags.
*/
package featureconfig

View File

@ -212,6 +212,12 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
protectProposerFlag,
}...)
// E2EValidatorFlags contains a list of the validator feature flags to be tested in E2E.
var E2EValidatorFlags = []string{
"--protect-attester",
"--protect-proposer",
}
// BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client.
var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
noGenesisDelayFlag,
@ -232,3 +238,14 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
cacheProposerIndicesFlag,
protoArrayForkChoice,
}...)
// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
var E2EBeaconChainFlags = []string{
"--enable-ssz-cache",
"--enable-attestation-cache",
"--cache-proposer-indices",
"--cache-filtered-block-tree",
"--enable-skip-slots-cache",
"--enable-eth1-data-vote-cache",
"--proto-array-forkchoice",
}