fix: route call accept across pods
This commit is contained in:
+25
-9
@@ -201,14 +201,19 @@ type testFavoritesStore struct {
|
||||
}
|
||||
|
||||
type testCallsStore struct {
|
||||
items []types.CallRecord
|
||||
topic string
|
||||
listed bool
|
||||
tenant types.TenantID
|
||||
user types.Uid
|
||||
limit int
|
||||
cursor string
|
||||
next string
|
||||
items []types.CallRecord
|
||||
topic string
|
||||
listed bool
|
||||
tenant types.TenantID
|
||||
user types.Uid
|
||||
limit int
|
||||
cursor string
|
||||
next string
|
||||
accepted bool
|
||||
acceptTenant types.TenantID
|
||||
acceptCallID string
|
||||
acceptSeq int64
|
||||
acceptedAt time.Time
|
||||
}
|
||||
|
||||
type testThirdPartyConfigStore map[string]string
|
||||
@@ -830,7 +835,12 @@ func (s *testCallsStore) Create(_ types.TenantID, _ *types.CallRecord) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *testCallsStore) Accept(_ types.TenantID, _ string, _ int64, _ time.Time) error {
|
||||
func (s *testCallsStore) Accept(tenantID types.TenantID, callID string, seq int64, acceptedAt time.Time) error {
|
||||
s.accepted = true
|
||||
s.acceptTenant = tenantID
|
||||
s.acceptCallID = callID
|
||||
s.acceptSeq = seq
|
||||
s.acceptedAt = acceptedAt
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6300,6 +6310,9 @@ func TestServeIMCallRTCJoinReturnsSameAgoraChannelForCallee(t *testing.T) {
|
||||
if callerRec.Code != http.StatusOK {
|
||||
t.Fatalf("caller rtc join status: got %d body=%s", callerRec.Code, callerRec.Body.String())
|
||||
}
|
||||
if calls.accepted {
|
||||
t.Fatal("caller rtc join must not auto-accept the call")
|
||||
}
|
||||
|
||||
calleeReq := httptest.NewRequest(http.MethodPost, "/v1/im/calls/rtc-join", strings.NewReader(`{"topic":"`+topic+`","call_id":"call-1","seq":12,"call_type":"audio","role":"callee"}`))
|
||||
calleeReq.Header.Set("Authorization", "Bearer token-callee")
|
||||
@@ -6308,6 +6321,9 @@ func TestServeIMCallRTCJoinReturnsSameAgoraChannelForCallee(t *testing.T) {
|
||||
if calleeRec.Code != http.StatusOK {
|
||||
t.Fatalf("callee rtc join status: got %d body=%s", calleeRec.Code, calleeRec.Body.String())
|
||||
}
|
||||
if !calls.accepted || calls.acceptTenant != 7 || calls.acceptCallID != "call-1" || calls.acceptSeq != 12 || calls.acceptedAt.IsZero() {
|
||||
t.Fatalf("callee rtc join did not mark call accepted: %#v", calls)
|
||||
}
|
||||
|
||||
callerData := decodeIMHTTPResponse(t, callerRec).Data.(map[string]any)
|
||||
calleeData := decodeIMHTTPResponse(t, calleeRec).Data.(map[string]any)
|
||||
|
||||
Reference in New Issue
Block a user