fix: query tenant-sharded private messages
Deploy im-server production / deploy (push) Successful in 7m7s
Deploy im-server production / deploy (push) Successful in 7m7s
This commit is contained in:
@@ -72,6 +72,19 @@ func TestMessageQuerySpecsExposeAdminFields(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrivateMessageQueryUsesTenantShardTables(t *testing.T) {
|
||||
spec := privateMessagesInternalQuerySpecForTenant(types.TenantID(9))
|
||||
query := strings.ToLower(spec.From)
|
||||
for _, table := range []string{"im_009_messages", "im_009_subscriptions"} {
|
||||
if !strings.Contains(query, table) {
|
||||
t.Fatalf("private message query must use tenant shard table %q: %s", table, query)
|
||||
}
|
||||
}
|
||||
if strings.Contains(query, "from im_messages ") || strings.Contains(query, "from im_subscriptions ") {
|
||||
t.Fatalf("private message query must not use legacy shared tables: %s", query)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupMessageQuerySupportsOperationalFilters(t *testing.T) {
|
||||
req := httptest.NewRequest("GET", "/?seq_id=42&sender_username=alice&sender_nickname=%E5%B0%8F%E6%98%8E&group_name=%E6%B5%8B%E8%AF%95%E7%BE%A4", nil)
|
||||
query, _, args, _, _, err := buildInternalAdminListQuery(req, groupMessagesInternalQuerySpec(), "", types.TenantID(1))
|
||||
|
||||
Reference in New Issue
Block a user