mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
29 lines
776 B
Go
29 lines
776 B
Go
package services
|
|
|
|
import (
|
|
"testing"
|
|
|
|
metric "github.com/luxfi/metric"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRecordQueueDepthClampsNegative(t *testing.T) {
|
|
recordQueueDepth(-10)
|
|
require.Equal(t, float64(0), testutil.ToFloat64(queueDepthGauge))
|
|
}
|
|
|
|
func TestRecordWaiterCountClampsNegative(t *testing.T) {
|
|
recordWaiterCount(-5)
|
|
require.Equal(t, float64(0), testutil.ToFloat64(waiterInflightGauge))
|
|
}
|
|
|
|
func TestNormalizeAgentLabel(t *testing.T) {
|
|
require.Equal(t, "worker", normalizeAgentLabel(" worker "))
|
|
require.Equal(t, "unknown", normalizeAgentLabel(""))
|
|
}
|
|
|
|
func TestRecordGatewayBackpressure(t *testing.T) {
|
|
RecordGatewayBackpressure("Queue_Full")
|
|
require.Equal(t, float64(1), testutil.ToFloat64(backpressureCounter.WithLabelValues("queue_full")))
|
|
}
|