Add unit test for missing port helper func
This commit is contained in:
parent
a75e5b5803
commit
fdc5aa5a50
|
@ -2,6 +2,7 @@ package agent
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
@ -541,3 +542,14 @@ func TestResources_ParseReserved(t *testing.T) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsMissingPort(t *testing.T) {
|
||||
_, _, err := net.SplitHostPort("localhost")
|
||||
if missing := isMissingPort(err); !missing {
|
||||
t.Errorf("expected missing port error, but got %v", err)
|
||||
}
|
||||
_, _, err = net.SplitHostPort("localhost:9000")
|
||||
if missing := isMissingPort(err); missing {
|
||||
t.Errorf("expected no error, but got %v", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue