Test that iptables() looks for iptables in the PATH

This commit is contained in:
Solomon Hykes 2013-03-28 18:44:47 -07:00
parent 70853785b6
commit ba33d67a1a

View file

@ -2,9 +2,22 @@ package docker
import (
"net"
"os"
"testing"
)
func TestIptables(t *testing.T) {
if err := iptables("-L"); err != nil {
t.Fatal(err)
}
path := os.Getenv("PATH")
os.Setenv("PATH", "")
defer os.Setenv("PATH", path)
if err := iptables("-L"); err == nil {
t.Fatal("Not finding iptables in the PATH should cause an error")
}
}
func TestNetworkRange(t *testing.T) {
// Simple class C test
_, network, _ := net.ParseCIDR("192.168.0.1/24")