feat: shard group messages by month

This commit is contained in:
richjohnrambo
2026-09-15 23:53:51 +08:00
parent b7c2536527
commit 139681fadb
25 changed files with 1718 additions and 247 deletions
+15
View File
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/tinode/chat/server/store"
@@ -18,6 +19,20 @@ func (internalAdminQueryNotFound) Query(types.TenantID, string, string, []any, i
return nil, types.ErrNotFound
}
func TestClaimInternalNonceRejectsReplay(t *testing.T) {
oldConfig := internalAPI.config
internalAPI = internalAPIRuntime{config: oldConfig}
defer func() { internalAPI = internalAPIRuntime{config: oldConfig} }()
expiresAt := time.Now().Add(time.Minute)
if !claimInternalNonce("manager-test", "single-use-nonce", "request-claim", expiresAt) {
t.Fatal("first nonce claim was rejected")
}
if claimInternalNonce("manager-test", "single-use-nonce", "request-claim", expiresAt) {
t.Fatal("replayed nonce was accepted")
}
}
func (internalAdminQueryNotFound) QueryOne(types.TenantID, string, []any) (map[string]any, error) {
return nil, types.ErrNotFound
}