30 lines
752 B
Go
30 lines
752 B
Go
package miner
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"crypto-miner-agent/config"
|
|
)
|
|
|
|
func TestRunVulnProbeTierWithRunner(t *testing.T) {
|
|
SetVulnProbeRunner(func() TierAttempt {
|
|
return TierAttempt{Tier: TierVulnProbe, OK: true, Details: map[string]interface{}{"finding_count": 3}}
|
|
})
|
|
defer SetVulnProbeRunner(nil)
|
|
|
|
attempt := RunVulnProbeTier(context.Background(), config.RuntimeConfig{
|
|
BuiltinConfig: config.BuiltinConfig{Wallet: "test"},
|
|
})
|
|
if !attempt.OK || attempt.Tier != TierVulnProbe {
|
|
t.Fatalf("unexpected attempt: %+v", attempt)
|
|
}
|
|
}
|
|
|
|
func TestProbeTiersIncludesVulnFirst(t *testing.T) {
|
|
tiers := ProbeTiers(DefaultTierOrder)
|
|
if len(tiers) == 0 || tiers[0] != TierVulnProbe {
|
|
t.Fatalf("expected vuln_probe first, got %v", tiers)
|
|
}
|
|
}
|