fix: reject unrouted messages without seq
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/tinode/chat/server/store"
|
||||
types "github.com/tinode/chat/server/store/types"
|
||||
)
|
||||
|
||||
@@ -75,6 +76,21 @@ func TestGroupMessageShardTableRejectsUnsafeMonth(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupMessageShardTablesForSeqFiltersRoutes(t *testing.T) {
|
||||
routes := []store.GroupMessageShardRoute{
|
||||
{Month: "202608", MinSeq: 1, MaxSeq: 20},
|
||||
{Month: "202609", MinSeq: 21, MaxSeq: 100},
|
||||
{Month: "202613", MinSeq: 1, MaxSeq: 1000},
|
||||
}
|
||||
tables := groupMessageShardTablesForSeq(7, routes, 23)
|
||||
if len(tables) != 1 || tables[0] != "im_007_group_messages_202609" {
|
||||
t.Fatalf("unexpected shard tables for seq: %#v", tables)
|
||||
}
|
||||
if tables = groupMessageShardTablesForSeq(7, routes, 101); len(tables) != 0 {
|
||||
t.Fatalf("unexpected shard tables for uncovered seq: %#v", tables)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTenantPartitionTableNames(t *testing.T) {
|
||||
tests := []struct {
|
||||
tenantID types.TenantID
|
||||
|
||||
Reference in New Issue
Block a user