fix: handle backend issue list regressions
This commit is contained in:
@@ -4,6 +4,7 @@ package mysql
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -150,3 +151,23 @@ func TestTenantShardSQL(t *testing.T) {
|
||||
t.Fatalf("tenant shard query rewrote index name: %s", query)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSharedDBGroupFileLinkIncludesTenantID(t *testing.T) {
|
||||
source, err := os.ReadFile("tenant_groups.go")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := sourceBetween(t, string(source), "func (a *adapter) TenantGroupFileCreate", "\nfunc (a *adapter) enrichGroupFileFromUpload")
|
||||
for _, required := range []string{
|
||||
"INSERT INTO im_filemsglinks(tenant_id,createdat,fileid,topic)",
|
||||
"SELECT ?,?,?,? WHERE NOT EXISTS",
|
||||
"SELECT 1 FROM im_filemsglinks WHERE tenant_id=? AND fileid=? AND topic=?)",
|
||||
} {
|
||||
if !strings.Contains(body, required) {
|
||||
t.Fatalf("TenantGroupFileCreate shared-db file link must include tenant_id; missing %q", required)
|
||||
}
|
||||
}
|
||||
if strings.Contains(body, "INSERT INTO im_filemsglinks(createdat,fileid,topic)") {
|
||||
t.Fatal("TenantGroupFileCreate must not rely on im_filemsglinks.tenant_id default")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user