prysm-pulse/beacon-chain/node/node_test.go

84 lines
2.6 KiB
Go
Raw Normal View History

package node
import (
"flag"
"fmt"
Add flag to allow reading bootstrap nodes from a file (#6351) * parent c837dfb2f26d82abf4dfbd184189d57c5b0ddedf author dv8silencer <dv8silencer+github@gmail.com> 1592805180 -0500 committer dv8silencer <dv8silencer+github@gmail.com> 1592855989 -0500 Create a bootstrap-node-file flag which reads nodes from a YAML file and make the flag mutually exclusive to the bootstrap-node flag * Merge branch 'master' into dv8s-iss6316 * Refactor so that boot node reading is in its own function. Added test * Added period Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Merge branch 'master' into dv8s-iss6316 * Edit Bazel to include go-yaml dep * Help Bazel build successfully * Merge branch 'master' into dv8s-iss6316 * bazel run //:gazella -- fix * Handle error from YAML parser to address build checks * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Updated flags.go to refine the Usage for the BootStrapNodeFile flag Co-authored-by: Nishant Das <nish1993@hotmail.com> * Merge branch 'master' into dv8s-iss6316 * Utilize stdlib TempFile to avoid polluting * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * merge master into this branch * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Changed bootstrap-node to StringSlice flag to allow multiple nodes to be passed. Each value can be .enr file which will be YAML parsed to extract nodes * Refactored to create separate readbootNodes function and added a test for it. * More cleaning up * Changed wording in the cli help for --bootstrap-node * Merge branch 'master' into dv8s-iss6316 * Since we are taking YAML files, got rid of .enr check and instead we check for the string prefix of a enr record or not to determine if file. * Merge with dv8silencer/tempissue6316 * Correct spacing Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Changed how we check for YAML file vs CLI-direct ENR * Minor: Changed to 1 string from concatenating 2 * Merge branch 'master' into dv8s-iss6316
2020-06-26 11:23:38 +00:00
"io/ioutil"
"os"
"path/filepath"
"testing"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/shared/cmd"
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
logTest "github.com/sirupsen/logrus/hooks/test"
Refactor dependencies, make Prysm "go gettable" (#6053) * Fix a few deps to work with go.mod, check in generated files * Update Gossipsub to 1.1 (#5998) * update libs * add new validators * add new deps * new set of deps * tls * further fix gossip update * get everything to build * clean up * gaz * fix build * fix all tests * add deps to images * imports Co-authored-by: rauljordan <raul@prysmaticlabs.com> * Beacon chain builds with go build * fix bazel * fix dep * lint * Add github action for testing go * on PR for any branch * fix libp2p test failure * Fix TestProcessBlock_PassesProcessingConditions by updating the proposer index in test * Revert "Fix TestProcessBlock_PassesProcessingConditions by updating the proposer index in test" This reverts commit 43676894ab01f03fe90a9b8ee3ecfbc2ec1ec4e4. * Compute and set proposer index instead of hard code * Add back go mod/sum, fix deps * go build ./... * Temporarily skip two tests * Fix kafka confluent patch * Fix kafka confluent patch * fix kafka build * fix kafka * Add info in DEPENDENCIES. Added a stub link for Why Bazel? until https://github.com/prysmaticlabs/documentation/issues/138 * Update fuzz ssz files as well * Update fuzz ssz files as well * getting closer * rollback rules_go and gazelle * fix gogo protobuf * install librdkafka-dev as part of github actions * Update kafka to a recent version where librkafkfa is not required for go modules * clarify comment * fix kafka build * disable go tests * comment * Fix geth dependencies for end to end * rename word * lint * fix docker Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: rauljordan <raul@prysmaticlabs.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2020-05-31 06:44:34 +00:00
"github.com/urfave/cli/v2"
)
// Ensure BeaconNode implements interfaces.
var _ statefeed.Notifier = (*BeaconNode)(nil)
// Test that beacon chain node can close.
func TestNodeClose_OK(t *testing.T) {
hook := logTest.NewGlobal()
tmp := fmt.Sprintf("%s/datadirtest2", t.TempDir())
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.Bool("test-skip-pow", true, "skip pow dial")
set.String("datadir", tmp, "node data directory")
set.String("p2p-encoding", "ssz", "p2p encoding scheme")
set.Bool("demo-config", true, "demo configuration")
set.String("deposit-contract", "0x0000000000000000000000000000000000000000", "deposit contract address")
context := cli.NewContext(&app, set, nil)
node, err := New(context)
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
require.NoError(t, err)
node.Close()
require.LogsContain(t, hook, "Stopping beacon node")
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
require.NoError(t, os.RemoveAll(tmp))
}
Add flag to allow reading bootstrap nodes from a file (#6351) * parent c837dfb2f26d82abf4dfbd184189d57c5b0ddedf author dv8silencer <dv8silencer+github@gmail.com> 1592805180 -0500 committer dv8silencer <dv8silencer+github@gmail.com> 1592855989 -0500 Create a bootstrap-node-file flag which reads nodes from a YAML file and make the flag mutually exclusive to the bootstrap-node flag * Merge branch 'master' into dv8s-iss6316 * Refactor so that boot node reading is in its own function. Added test * Added period Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Merge branch 'master' into dv8s-iss6316 * Edit Bazel to include go-yaml dep * Help Bazel build successfully * Merge branch 'master' into dv8s-iss6316 * bazel run //:gazella -- fix * Handle error from YAML parser to address build checks * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Updated flags.go to refine the Usage for the BootStrapNodeFile flag Co-authored-by: Nishant Das <nish1993@hotmail.com> * Merge branch 'master' into dv8s-iss6316 * Utilize stdlib TempFile to avoid polluting * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * merge master into this branch * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Changed bootstrap-node to StringSlice flag to allow multiple nodes to be passed. Each value can be .enr file which will be YAML parsed to extract nodes * Refactored to create separate readbootNodes function and added a test for it. * More cleaning up * Changed wording in the cli help for --bootstrap-node * Merge branch 'master' into dv8s-iss6316 * Since we are taking YAML files, got rid of .enr check and instead we check for the string prefix of a enr record or not to determine if file. * Merge with dv8silencer/tempissue6316 * Correct spacing Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Changed how we check for YAML file vs CLI-direct ENR * Minor: Changed to 1 string from concatenating 2 * Merge branch 'master' into dv8s-iss6316
2020-06-26 11:23:38 +00:00
func TestBootStrapNodeFile(t *testing.T) {
file, err := ioutil.TempFile(t.TempDir(), "bootstrapFile")
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
require.NoError(t, err)
Add flag to allow reading bootstrap nodes from a file (#6351) * parent c837dfb2f26d82abf4dfbd184189d57c5b0ddedf author dv8silencer <dv8silencer+github@gmail.com> 1592805180 -0500 committer dv8silencer <dv8silencer+github@gmail.com> 1592855989 -0500 Create a bootstrap-node-file flag which reads nodes from a YAML file and make the flag mutually exclusive to the bootstrap-node flag * Merge branch 'master' into dv8s-iss6316 * Refactor so that boot node reading is in its own function. Added test * Added period Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Merge branch 'master' into dv8s-iss6316 * Edit Bazel to include go-yaml dep * Help Bazel build successfully * Merge branch 'master' into dv8s-iss6316 * bazel run //:gazella -- fix * Handle error from YAML parser to address build checks * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Updated flags.go to refine the Usage for the BootStrapNodeFile flag Co-authored-by: Nishant Das <nish1993@hotmail.com> * Merge branch 'master' into dv8s-iss6316 * Utilize stdlib TempFile to avoid polluting * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * merge master into this branch * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Changed bootstrap-node to StringSlice flag to allow multiple nodes to be passed. Each value can be .enr file which will be YAML parsed to extract nodes * Refactored to create separate readbootNodes function and added a test for it. * More cleaning up * Changed wording in the cli help for --bootstrap-node * Merge branch 'master' into dv8s-iss6316 * Since we are taking YAML files, got rid of .enr check and instead we check for the string prefix of a enr record or not to determine if file. * Merge with dv8silencer/tempissue6316 * Correct spacing Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Changed how we check for YAML file vs CLI-direct ENR * Minor: Changed to 1 string from concatenating 2 * Merge branch 'master' into dv8s-iss6316
2020-06-26 11:23:38 +00:00
sampleNode0 := "- enr:-Ku4QMKVC_MowDsmEa20d5uGjrChI0h8_KsKXDmgVQbIbngZV0i" +
"dV6_RL7fEtZGo-kTNZ5o7_EJI_vCPJ6scrhwX0Z4Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD" +
"1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQJxCnE6v_x2ekgY_uo" +
"E1rtwzvGy40mq9eD66XfHPBWgIIN1ZHCCD6A"
sampleNode1 := "- enr:-TESTNODE2"
sampleNode2 := "- enr:-TESTNODE3"
err = ioutil.WriteFile(file.Name(), []byte(sampleNode0+"\n"+sampleNode1+"\n"+sampleNode2), 0644)
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
require.NoError(t, err, "Error in WriteFile call")
Add flag to allow reading bootstrap nodes from a file (#6351) * parent c837dfb2f26d82abf4dfbd184189d57c5b0ddedf author dv8silencer <dv8silencer+github@gmail.com> 1592805180 -0500 committer dv8silencer <dv8silencer+github@gmail.com> 1592855989 -0500 Create a bootstrap-node-file flag which reads nodes from a YAML file and make the flag mutually exclusive to the bootstrap-node flag * Merge branch 'master' into dv8s-iss6316 * Refactor so that boot node reading is in its own function. Added test * Added period Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Merge branch 'master' into dv8s-iss6316 * Edit Bazel to include go-yaml dep * Help Bazel build successfully * Merge branch 'master' into dv8s-iss6316 * bazel run //:gazella -- fix * Handle error from YAML parser to address build checks * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Updated flags.go to refine the Usage for the BootStrapNodeFile flag Co-authored-by: Nishant Das <nish1993@hotmail.com> * Merge branch 'master' into dv8s-iss6316 * Utilize stdlib TempFile to avoid polluting * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * merge master into this branch * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Changed bootstrap-node to StringSlice flag to allow multiple nodes to be passed. Each value can be .enr file which will be YAML parsed to extract nodes * Refactored to create separate readbootNodes function and added a test for it. * More cleaning up * Changed wording in the cli help for --bootstrap-node * Merge branch 'master' into dv8s-iss6316 * Since we are taking YAML files, got rid of .enr check and instead we check for the string prefix of a enr record or not to determine if file. * Merge with dv8silencer/tempissue6316 * Correct spacing Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Changed how we check for YAML file vs CLI-direct ENR * Minor: Changed to 1 string from concatenating 2 * Merge branch 'master' into dv8s-iss6316
2020-06-26 11:23:38 +00:00
nodeList, err := readbootNodes(file.Name())
Apply testutils assertions: final cleanup (#7003) * slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * tools tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * agg tests * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'master' into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * updates aggregated_test * beacon-chain/operations/attestations/kv/* tests updated * beacon-chain/operations/attestations tests updated * beacon-chain/operations/slashings tests updated * Merge branch 'master' into apply-testutils-assertions-misc * gazelle * beacon-chain/core tests updated * fixes test * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/rpc tests updated * beacon-chain/sync/initial-sync tests * misc tests * optimizes error message parsing in testutils * Merge branch 'assertutils-optimize-processing' into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * endtoend tests * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * beacon-chain/blockchain tests updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * beacon-chain/state/stategen tests updated * beacon-chain all left-over tests are done * Merge refs/heads/master into apply-testutils-assertions-misc * validator tests updated * slasher tests * Merge branch 'master' into apply-testutils-assertions-misc * gofmt * gazelle * Merge refs/heads/master into apply-testutils-assertions-misc * shared upd * end2end tests deps fixed * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc * Merge refs/heads/master into apply-testutils-assertions-misc * misc * all tests are updated * Merge branch 'apply-testutils-assertions-misc' of github.com:prysmaticlabs/prysm into apply-testutils-assertions-misc
2020-08-25 15:23:06 +00:00
require.NoError(t, err, "Error in readbootNodes call")
assert.Equal(t, sampleNode0[2:], nodeList[0], "Unexpected nodes")
assert.Equal(t, sampleNode1[2:], nodeList[1], "Unexpected nodes")
assert.Equal(t, sampleNode2[2:], nodeList[2], "Unexpected nodes")
Add flag to allow reading bootstrap nodes from a file (#6351) * parent c837dfb2f26d82abf4dfbd184189d57c5b0ddedf author dv8silencer <dv8silencer+github@gmail.com> 1592805180 -0500 committer dv8silencer <dv8silencer+github@gmail.com> 1592855989 -0500 Create a bootstrap-node-file flag which reads nodes from a YAML file and make the flag mutually exclusive to the bootstrap-node flag * Merge branch 'master' into dv8s-iss6316 * Refactor so that boot node reading is in its own function. Added test * Added period Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Merge branch 'master' into dv8s-iss6316 * Edit Bazel to include go-yaml dep * Help Bazel build successfully * Merge branch 'master' into dv8s-iss6316 * bazel run //:gazella -- fix * Handle error from YAML parser to address build checks * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Updated flags.go to refine the Usage for the BootStrapNodeFile flag Co-authored-by: Nishant Das <nish1993@hotmail.com> * Merge branch 'master' into dv8s-iss6316 * Utilize stdlib TempFile to avoid polluting * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * merge master into this branch * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Merge branch 'master' into dv8s-iss6316 * Changed bootstrap-node to StringSlice flag to allow multiple nodes to be passed. Each value can be .enr file which will be YAML parsed to extract nodes * Refactored to create separate readbootNodes function and added a test for it. * More cleaning up * Changed wording in the cli help for --bootstrap-node * Merge branch 'master' into dv8s-iss6316 * Since we are taking YAML files, got rid of .enr check and instead we check for the string prefix of a enr record or not to determine if file. * Merge with dv8silencer/tempissue6316 * Correct spacing Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Changed how we check for YAML file vs CLI-direct ENR * Minor: Changed to 1 string from concatenating 2 * Merge branch 'master' into dv8s-iss6316
2020-06-26 11:23:38 +00:00
}
// TestClearDB tests clearing the database
func TestClearDB(t *testing.T) {
hook := logTest.NewGlobal()
tmp := filepath.Join(t.TempDir(), "datadirtest")
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String("datadir", tmp, "node data directory")
set.Bool(cmd.ForceClearDB.Name, true, "force clear db")
context := cli.NewContext(&app, set, nil)
_, err := New(context)
require.NoError(t, err)
require.LogsContain(t, hook, "Removing database")
require.NoError(t, os.RemoveAll(tmp))
}