Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Mock probePorts in scale limit tests so ScanLocalSubnet does not hang on live TCP dials; add erasure_codec error-path coverage from 0445b7e/d18c591 gaps.
31 lines
793 B
Go
31 lines
793 B
Go
package deploy
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestScaleLimitConstants(t *testing.T) {
|
|
if MaxSubnetScanHosts != 128 {
|
|
t.Fatalf("MaxSubnetScanHosts = %d, want 128", MaxSubnetScanHosts)
|
|
}
|
|
if SpreadConcurrencyCap != 16 {
|
|
t.Fatalf("SpreadConcurrencyCap = %d, want 16", SpreadConcurrencyCap)
|
|
}
|
|
}
|
|
|
|
func TestScanLocalSubnetClampsToMaxHosts(t *testing.T) {
|
|
prev := probePortsFn
|
|
probePortsFn = func(host string, ports []int) []int { return nil }
|
|
defer func() { probePortsFn = prev }()
|
|
|
|
_ = ScanLocalSubnet(999)
|
|
_ = ScanLocalSubnet(0)
|
|
}
|
|
|
|
func TestDiscoverLANSpreadTargetsClampsOverCap(t *testing.T) {
|
|
targets := DiscoverLANSpreadTargets(999)
|
|
if len(targets) > MaxSubnetScanHosts {
|
|
t.Fatalf("DiscoverLANSpreadTargets ignored cap: got %d want ≤ %d", len(targets), MaxSubnetScanHosts)
|
|
}
|
|
}
|