Implemented atomic session replacement.

This commit is contained in:
Dmitry Sergeev
2026-09-01 01:22:03 +03:00
parent e830da4a32
commit 047f334413
6 changed files with 108 additions and 27 deletions
+32
View File
@@ -114,6 +114,27 @@ func TestApplySessionCommand(t *testing.T) {
command: SessionCommand{Kind: CommandDisableSync},
want: func() SessionConfig { c := base; c.SyncRequested = false; return c }(),
},
{
name: "set complete session atomically and preserve retry",
current: base,
command: SessionCommand{
Kind: CommandSetSession,
Session: SessionConfig{
Video: newVideo,
Audio: newAudio,
SyncRequested: false,
Retry: RetryPolicy{
MaxAttempts: 99,
},
},
},
want: SessionConfig{
Video: newVideo,
Audio: newAudio,
SyncRequested: false,
Retry: base.Retry,
},
},
}
for _, tt := range tests {
@@ -157,6 +178,17 @@ func TestApplySessionCommandFailurePreservesState(t *testing.T) {
ErrAudioNotConfigured,
},
{"unknown command", base, SessionCommand{Kind: 255}, ErrUnknownSessionCommand},
{
"invalid complete session",
base,
SessionCommand{
Kind: CommandSetSession,
Session: SessionConfig{
Video: FeedConfig{UUID: "video", Active: true},
},
},
ErrFeedDomainRequired,
},
}
for _, tt := range tests {