mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-30 07:40:06 +01:00
e4bb2808f1
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5197 See https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#vmstorage-groups-at-vmselect Thanks to @zekker6 for the initial pull request at https://github.com/VictoriaMetrics/VictoriaMetrics-enterprise/pull/718
27 lines
603 B
Go
27 lines
603 B
Go
package netutil
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestParseGroupAddr(t *testing.T) {
|
|
f := func(s, groupIDExpected, addrExpected string) {
|
|
t.Helper()
|
|
|
|
groupID, addr := ParseGroupAddr(s)
|
|
if groupID != groupIDExpected {
|
|
t.Fatalf("unexpected groupID; got %q; want %q", groupID, groupIDExpected)
|
|
}
|
|
if addr != addrExpected {
|
|
t.Fatalf("unexpected addr; got %q; want %q", addr, addrExpected)
|
|
}
|
|
}
|
|
|
|
f("", "", "")
|
|
f("foo", "", "foo")
|
|
f("file:/foo/bar", "", "file:/foo/bar")
|
|
f("foo/bar", "foo", "bar")
|
|
f("foo/dns+srv:bar", "foo", "dns+srv:bar")
|
|
f("foo/file:/bar/baz", "foo", "file:/bar/baz")
|
|
}
|