fix: harden channel retry attribution and operations UI
This commit is contained in:
@@ -79,6 +79,7 @@ type Retry struct {
|
||||
|
||||
type SubmitResult struct {
|
||||
Envelope
|
||||
SubmitID string `json:"submitId"`
|
||||
SequenceID uint32 `json:"sequenceId"`
|
||||
GatewayMessageID string `json:"gatewayMessageId"`
|
||||
SubmitStatus string `json:"submitStatus"`
|
||||
|
||||
@@ -67,3 +67,20 @@ func TestSubmitCommandUnmarshalsQueuePriority(t *testing.T) {
|
||||
t.Fatalf("unexpected extension digits: %d", command.CMPP.ExtensionDigits)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubmitResultMarshalsSubmitID(t *testing.T) {
|
||||
payload, err := json.Marshal(SubmitResult{SubmitID: "submit-1"})
|
||||
if err != nil {
|
||||
t.Fatalf("marshal submit result: %v", err)
|
||||
}
|
||||
if string(payload) == "" || !json.Valid(payload) {
|
||||
t.Fatalf("invalid submit result JSON: %s", payload)
|
||||
}
|
||||
var decoded map[string]any
|
||||
if err := json.Unmarshal(payload, &decoded); err != nil {
|
||||
t.Fatalf("unmarshal submit result: %v", err)
|
||||
}
|
||||
if decoded["submitId"] != "submit-1" {
|
||||
t.Fatalf("submitId = %v, want submit-1", decoded["submitId"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1284,6 +1284,7 @@ func submitResult(cmd queue.SubmitCommand, sequenceID uint32, gatewayMessageID s
|
||||
ChannelID: cmd.ChannelID,
|
||||
CreatedAt: time.Now().UTC(),
|
||||
},
|
||||
SubmitID: cmd.SubmitID,
|
||||
SequenceID: sequenceID,
|
||||
GatewayMessageID: gatewayMessageID,
|
||||
SubmitStatus: status,
|
||||
|
||||
@@ -41,6 +41,20 @@ func TestSubmitRequestPacketUsesCMPP2PacketForCMPP20Channel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubmitResultKeepsCommandSubmitID(t *testing.T) {
|
||||
cmd := submitCommandForPacketTest("2.0")
|
||||
cmd.SubmitID = "submit-attempt-2"
|
||||
|
||||
result := submitResult(cmd, 42, "9001", "accepted", "", "")
|
||||
|
||||
if result.SubmitID != cmd.SubmitID {
|
||||
t.Fatalf("SubmitID = %q, want %q", result.SubmitID, cmd.SubmitID)
|
||||
}
|
||||
if result.ChannelID != cmd.ChannelID || result.MessageID != cmd.MessageID {
|
||||
t.Fatalf("unexpected result envelope: %+v", result.Envelope)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubmitRequestPacketUsesCMPP3PacketForCMPP30Channel(t *testing.T) {
|
||||
conn := &connection{config: queue.UpstreamConfig{CMPPVersion: "3.0", Account: "ljcs02"}}
|
||||
cmd := submitCommandForPacketTest("3.0")
|
||||
|
||||
Reference in New Issue
Block a user