MCPcopy
hub / github.com/livekit/livekit / TestMultiNodeDataBlob

Function TestMultiNodeDataBlob

test/multinode_test.go:430–554  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

428}
429
430func TestMultiNodeDataBlob(t *testing.T) {
431 if testing.Short() {
432 t.SkipNow()
433 return
434 }
435
436 _, _, finish := setupMultiNodeTestWithConfig("TestMultiNodeDataBlob", func(c *config.Config) {
437 c.EnableParticipantDataBlob = true
438 c.Limit.MaxDataBlobSize = 1024
439 })
440 defer finish()
441
442 for _, testRTCServicePath := range testRTCServicePaths {
443 t.Run(fmt.Sprintf("testRTCServicePath=%s", testRTCServicePath.String()), func(t *testing.T) {
444 pubCapture := &dataBlobCapture{}
445 subCapture := &dataBlobCapture{}
446
447 // publisher on node 1, subscriber on node 2
448 pub := createRTCClient("pub", defaultServerPort, testRTCServicePath, &client.Options{
449 AutoSubscribe: true,
450 SignalResponseInterceptor: pubCapture.interceptor(),
451 })
452 sub := createRTCClient("sub", secondServerPort, testRTCServicePath, &client.Options{
453 AutoSubscribe: true,
454 SignalResponseInterceptor: subCapture.interceptor(),
455 })
456 waitUntilConnected(t, pub, sub)
457 defer stopClients(pub, sub)
458
459 // wait for both nodes to see each other so the get request routes correctly
460 testutils.WithTimeout(t, func() string {
461 if sub.GetRemoteParticipant(pub.ID()) == nil {
462 return "sub does not see pub yet"
463 }
464 return ""
465 })
466
467 key := &livekit.DataBlobKey{
468 Key: &livekit.DataBlobKey_Generic{
469 Generic: "blob-multinode",
470 },
471 }
472 contents := []byte("multinode-content")
473
474 require.NoError(t, pub.SendRequest(&livekit.SignalRequest{
475 Message: &livekit.SignalRequest_StoreDataBlobRequest{
476 StoreDataBlobRequest: &livekit.StoreDataBlobRequest{
477 RequestId: 1,
478 Blob: &livekit.DataBlob{
479 Key: key,
480 Contents: contents,
481 },
482 },
483 },
484 }))
485
486 testutils.WithTimeout(t, func() string {
487 resp := pubCapture.takeStoreResponse()

Callers

nothing calls this directly

Calls 15

interceptorMethod · 0.95
takeStoreResponseMethod · 0.95
requestResponseCountMethod · 0.95
takeBlobResponseMethod · 0.95
takeRequestResponseMethod · 0.95
WithTimeoutFunction · 0.92
createRTCClientFunction · 0.85
waitUntilConnectedFunction · 0.85
stopClientsFunction · 0.85
GetRemoteParticipantMethod · 0.80
SendRequestMethod · 0.80

Tested by

no test coverage detected