|
|
|
@ -59,3 +59,21 @@ func TestSanitizeLabelName(t *testing.T) {
|
|
|
|
|
expected = "barClient_LABEL____"
|
|
|
|
|
require.Equal(t, expected, actual, "SanitizeLabelName failed for label (%s)", expected)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestSanitizeFullLabelName(t *testing.T) {
|
|
|
|
|
actual := SanitizeFullLabelName("fooClientLABEL")
|
|
|
|
|
expected := "fooClientLABEL"
|
|
|
|
|
require.Equal(t, expected, actual, "SanitizeFullLabelName failed for label (%s)", expected)
|
|
|
|
|
|
|
|
|
|
actual = SanitizeFullLabelName("barClient.LABEL$$##")
|
|
|
|
|
expected = "barClient_LABEL____"
|
|
|
|
|
require.Equal(t, expected, actual, "SanitizeFullLabelName failed for label (%s)", expected)
|
|
|
|
|
|
|
|
|
|
actual = SanitizeFullLabelName("0zerothClient1LABEL")
|
|
|
|
|
expected = "_zerothClient1LABEL"
|
|
|
|
|
require.Equal(t, expected, actual, "SanitizeFullLabelName failed for label (%s)", expected)
|
|
|
|
|
|
|
|
|
|
actual = SanitizeFullLabelName("")
|
|
|
|
|
expected = "_"
|
|
|
|
|
require.Equal(t, expected, actual, "SanitizeFullLabelName failed for the empty label")
|
|
|
|
|
}
|
|
|
|
|