MCPcopy
hub / github.com/livekit/livekit / TestUpdateSettingsBeforeSubscription

Function TestUpdateSettingsBeforeSubscription

pkg/rtc/subscriptionmanager_test.go:320–349  ·  view source on GitHub ↗

clients may send update subscribed settings prior to subscription events coming through settings should be persisted and used when the subscription does take place.

(t *testing.T)

Source from the content-addressed store, hash-verified

318// clients may send update subscribed settings prior to subscription events coming through
319// settings should be persisted and used when the subscription does take place.
320func TestUpdateSettingsBeforeSubscription(t *testing.T) {
321 sm := newTestSubscriptionManager()
322 defer sm.Close(false)
323 resolver := newTestResolver(true, true, "pub", "pubID")
324 sm.params.TrackResolver = resolver.Resolve
325
326 settings := &livekit.UpdateTrackSettings{
327 Disabled: true,
328 Width: 100,
329 Height: 100,
330 }
331 sm.UpdateSubscribedTrackSettings("track", settings)
332
333 sm.SubscribeToTrack("track", false)
334
335 s := sm.subscriptions["track"]
336 require.Eventually(t, func() bool {
337 return !s.needsSubscribe()
338 }, subSettleTimeout, subCheckInterval, "Track should be subscribed")
339
340 st := s.getSubscribedTrack().(*typesfakes.FakeSubscribedTrack)
341 require.Eventually(t, func() bool {
342 return st.UpdateSubscriberSettingsCallCount() == 1
343 }, subSettleTimeout, subCheckInterval, "UpdateSubscriberSettings should be called once")
344
345 applied, _ := st.UpdateSubscriberSettingsArgsForCall(0)
346 require.Equal(t, settings.Disabled, applied.Disabled)
347 require.Equal(t, settings.Width, applied.Width)
348 require.Equal(t, settings.Height, applied.Height)
349}
350
351func TestSubscriptionLimits(t *testing.T) {
352 sm := newTestSubscriptionManagerWithParams(testSubscriptionParams{

Callers

nothing calls this directly

Calls 9

newTestResolverFunction · 0.85
CloseMethod · 0.65
SubscribeToTrackMethod · 0.65
needsSubscribeMethod · 0.45
getSubscribedTrackMethod · 0.45

Tested by

no test coverage detected