27 lines
962 B
Go
27 lines
962 B
Go
package store
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestCurrentPendingCountPausesOnlyAffectedTaskQueue(t *testing.T) {
|
|
s := preparedCurrentCallStore(t)
|
|
cmd := currentCall("waiting-for-task-window")
|
|
if _, _, err := s.RecordExecute(cmd); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if count, err := s.PendingExecuteCount(currentDispatcherID, 1001, "task-asr"); err != nil || count != 1 {
|
|
t.Fatalf("durable wait not counted: %d %v", count, err)
|
|
}
|
|
if count, err := s.PendingExecuteCount(currentDispatcherID, 1001, "another-task"); err != nil || count != 0 {
|
|
t.Fatalf("unrelated task queue was paused: %d %v", count, err)
|
|
}
|
|
if err := s.ReserveExecute(cmd.DispatcherID, cmd.EventID, currentReservation(), time.Date(2026, 9, 21, 1, 30, 0, 0, time.UTC)); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if count, err := s.PendingExecuteCount(currentDispatcherID, 1001, "task-asr"); err != nil || count != 0 {
|
|
t.Fatalf("reserved command still blocked its queue: %d %v", count, err)
|
|
}
|
|
}
|