Improve "synced block.." log (#9760)

This commit is contained in:
terence tsao
2021-10-09 06:27:34 -07:00
committed by GitHub
parent 65d2df4609
commit f114a47b5b
4 changed files with 49 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
load("@prysm//tools/go:def.bzl", "go_library")
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
@@ -20,3 +20,9 @@ go_library(
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["fork_test.go"],
embed = [":go_default_library"],
)

View File

@@ -4,3 +4,14 @@ const (
Phase0 = iota
Altair
)
func String(version int) string {
switch version {
case Phase0:
return "phase0"
case Altair:
return "altair"
default:
return "unknown version"
}
}

View File

@@ -0,0 +1,29 @@
package version
import "testing"
func TestVersionString(t *testing.T) {
tests := []struct {
name string
version int
want string
}{
{
name: "phase0",
version: Phase0,
want: "phase0",
},
{
name: "altair",
version: Altair,
want: "altair",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := String(tt.version); got != tt.want {
t.Errorf("String() = %v, want %v", got, tt.want)
}
})
}
}