Fix darwin ping tests

This commit is contained in:
Cameron Sparr 2016-06-22 18:21:07 +01:00
parent d6951dacdc
commit 7825df4771
2 changed files with 9 additions and 3 deletions

View File

@ -140,7 +140,7 @@ func (p *Ping) args(url string) []string {
if p.Timeout > 0 {
switch runtime.GOOS {
case "darwin":
args = append(args, "-W", strconv.FormatFloat(p.Timeout/1000, 'f', 1, 64))
args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', 1, 64))
case "linux":
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', 1, 64))
default:

View File

@ -95,7 +95,10 @@ func TestArgs(t *testing.T) {
p.Timeout = 12.0
actual = p.args("www.google.com")
switch runtime.GOOS {
case "darwin", "freebsd":
case "darwin":
expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-W",
"12000.0", "www.google.com"}
case "freebsd":
expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-t",
"12.0", "www.google.com"}
default:
@ -111,7 +114,10 @@ func TestArgs(t *testing.T) {
p.PingInterval = 1.2
actual = p.args("www.google.com")
switch runtime.GOOS {
case "darwin", "freebsd":
case "darwin":
expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-W",
"12000.0", "-i", "1.2", "www.google.com"}
case "freebsd":
expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-t",
"12.0", "-i", "1.2", "www.google.com"}
default: