mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Add unit test for missing port helper func
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user