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)
| 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. |
| 320 | func 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 | |
| 351 | func TestSubscriptionLimits(t *testing.T) { |
| 352 | sm := newTestSubscriptionManagerWithParams(testSubscriptionParams{ |
nothing calls this directly
no test coverage detected