Implemented atomic session replacement.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user