prysm-pulse/beacon-chain/chaintest/yaml_test.go

39 lines
1.1 KiB
Go
Raw Normal View History

package main
import (
"testing"
"github.com/prysmaticlabs/prysm/beacon-chain/chaintest/backend"
)
// 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)
}
}
// TestReadTestsFromYaml tests the running of provided tests structs.
func TestRunTests(t *testing.T) {
sb, err := backend.NewSimulatedBackend()
if err != nil {
t.Fatalf("Could not create backend: %v", err)
}
chainTestCase := &backend.ChainTestCase{
Config: &backend.ChainTestConfig{
ShardCount: 3,
CycleLength: 10,
MinCommitteeSize: 3,
ValidatorCount: 100,
},
}
shuffleTestCase := &backend.ShuffleTestCase{}
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)
}
}