fix Go tests

- merkletree: fix broken test case
- fixtures: fix compatibility with Bazel
This commit is contained in:
Richard Patel 2022-10-30 08:19:30 +01:00
parent 4ddc64e2c0
commit 2742cd8867
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,5 @@
//go:build rocksdb
package create
import (

View File

@ -29,7 +29,7 @@ func shreds(t testing.TB, network string, slot uint64, shredType rune) [][]byte
})
var shreds [][]byte
for _, entry := range entries {
if !entry.Type().IsRegular() {
if entry.Type().IsDir() {
continue
}
name := entry.Name()

View File

@ -14,7 +14,7 @@ func TestHashNodes(t *testing.T) {
}{
"Empty": {
leaves: nil,
root: "0000000000000000000000000000000000000000000000000000000000000000",
root: "",
},
"One": {
leaves: [][]byte{[]byte("test")},
@ -38,7 +38,11 @@ func TestHashNodes(t *testing.T) {
for _, node := range actual.Nodes {
t.Log(hex.EncodeToString(node[:]))
}
assert.Equal(t, tc.root, hex.EncodeToString(actualRoot[:]))
if tc.root == "" {
assert.Nil(t, actualRoot)
} else {
assert.Equal(t, tc.root, hex.EncodeToString(actualRoot[:]))
}
})
}
}
@ -47,5 +51,5 @@ func TestHashNodes_One(t *testing.T) {
input := []byte("test")
actual := HashNodes([][]byte{input})
expected := HashLeaf(input)
assert.Equal(t, expected, actual.GetRoot())
assert.Equal(t, expected, *actual.GetRoot())
}