package cluster import ( "context" "time" "scm.bstein.dev/bstein/ananke/internal/state" ) // TestHookReconcileNodeAccess runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookReconcileNodeAccess(ctx context.Context, nodes []string) error. // Why: exposes access reconciliation internals to the top-level testing module. func (o *Orchestrator) TestHookReconcileNodeAccess(ctx context.Context, nodes []string) error { return o.reconcileNodeAccess(ctx, nodes) } // TestHookWaitForNodeSSHAuth runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForNodeSSHAuth(ctx context.Context, nodes []string) error. // Why: exposes node SSH auth gate internals to the top-level testing module. func (o *Orchestrator) TestHookWaitForNodeSSHAuth(ctx context.Context, nodes []string) error { return o.waitForNodeSSHAuth(ctx, nodes) } // TestHookReportFluxSource runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookReportFluxSource(ctx context.Context, forceBranch string). // Why: exposes flux source logging/diagnostic internals to top-level tests. func (o *Orchestrator) TestHookReportFluxSource(ctx context.Context, forceBranch string) { o.reportFluxSource(ctx, forceBranch) } // TestHookGuardFluxSourceDrift runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookGuardFluxSourceDrift(ctx context.Context, expectedBranch string, allowBranchPatch bool) error. // Why: exposes flux source drift guard internals to the top-level testing module. func (o *Orchestrator) TestHookGuardFluxSourceDrift(ctx context.Context, expectedBranch string, allowBranchPatch bool) error { return o.guardFluxSourceDrift(ctx, expectedBranch, allowBranchPatch) } // TestHookEnsureFluxBranch runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookEnsureFluxBranch(ctx context.Context, branch string, allowPatch bool) error. // Why: exposes flux branch ensure logic to top-level tests. func (o *Orchestrator) TestHookEnsureFluxBranch(ctx context.Context, branch string, allowPatch bool) error { return o.ensureFluxBranch(ctx, branch, allowPatch) } // TestHookBootstrapLocal runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookBootstrapLocal(ctx context.Context) error. // Why: exposes local bootstrap internals to top-level tests. func (o *Orchestrator) TestHookBootstrapLocal(ctx context.Context) error { return o.bootstrapLocal(ctx) } // TestHookApplyKustomizeFallback runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookApplyKustomizeFallback(ctx context.Context, full string) error. // Why: exposes fallback render/apply path to top-level tests. func (o *Orchestrator) TestHookApplyKustomizeFallback(ctx context.Context, full string) error { return o.applyKustomizeFallback(ctx, full) } // TestHookSyncLocalIACRepo runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookSyncLocalIACRepo(ctx context.Context) error. // Why: exposes local IAC sync internals to top-level tests. func (o *Orchestrator) TestHookSyncLocalIACRepo(ctx context.Context) error { return o.syncLocalIACRepo(ctx) } // TestHookRefreshBootstrapCache runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookRefreshBootstrapCache(ctx context.Context) error. // Why: exposes bootstrap cache render internals to top-level tests. func (o *Orchestrator) TestHookRefreshBootstrapCache(ctx context.Context) error { return o.refreshBootstrapCache(ctx) } // TestHookApplyBootstrapCache runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookApplyBootstrapCache(ctx context.Context, rel string) error. // Why: exposes cache apply internals to top-level tests. func (o *Orchestrator) TestHookApplyBootstrapCache(ctx context.Context, rel string) error { return o.applyBootstrapCache(ctx, rel) } // TestHookBootstrapCachePath runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookBootstrapCachePath(rel string) string. // Why: exposes bootstrap cache naming to top-level tests. func (o *Orchestrator) TestHookBootstrapCachePath(rel string) string { return o.bootstrapCachePath(rel) } // TestHookWaitForFluxSourceReady runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForFluxSourceReady(ctx context.Context, window time.Duration) (bool, error). // Why: exposes flux source readiness wait internals to top-level tests. func (o *Orchestrator) TestHookWaitForFluxSourceReady(ctx context.Context, window time.Duration) (bool, error) { return o.waitForFluxSourceReady(ctx, window) } // TestHookNormalizeGitURL runs one orchestration or CLI step. // Signature: TestHookNormalizeGitURL(raw string) string. // Why: exposes URL normalization helper to top-level tests. func TestHookNormalizeGitURL(raw string) string { return normalizeGitURL(raw) } // TestHookGuardPeerStartupIntents runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookGuardPeerStartupIntents(ctx context.Context) error. // Why: exposes peer intent guard internals to top-level tests. func (o *Orchestrator) TestHookGuardPeerStartupIntents(ctx context.Context) error { return o.guardPeerStartupIntents(ctx) } // TestHookReadRemotePeerStatus runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookReadRemotePeerStatus(ctx context.Context, node string) (remotePeerStatus, error). // Why: exposes peer status parser internals to top-level tests. func (o *Orchestrator) TestHookReadRemotePeerStatus(ctx context.Context, node string) (remotePeerStatus, error) { return o.readRemotePeerStatus(ctx, node) } // TestHookClearRemotePeerIntent runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookClearRemotePeerIntent(ctx context.Context, node string, reason string) error. // Why: exposes remote intent clear internals to top-level tests. func (o *Orchestrator) TestHookClearRemotePeerIntent(ctx context.Context, node string, reason string) error { return o.clearRemotePeerIntent(ctx, node, reason) } // TestHookVerifyEtcdSnapshot runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookVerifyEtcdSnapshot(ctx context.Context, node string, snapshotPath string) error. // Why: exposes etcd snapshot verification internals to top-level tests. func (o *Orchestrator) TestHookVerifyEtcdSnapshot(ctx context.Context, node string, snapshotPath string) error { return o.verifyEtcdSnapshot(ctx, node, snapshotPath) } // TestHookControlPlaneUsesExternalDatastore runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookControlPlaneUsesExternalDatastore(ctx context.Context, node string) (bool, error). // Why: exposes datastore-mode detector internals to top-level tests. func (o *Orchestrator) TestHookControlPlaneUsesExternalDatastore(ctx context.Context, node string) (bool, error) { return o.controlPlaneUsesExternalDatastore(ctx, node) } // TestHookWaitForAPI runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForAPI(ctx context.Context, attempts int, sleep time.Duration) error. // Why: exposes API wait internals to top-level tests. func (o *Orchestrator) TestHookWaitForAPI(ctx context.Context, attempts int, sleep time.Duration) error { return o.waitForAPI(ctx, attempts, sleep) } // TestHookWaitForFluxHealth runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForFluxHealth(ctx context.Context) error. // Why: exposes flux-health gate internals to top-level tests. func (o *Orchestrator) TestHookWaitForFluxHealth(ctx context.Context) error { return o.waitForFluxHealth(ctx) } // TestHookFluxHealthReady runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookFluxHealthReady(ctx context.Context) (bool, string, error). // Why: exposes flux-health poll internals to top-level tests. func (o *Orchestrator) TestHookFluxHealthReady(ctx context.Context) (bool, string, error) { return o.fluxHealthReady(ctx) } // TestHookAdaptiveFluxHealthWait runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookAdaptiveFluxHealthWait(ctx context.Context, base time.Duration) (time.Duration, string, error). // Why: exposes adaptive flux wait-window logic to top-level tests. func (o *Orchestrator) TestHookAdaptiveFluxHealthWait(ctx context.Context, base time.Duration) (time.Duration, string, error) { return o.adaptiveFluxHealthWait(ctx, base) } // TestHookHealImmutableFluxJobs runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookHealImmutableFluxJobs(ctx context.Context) (bool, error). // Why: exposes immutable-job self-heal internals to top-level tests. func (o *Orchestrator) TestHookHealImmutableFluxJobs(ctx context.Context) (bool, error) { return o.healImmutableFluxJobs(ctx) } // TestHookWaitForStorageReady runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForStorageReady(ctx context.Context) error. // Why: exposes storage readiness gate internals to top-level tests. func (o *Orchestrator) TestHookWaitForStorageReady(ctx context.Context) error { return o.waitForStorageReady(ctx) } // TestHookStorageReady runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookStorageReady(ctx context.Context) (bool, string, error). // Why: exposes storage readiness poll internals to top-level tests. func (o *Orchestrator) TestHookStorageReady(ctx context.Context) (bool, string, error) { return o.storageReady(ctx) } // TestHookWaitForTimeSync runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForTimeSync(ctx context.Context, nodes []string) error. // Why: exposes time-sync gate internals to top-level tests. func (o *Orchestrator) TestHookWaitForTimeSync(ctx context.Context, nodes []string) error { return o.waitForTimeSync(ctx, nodes) } // TestHookPreflightExternalDatastore runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookPreflightExternalDatastore(ctx context.Context) error. // Why: exposes datastore preflight internals to top-level tests. func (o *Orchestrator) TestHookPreflightExternalDatastore(ctx context.Context) error { return o.preflightExternalDatastore(ctx) } // TestHookParseDatastoreEndpoint runs one orchestration or CLI step. // Signature: TestHookParseDatastoreEndpoint(unitText string) string. // Why: exposes datastore endpoint parsing helper to top-level tests. func TestHookParseDatastoreEndpoint(unitText string) string { return parseDatastoreEndpoint(unitText) } // TestHookNodeNameForHost runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookNodeNameForHost(host string) string. // Why: exposes host-to-node mapping helper to top-level tests. func (o *Orchestrator) TestHookNodeNameForHost(host string) string { return o.nodeNameForHost(host) } // TestHookValidateNodeInventory runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookValidateNodeInventory() error. // Why: exposes inventory validator internals to top-level tests. func (o *Orchestrator) TestHookValidateNodeInventory() error { return o.validateNodeInventory() } // TestHookTCPReachable runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookTCPReachable(address string, timeout time.Duration) bool. // Why: exposes TCP reachability helper to top-level tests. func (o *Orchestrator) TestHookTCPReachable(address string, timeout time.Duration) bool { return o.tcpReachable(address, timeout) } // TestHookWaitForNodeInventoryReachability runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookWaitForNodeInventoryReachability(ctx context.Context) error. // Why: exposes inventory reachability gate internals to top-level tests. func (o *Orchestrator) TestHookWaitForNodeInventoryReachability(ctx context.Context) error { return o.waitForNodeInventoryReachability(ctx) } // TestHookIntentAge runs one orchestration or CLI step. // Signature: TestHookIntentAge(in state.Intent) time.Duration. // Why: exposes startup coordination age helper to top-level tests. func TestHookIntentAge(in state.Intent) time.Duration { return intentAge(in) } // TestHookIntentFresh runs one orchestration or CLI step. // Signature: TestHookIntentFresh(in state.Intent, maxAge time.Duration) bool. // Why: exposes startup coordination freshness helper to top-level tests. func TestHookIntentFresh(in state.Intent, maxAge time.Duration) bool { return intentFresh(in, maxAge) } // TestHookCoordinationPeers runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookCoordinationPeers() []string. // Why: exposes peer list normalizer helper to top-level tests. func (o *Orchestrator) TestHookCoordinationPeers() []string { return o.coordinationPeers() } // TestHookNormalizeShutdownMode runs one orchestration or CLI step. // Signature: TestHookNormalizeShutdownMode(raw string) (string, error). // Why: exposes shutdown mode parser helper to top-level tests. func TestHookNormalizeShutdownMode(raw string) (string, error) { return normalizeShutdownMode(raw) } // TestHookParseFluxKustomizationTimeout runs one orchestration or CLI step. // Signature: TestHookParseFluxKustomizationTimeout(raw string) time.Duration. // Why: exposes flux timeout parser helper to top-level tests. func TestHookParseFluxKustomizationTimeout(raw string) time.Duration { return parseFluxKustomizationTimeout(raw) } // TestHookLooksLikeImmutableJobError runs one orchestration or CLI step. // Signature: TestHookLooksLikeImmutableJobError(detail string) bool. // Why: exposes immutable-job detector helper to top-level tests. func TestHookLooksLikeImmutableJobError(detail string) bool { return looksLikeImmutableJobError(detail) } // TestHookJobLooksFluxManaged runs one orchestration or CLI step. // Signature: TestHookJobLooksFluxManaged(namespace string, name string, labels map[string]string, ownerKinds []string) bool. // Why: exposes flux-job ownership helper to top-level tests. func TestHookJobLooksFluxManaged(namespace string, name string, labels map[string]string, ownerKinds []string) bool { var job jobResource job.Metadata.Namespace = namespace job.Metadata.Name = name job.Metadata.Labels = labels for _, kind := range ownerKinds { job.Metadata.OwnerReferences = append(job.Metadata.OwnerReferences, ownerReference{Kind: kind}) } return jobLooksFluxManaged(job) } // TestHookJobFailed runs one orchestration or CLI step. // Signature: TestHookJobFailed(failed int32, succeeded int32, conditionTypes []string, conditionStatuses []string) bool. // Why: exposes failed-job detector helper to top-level tests. func TestHookJobFailed(failed int32, succeeded int32, conditionTypes []string, conditionStatuses []string) bool { var job jobResource job.Status.Failed = failed job.Status.Succeeded = succeeded for i := range conditionTypes { status := "" if i < len(conditionStatuses) { status = conditionStatuses[i] } job.Status.Conditions = append(job.Status.Conditions, jobConditionRef{ Type: conditionTypes[i], Status: status, }) } return jobFailed(job) } // TestHookEstimatedShutdownSeconds runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookEstimatedShutdownSeconds() int. // Why: exposes shutdown estimate helper to top-level tests. func (o *Orchestrator) TestHookEstimatedShutdownSeconds() int { return o.EstimatedShutdownSeconds() } // TestHookEstimatedEmergencyShutdownSeconds runs one orchestration or CLI step. // Signature: (o *Orchestrator) TestHookEstimatedEmergencyShutdownSeconds() int. // Why: exposes emergency shutdown estimate helper to top-level tests. func (o *Orchestrator) TestHookEstimatedEmergencyShutdownSeconds() int { return o.EstimatedEmergencyShutdownSeconds() } // TestHookSanitizeReportFileName runs one orchestration or CLI step. // Signature: TestHookSanitizeReportFileName(value string) string. // Why: exposes report filename sanitizer helper to top-level tests. func TestHookSanitizeReportFileName(value string) string { return sanitizeReportFileName(value) } // TestHookIsTimeSynced runs one orchestration or CLI step. // Signature: TestHookIsTimeSynced(raw string) bool. // Why: exposes NTP synchronization parser helper to top-level tests. func TestHookIsTimeSynced(raw string) bool { return isTimeSynced(raw) }