2018-11-07 19:07:41 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/chaintest/backend"
|
|
|
|
)
|
|
|
|
|
2018-11-19 06:54:04 +00:00
|
|
|
// TestReadTestsFromYaml tests constructing test cases from yaml file.
|
|
|
|
func TestReadTestsFromYaml(t *testing.T) {
|
|
|
|
if _, err := readTestsFromYaml(string("./tests")); err != nil {
|
|
|
|
t.Fatalf("Failed to read yaml files: %v", err)
|
2018-11-07 19:07:41 +00:00
|
|
|
}
|
2018-11-19 06:54:04 +00:00
|
|
|
}
|
2018-11-07 19:07:41 +00:00
|
|
|
|
2018-11-19 06:54:04 +00:00
|
|
|
// TestReadTestsFromYaml tests the running of provided tests structs.
|
|
|
|
func TestRunTests(t *testing.T) {
|
|
|
|
sb, err := backend.NewSimulatedBackend()
|
2018-11-07 19:07:41 +00:00
|
|
|
if err != nil {
|
2018-11-19 06:54:04 +00:00
|
|
|
t.Fatalf("Could not create backend: %v", err)
|
2018-11-07 19:07:41 +00:00
|
|
|
}
|
|
|
|
|
2018-11-19 06:54:04 +00:00
|
|
|
chainTestCase := &backend.ChainTestCase{
|
|
|
|
Config: &backend.ChainTestConfig{
|
|
|
|
ShardCount: 3,
|
|
|
|
CycleLength: 10,
|
|
|
|
MinCommitteeSize: 3,
|
|
|
|
ValidatorCount: 100,
|
|
|
|
},
|
2018-11-07 19:07:41 +00:00
|
|
|
}
|
2018-11-19 06:54:04 +00:00
|
|
|
shuffleTestCase := &backend.ShuffleTestCase{}
|
2018-11-07 19:07:41 +00:00
|
|
|
|
2018-11-19 06:54:04 +00:00
|
|
|
chainTest := &backend.ChainTest{TestCases: []*backend.ChainTestCase{chainTestCase}}
|
|
|
|
shuffleTest := &backend.ShuffleTest{TestCases: []*backend.ShuffleTestCase{shuffleTestCase}}
|
|
|
|
if err = runTests([]interface{}{chainTest, shuffleTest}, sb); err != nil {
|
|
|
|
t.Fatalf("Failed to run test cases: %v", err)
|
2018-11-07 19:07:41 +00:00
|
|
|
}
|
|
|
|
}
|