net/portmapper: fix invalid UPnP metric name
Fixes #9551 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I06f3a15a668be621675be6cbc7e5bdcc006e8570
This commit is contained in:
@ -124,3 +124,14 @@ func TestPCPIntegration(t *testing.T) {
|
||||
t.Errorf("got nil mapping after successful createOrGetMapping")
|
||||
}
|
||||
}
|
||||
|
||||
// Test to ensure that metric names generated by this function do not contain
|
||||
// invalid characters.
|
||||
//
|
||||
// See https://github.com/tailscale/tailscale/issues/9551
|
||||
func TestGetUPnPErrorsMetric(t *testing.T) {
|
||||
// This will panic if the metric name is invalid.
|
||||
getUPnPErrorsMetric(100)
|
||||
getUPnPErrorsMetric(0)
|
||||
getUPnPErrorsMetric(-100)
|
||||
}
|
||||
|
Reference in New Issue
Block a user