Expand test coverage across server, agent, and web; fix bugs found during audit.
Adds hundreds of unit/integration/e2e tests, fixes WS bcrypt auth, config merge, fleet analytics, agent schedule/log tail, and documents stale PROBLEMS items. Updates PROBLEMS.md, README, and test scripts; ignores local spread-kits and coverage dirs.
This commit is contained in:
54
agent/miner/engine_test.go
Normal file
54
agent/miner/engine_test.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewEngineNotNil(t *testing.T) {
|
||||
e := NewEngine()
|
||||
if e == nil || e.cache == nil {
|
||||
t.Fatal("NewEngine should allocate cache")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineSetJobInvalidSeed(t *testing.T) {
|
||||
e := NewEngine()
|
||||
if err := e.SetJob("zz", strings.Repeat("00", 76)); err == nil {
|
||||
t.Fatal("invalid seed hex should error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineSetJobInvalidBlob(t *testing.T) {
|
||||
e := NewEngine()
|
||||
seed := strings.Repeat("ab", 32)
|
||||
if err := e.SetJob(seed, "not-hex"); err == nil {
|
||||
t.Fatal("invalid blob hex should error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineHashAtNonceNoVM(t *testing.T) {
|
||||
e := NewEngine()
|
||||
hash, blob, err := e.HashAtNonce(0)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if hash != "" || blob != "" {
|
||||
t.Fatalf("empty VM should return empty strings, got hash=%q blob=%q", hash, blob)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineHashAtNonceShortBlob(t *testing.T) {
|
||||
e := NewEngine()
|
||||
seed := strings.Repeat("cd", 32)
|
||||
if err := e.SetJob(seed, strings.Repeat("00", 20)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
hash, blob, err := e.HashAtNonce(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if hash != "" || blob != "" {
|
||||
t.Fatalf("blob shorter than nonce offset should not hash, got hash=%q blob=%q", hash, blob)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user