perf(cmpp): add durable inbound fast path
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package inbound
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestInboundSubmitRequestIDIsStableForRetry(t *testing.T) {
|
||||
fragment := &inboundLongMessageFragment{Reference: 7, Total: 2, Index: 1, Format: 8}
|
||||
first := inboundSubmitRequestID("connection-1", 42, []string{"13800000001"}, "【测试】内容", "1069", fragment)
|
||||
second := inboundSubmitRequestID("connection-1", 42, []string{"13800000001"}, "【测试】内容", "1069", fragment)
|
||||
if first != second {
|
||||
t.Fatalf("retry key changed: %q != %q", first, second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInboundSubmitRequestIDSeparatesPayloadAndSession(t *testing.T) {
|
||||
base := inboundSubmitRequestID("connection-1", 42, []string{"13800000001"}, "content", "1069", nil)
|
||||
cases := []string{
|
||||
inboundSubmitRequestID("connection-2", 42, []string{"13800000001"}, "content", "1069", nil),
|
||||
inboundSubmitRequestID("connection-1", 43, []string{"13800000001"}, "content", "1069", nil),
|
||||
inboundSubmitRequestID("connection-1", 42, []string{"13800000002"}, "content", "1069", nil),
|
||||
inboundSubmitRequestID("connection-1", 42, []string{"13800000001"}, "other", "1069", nil),
|
||||
}
|
||||
for _, candidate := range cases {
|
||||
if candidate == base {
|
||||
t.Fatalf("different submit produced duplicate key %q", base)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user