2020-08-18 10:27:50 +03:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOptions(t *testing.T) {
|
|
|
|
|
|
|
|
// Make some new options:
|
2020-08-21 11:57:10 +03:00
|
|
|
options := NewOptions(
|
|
|
|
Address(":9999"),
|
|
|
|
DefaultTags(map[string]string{"service": "prometheus-test"}),
|
|
|
|
Path("/prometheus"),
|
|
|
|
Percentiles([]float64{0.11, 0.22, 0.33}),
|
|
|
|
)
|
2020-08-18 10:27:50 +03:00
|
|
|
|
|
|
|
// Check that the defaults and overrides were accepted:
|
2020-08-21 11:57:10 +03:00
|
|
|
assert.Equal(t, ":9999", options.Address)
|
2020-08-18 10:27:50 +03:00
|
|
|
assert.Equal(t, "prometheus-test", options.DefaultTags["service"])
|
2020-08-21 11:57:10 +03:00
|
|
|
assert.Equal(t, "/prometheus", options.Path)
|
|
|
|
assert.Equal(t, []float64{0.11, 0.22, 0.33}, options.Percentiles)
|
2020-08-18 10:27:50 +03:00
|
|
|
}
|