prysm-pulse/testing/bls/utils/utils.go
terencechain d17996f8b0
Update to V4 🚀 (#12134)
* Update V3 from V4

* Fix build v3 -> v4

* Update ssz

* Update beacon_chain.pb.go

* Fix formatter import

* Update update-mockgen.sh comment to v4

* Fix conflicts. Pass build and tests

* Fix test
2023-03-17 18:52:56 +00:00

33 lines
898 B
Go

package utils
import (
"os"
"path"
"strings"
"testing"
"github.com/bazelbuild/rules_go/go/tools/bazel"
"github.com/prysmaticlabs/prysm/v4/io/file"
"github.com/prysmaticlabs/prysm/v4/testing/require"
)
func RetrieveFiles(name string, t *testing.T) ([]string, [][]byte) {
filepath, err := bazel.Runfile(name)
require.NoError(t, err)
testFiles, err := os.ReadDir(filepath)
require.NoError(t, err)
fileNames := make([]string, 0, len(testFiles))
fileContent := make([][]byte, 0, len(testFiles))
require.Equal(t, false, len(testFiles) == 0, "no files exist in directory")
for _, f := range testFiles {
// Remove .yml suffix
fName := strings.TrimSuffix(f.Name(), ".yaml")
fileNames = append(fileNames, fName)
data, err := file.ReadFileAsBytes(path.Join(filepath, f.Name()))
require.NoError(t, err)
fileContent = append(fileContent, data)
}
return fileNames, fileContent
}