Fix monitor collect-now queue fairness
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@@ -153,6 +154,29 @@ func TestCollectNowDispatchTargetClientIDsDeduplicatesByPlatformOrder(t *testing
|
||||
assert.Equal(t, []uuid.UUID{sharedClientID, qwenClientID}, targets)
|
||||
}
|
||||
|
||||
func TestEnqueueCollectNowOutboxDoesNotInterruptActiveTasks(t *testing.T) {
|
||||
ctx := t.Context()
|
||||
targetClientID := mustParseDailyMonitoringUUID(t, "00000000-0000-0000-0000-000000000503")
|
||||
tx := &captureDailyMonitorTaskTx{commandTag: pgconn.NewCommandTag("INSERT 0 1")}
|
||||
|
||||
err := (&MonitoringService{}).enqueueCollectNowOutbox(
|
||||
ctx,
|
||||
tx,
|
||||
uuid.New(),
|
||||
11,
|
||||
[]uuid.UUID{targetClientID},
|
||||
3,
|
||||
9,
|
||||
)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Len(t, tx.execSQLs, 1)
|
||||
normalized := normalizeSQLWhitespace(tx.execSQLs[0])
|
||||
assert.Contains(t, normalized, "'dispatch_high'")
|
||||
assert.NotContains(t, normalized, "'interrupt_requested'")
|
||||
assert.NotContains(t, normalized, "task_control")
|
||||
}
|
||||
|
||||
func TestMonitoringPlatformAuthorizationStatus(t *testing.T) {
|
||||
clientID := uuid.New()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user