| 1 | package metricsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 5 | |
| 6 | "github.com/czerwonk/bird_exporter/protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/" |
| 7 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 8 | ) |
| 9 | |
| 10 | func TestLabelNamesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/TestLabelNames().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 11 | s := NewDefaultLabelStrategyscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/NewDefaultLabelStrategy().(true, `(\w+\s*)=(\s*\w+)`) |
| 12 | labels := s.LabelNamesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/DefaultLabelStrategy#LabelNames().(&protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#{ |
| 13 | Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Name.: "test", |
| 14 | Descriptionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Description.: " foo = bar x: y", |
| 15 | ImportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ImportFilter.: "in", |
| 16 | ExportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ExportFilter.: "out", |
| 17 | IPVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#IPVersion.: "6", |
| 18 | Protoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Proto.: protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.BGPscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/BGP., |
| 19 | }) |
| 20 | |
| 21 | expected := []string{"name", "proto", "ip_version", "import_filter", "export_filter", "foo"} |
| 22 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, labels) |
| 23 | } |
| 24 | |
| 25 | func TestLabelValuesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/TestLabelValues().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 26 | s := NewDefaultLabelStrategyscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/NewDefaultLabelStrategy().(true, `(\w+\s*)=(\s*\w+)`) |
| 27 | values := s.LabelValuesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/metrics`/DefaultLabelStrategy#LabelValues().(&protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#{ |
| 28 | Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Name.: "test", |
| 29 | Descriptionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Description.: " foo = bar x: y", |
| 30 | ImportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ImportFilter.: "in", |
| 31 | ExportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ExportFilter.: "out", |
| 32 | IPVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#IPVersion.: "6", |
| 33 | Protoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Proto.: protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.BGPscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/BGP., |
| 34 | }) |
| 35 | |
| 36 | expected := []string{"test", "BGP", "6", "in", "out", "bar"} |
| 37 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, values) |
| 38 | } |