(t *testing.T)
| 823 | } |
| 824 | |
| 825 | func TestSingleNodeAttributes(t *testing.T) { |
| 826 | if testing.Short() { |
| 827 | t.SkipNow() |
| 828 | return |
| 829 | } |
| 830 | _, finish := setupSingleNodeTest("TestSingleNodeAttributes") |
| 831 | defer finish() |
| 832 | |
| 833 | for _, testRTCServicePath := range testRTCServicePaths { |
| 834 | t.Run(fmt.Sprintf("testRTCServicePath=%s", testRTCServicePath.String()), func(t *testing.T) { |
| 835 | pub := createRTCClient("pub", defaultServerPort, testRTCServicePath, &testclient.Options{ |
| 836 | Attributes: map[string]string{ |
| 837 | "b": "2", |
| 838 | "c": "3", |
| 839 | }, |
| 840 | TokenCustomizer: func(token *auth.AccessToken, grants *auth.VideoGrant) { |
| 841 | T := true |
| 842 | grants.CanUpdateOwnMetadata = &T |
| 843 | token.SetAttributes(map[string]string{ |
| 844 | "a": "0", |
| 845 | "b": "1", |
| 846 | }) |
| 847 | }, |
| 848 | }) |
| 849 | |
| 850 | grant := &auth.VideoGrant{RoomJoin: true, Room: testRoom} |
| 851 | grant.SetCanSubscribe(false) |
| 852 | at := auth.NewAccessToken(testApiKey, testApiSecret). |
| 853 | SetVideoGrant(grant). |
| 854 | SetIdentity("sub") |
| 855 | token, err := at.ToJWT() |
| 856 | require.NoError(t, err) |
| 857 | sub := createRTCClientWithToken(token, defaultServerPort, testRTCServicePath, nil) |
| 858 | |
| 859 | waitUntilConnected(t, pub, sub) |
| 860 | |
| 861 | // wait sub receives initial attributes |
| 862 | testutils.WithTimeout(t, func() string { |
| 863 | pubRemote := sub.GetRemoteParticipant(pub.ID()) |
| 864 | if pubRemote == nil { |
| 865 | return "could not find remote publisher" |
| 866 | } |
| 867 | attrs := pubRemote.Attributes |
| 868 | if !reflect.DeepEqual(attrs, map[string]string{ |
| 869 | "a": "0", |
| 870 | "b": "2", |
| 871 | "c": "3", |
| 872 | }) { |
| 873 | return fmt.Sprintf("did not receive expected attributes: %v", attrs) |
| 874 | } |
| 875 | return "" |
| 876 | }) |
| 877 | }) |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | // TestDeviceCodecOverride checks that codecs that are incompatible with a device is not |
| 882 | // negotiated by the server |
nothing calls this directly
no test coverage detected