Live: collect more usage stats – enabled, ha enabled, num nodes, channels, subs (#47378)
This commit is contained in:
@@ -157,3 +157,45 @@ func TestCheckOrigin(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getHistogramMetric(t *testing.T) {
|
||||
type args struct {
|
||||
val int
|
||||
bounds []int
|
||||
metricPrefix string
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
"zero",
|
||||
args{0, []int{0, 10, 100, 1000, 10000, 100000}, "live_users_"},
|
||||
"live_users_le_0",
|
||||
},
|
||||
{
|
||||
"equal_to_bound",
|
||||
args{10, []int{0, 10, 100, 1000, 10000, 100000}, "live_users_"},
|
||||
"live_users_le_10",
|
||||
},
|
||||
{
|
||||
"in_the_middle",
|
||||
args{30000, []int{0, 10, 100, 1000, 10000, 100000}, "live_users_"},
|
||||
"live_users_le_100000",
|
||||
},
|
||||
{
|
||||
"more_than_upper_bound",
|
||||
args{300000, []int{0, 10, 100, 1000, 10000, 100000}, "live_users_"},
|
||||
"live_users_le_inf",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := getHistogramMetric(tt.args.val, tt.args.bounds, tt.args.metricPrefix); got != tt.want {
|
||||
t.Errorf("getHistogramMetric() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user