Align Discovery controls with explicit VM cancellation truth

Keep the generic catalogue-error fixture distinct from unknown timed-out guest handoff, and require the existing canceled-VM control to expose a safety deferral without dispatch. The new completion/cancellation parent failures and full-source adverse result remain retained; no production behavior changes in this commit.

Contract-Neutral: Test-only correction records the existing guest cancellation and ordinary-command error contracts without changing production source, APIs, protocol or time budgets.
Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-10-04 18:47:43 +01:00
parent f9ed9311f2
commit 8b6513581c
@@ -3,11 +3,13 @@ package servicediscovery
import (
"bytes"
"context"
"errors"
"strings"
"sync"
"testing"
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/agentexec"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
@@ -80,7 +82,9 @@ func (outputExecutor) IsAgentConnected(string) bool { return true }
type errorExecutor struct{}
func (errorExecutor) ExecuteCommand(ctx context.Context, agentID string, cmd ExecuteCommandPayload) (*CommandResultPayload, error) {
return nil, context.DeadlineExceeded
// This control covers ordinary catalogue failure, not an uncertain
// timed-out VM handoff (which now stops the scan in its own controls).
return nil, errors.New("fixture command failed")
}
func (errorExecutor) GetConnectedAgents() []ConnectedAgent {
@@ -393,8 +397,8 @@ func TestDeepScanner_ScanCanceledContext(t *testing.T) {
ResourceID: "101:web",
TargetID: "host1",
Hostname: "host1",
}); err != nil {
t.Fatalf("Scan error: %v", err)
}); err == nil || !agentexec.IsGuestExecDeferred(err.Error()) || len(exec.commands) != 0 {
t.Fatalf("canceled VM scan must defer before dispatch: err=%v commands=%v", err, exec.commands)
}
}