Adds test files for 6 source files that had no corresponding test:
bufpool_test.go (mining + node), metrics_test.go, version_test.go,
supervisor_test.go, mining_profile_test.go. Each follows
TestFilename_Function_{Good,Bad,Ugly} convention.
Also fixes 2 pre-existing compilation errors:
- ratelimiter_test.go: rl -> rateLimiter (leftover from AX rename)
- worker_test.go: worker.node -> worker.nodeManager (field was renamed)
Co-Authored-By: Charon <charon@lethean.io>
31 lines
712 B
Go
31 lines
712 B
Go
package mining
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestVersion_GetVersion_Good(t *testing.T) {
|
|
result := GetVersion()
|
|
if result == "" {
|
|
t.Fatal("expected non-empty version string")
|
|
}
|
|
}
|
|
|
|
func TestVersion_GetVersion_Bad(t *testing.T) {
|
|
// Default version is "dev" when ldflags are not set
|
|
result := GetVersion()
|
|
if result != "dev" {
|
|
// Not a failure — just means ldflags were set
|
|
t.Logf("version is %q (ldflags may be set)", result)
|
|
}
|
|
}
|
|
|
|
func TestVersion_GetVersion_Ugly(t *testing.T) {
|
|
// All three version functions should return non-empty strings
|
|
if GetCommit() == "" {
|
|
t.Fatal("expected non-empty commit string")
|
|
}
|
|
if GetBuildDate() == "" {
|
|
t.Fatal("expected non-empty build date string")
|
|
}
|
|
}
|