Retire obsolete MQ and tenant routing with active identity checks

This commit is contained in:
2026-09-30 11:26:54 +08:00
parent 4228574a41
commit 35e0a3de6c
15 changed files with 94 additions and 1056 deletions
-47
View File
@@ -11,8 +11,6 @@ import (
"testing"
"github.com/santhosh-tekuri/jsonschema/v6"
"git.ipao.vip/rogee/go-sip/internal/tenant"
)
const v1Dir = "upstream/v1"
@@ -171,51 +169,6 @@ func TestV1DispatcherConfigDoesNotAcceptSecretsOrTTLOverride(t *testing.T) {
}
}
func TestV1TopologyMatchesDispatcherRoutes(t *testing.T) {
var topology struct {
Exchanges map[string]struct {
Type string `json:"type"`
Durable bool `json:"durable"`
} `json:"exchanges"`
Inbox string `json:"inbox_queue"`
Dead string `json:"dead_letter_queue"`
Inbound string `json:"inbound_key"`
Outbound string `json:"outbound_key"`
Durable bool `json:"business_queues_durable"`
Persistent bool `json:"message_persistent"`
Mandatory bool `json:"publish_mandatory"`
Confirm bool `json:"publisher_confirms"`
TenantBytes int `json:"tenant_key_max_utf8_bytes"`
TokenSeconds int `json:"upload_token_seconds"`
}
if err := json.Unmarshal(readV1(t, filepath.Join(v1Dir, "mq-topology.json")), &topology); err != nil {
t.Fatal(err)
}
if !topology.Durable || !topology.Persistent || !topology.Mandatory || !topology.Confirm || topology.TenantBytes != 196 || topology.TokenSeconds != 900 {
t.Fatal("topology weakens the approved queue/token boundary")
}
if len(topology.Exchanges) != 3 {
t.Fatal("unexpected exchange topology")
}
for _, name := range []string{"agent-call.dispatchers.v2", "agent-call.saas.v2", "agent-call.dead-letter.v2"} {
x, ok := topology.Exchanges[name]
if !ok || x.Type != "topic" || !x.Durable {
t.Fatalf("wrong exchange contract: %s", name)
}
}
id := "c046b893-8628-4589-ae50-619d049248a6"
for _, key := range []string{"tenant-a", "租户.甲", strings.Repeat("a", 196)} {
route, err := tenant.NewDispatcherRoute(id, key)
if err != nil {
t.Fatal(err)
}
r := strings.NewReplacer("<dispatcher_id>", id, "<tenant_key>", key)
if route.InboxQueue != r.Replace(topology.Inbox) || route.DeadLetterQueue != r.Replace(topology.Dead) || route.InboundKey != r.Replace(topology.Inbound) || route.OutboundKey != r.Replace(topology.Outbound) {
t.Fatal("implementation differs from the published route templates")
}
}
}
func TestV1ManifestPinsEveryBundleFile(t *testing.T) {
var manifest struct {
Version string `json:"version"`