feat: complete Windows client control and recovery paths
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
rvboxv1 "github.com/rvbox/rvbox/gen/go/rvbox/v1"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func TestGlobalSocketAndCLIValueParsing_HP_CTL_11(t *testing.T) {
|
||||
@@ -47,3 +49,32 @@ func TestGlobalRequestIDIsInjectedOnlyForMutations_HP_CTL_12(t *testing.T) {
|
||||
t.Fatal("duplicate global request IDs accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderCommandStatShowsExpiryRetentionAndWindowsIdentity_HP_CTL_13(t *testing.T) {
|
||||
t.Parallel()
|
||||
expiry := time.Date(2026, 9, 6, 12, 0, 0, 0, time.UTC)
|
||||
sessionID := uint32(7)
|
||||
effective := rvboxv1.WindowsExecutionContext_WINDOWS_EXECUTION_CONTEXT_ACTIVE_SYSTEM
|
||||
var output bytes.Buffer
|
||||
renderCommandStat(&output, &rvboxv1.CommandRecord{
|
||||
IssueUuid: "019c46f1-1d02-7000-8000-0000000000f2", TargetClientId: "win-a",
|
||||
Lifecycle: rvboxv1.CommandLifecycle_COMMAND_SUCCEEDED, CommandRevision: 3,
|
||||
LastEventSeq: 9, QueueExpiryTime: timestamppb.New(expiry), OutputIncomplete: true,
|
||||
OutputTruncated: true, RetainedCompressedBytes: 1234, LateAfterExpiry: true,
|
||||
WindowsExecutionIdentity: &rvboxv1.WindowsExecutionIdentity{
|
||||
EffectiveContext: &effective, SessionId: &sessionID, EffectiveUserSid: "S-1-5-18",
|
||||
SessionUserSid: "S-1-5-21-user", AttemptedContexts: []rvboxv1.WindowsExecutionContext{
|
||||
rvboxv1.WindowsExecutionContext_WINDOWS_EXECUTION_CONTEXT_ACTIVE_USER_ELEVATED, effective,
|
||||
}, SelectionDetail: "fallback\nused",
|
||||
},
|
||||
}, expiry.Add(time.Minute))
|
||||
for _, want := range []string{
|
||||
"queue_expired=true", "late_after_expiry=true", "output_truncated=true", "output_incomplete=true",
|
||||
"retained_compressed_bytes=1234", "windows_attempted_contexts=active-user-elevated,active-system",
|
||||
"windows_effective_context=active-system", "windows_session_id=7", "windows_selection_detail=fallback\\nused",
|
||||
} {
|
||||
if !bytes.Contains(output.Bytes(), []byte(want)) {
|
||||
t.Errorf("stat output missing %q:\n%s", want, output.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user