(t *testing.T)
| 188 | } |
| 189 | |
| 190 | func TestAgentMultiNode(t *testing.T) { |
| 191 | for _, testRTCServicePath := range testRTCServicePaths { |
| 192 | t.Run(fmt.Sprintf("testRTCServicePath=%s", testRTCServicePath.String()), func(t *testing.T) { |
| 193 | _, _, finish := setupMultiNodeTest("TestAgentMultiNode") |
| 194 | defer finish() |
| 195 | |
| 196 | ac1, err := newAgentClient(agentToken(), defaultServerPort) |
| 197 | require.NoError(t, err) |
| 198 | ac2, err := newAgentClient(agentToken(), defaultServerPort) |
| 199 | require.NoError(t, err) |
| 200 | defer ac1.close() |
| 201 | defer ac2.close() |
| 202 | ac1.Run(livekit.JobType_JT_ROOM, "default") |
| 203 | ac2.Run(livekit.JobType_JT_PUBLISHER, "default") |
| 204 | |
| 205 | testutils.WithTimeout(t, func() string { |
| 206 | if ac1.registered.Load() != 1 || ac2.registered.Load() != 1 { |
| 207 | return "worker not registered" |
| 208 | } |
| 209 | return "" |
| 210 | }, RegisterTimeout) |
| 211 | |
| 212 | c1 := createRTCClient("c1", secondServerPort, testRTCServicePath, nil) // Create a room on the second node |
| 213 | waitUntilConnected(t, c1) |
| 214 | |
| 215 | t1, err := c1.AddStaticTrack("audio/opus", "audio", "micro") |
| 216 | require.NoError(t, err) |
| 217 | defer t1.Stop() |
| 218 | |
| 219 | time.Sleep(time.Second * 10) |
| 220 | |
| 221 | testutils.WithTimeout(t, func() string { |
| 222 | if ac1.roomJobs.Load() != 1 { |
| 223 | return "room job not assigned" |
| 224 | } |
| 225 | |
| 226 | if ac2.publisherJobs.Load() != 1 { |
| 227 | return "participant job not assigned" |
| 228 | } |
| 229 | |
| 230 | return "" |
| 231 | }, AssignJobTimeout) |
| 232 | }) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | func agentToken() string { |
| 237 | at := auth.NewAccessToken(testApiKey, testApiSecret). |
nothing calls this directly
no test coverage detected